MFNetBSD: ugen.c (1.57), ulpt.c (1.48), usb.c (1.67), usbdi.c (1.96),
usbdi.h (1.60) (and local changes compatibility changes to ufm.c and urio.c) date: 2002/02/11 15:11:49; author: augustss; Give usbd_do_request_flags() an extra argument for the timeout.
This commit is contained in:
parent
32d4653993
commit
567f4af63d
@ -274,7 +274,8 @@ ufm_do_req(struct ufm_softc *sc, u_int8_t reqtype, u_int8_t request,
|
||||
USETW(req.wValue, value);
|
||||
USETW(req.wIndex, index);
|
||||
USETW(req.wLength, len);
|
||||
err = usbd_do_request_flags(sc->sc_udev, &req, retbuf, 0, NULL);
|
||||
err = usbd_do_request_flags(sc->sc_udev, &req, retbuf, 0, NULL,
|
||||
USBD_DEFAULT_TIMEOUT);
|
||||
splx(s);
|
||||
if (err) {
|
||||
printf("usbd_do_request_flags returned %#x\n", err);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ugen.c,v 1.51 2001/11/13 07:59:32 augustss Exp $ */
|
||||
/* $NetBSD: ugen.c,v 1.57 2002/02/11 15:11:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -487,6 +487,7 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
|
||||
usbd_free_xfer(sce->isoreqs[i].xfer);
|
||||
return (ENOMEM);
|
||||
case UE_CONTROL:
|
||||
sce->timeout = USBD_DEFAULT_TIMEOUT;
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
@ -1112,18 +1113,9 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
sce->state &= ~UGEN_SHORT_OK;
|
||||
return (0);
|
||||
case USB_SET_TIMEOUT:
|
||||
if (endpt == USB_CONTROL_ENDPOINT) {
|
||||
/* XXX the lower levels don't support this yet. */
|
||||
return (EINVAL);
|
||||
}
|
||||
sce = &sc->sc_endpoints[endpt][IN];
|
||||
if (sce == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if (sce->pipeh == NULL) {
|
||||
printf("ugenioctl: USB_SET_TIMEOUT, no pipe\n");
|
||||
return (EIO);
|
||||
}
|
||||
sce->timeout = *(int *)addr;
|
||||
return (0);
|
||||
default:
|
||||
@ -1316,8 +1308,9 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
sce = &sc->sc_endpoints[endpt][IN];
|
||||
err = usbd_do_request_flags(sc->sc_udev, &ur->ucr_request,
|
||||
ptr, ur->ucr_flags, &ur->ucr_actlen);
|
||||
ptr, ur->ucr_flags, &ur->ucr_actlen, sce->timeout);
|
||||
if (err) {
|
||||
error = EIO;
|
||||
goto ret;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ulpt.c,v 1.46 2001/12/31 12:15:21 augustss Exp $ */
|
||||
/* $NetBSD: ulpt.c,v 1.48 2002/02/11 15:11:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -309,7 +309,7 @@ USB_ATTACH(ulpt)
|
||||
USETW2(req.wIndex, id->bInterfaceNumber, id->bAlternateSetting);
|
||||
USETW(req.wLength, sizeof devinfo - 1);
|
||||
err = usbd_do_request_flags(dev, &req, devinfo, USBD_SHORT_XFER_OK,
|
||||
&alen);
|
||||
&alen, USBD_DEFAULT_TIMEOUT);
|
||||
if (err) {
|
||||
printf("%s: cannot get device id\n", USBDEVNAME(sc->sc_dev));
|
||||
} else if (alen <= 2) {
|
||||
|
@ -576,7 +576,8 @@ urioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p)
|
||||
}
|
||||
|
||||
r = usbd_do_request_flags(sc->sc_udev, &req,
|
||||
ptr, req_flags, &req_actlen);
|
||||
ptr, req_flags, &req_actlen,
|
||||
USBD_DEFAULT_TIMEOUT);
|
||||
if (r == USBD_NORMAL_COMPLETION) {
|
||||
error = 0;
|
||||
if (len != 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb.c,v 1.66 2002/02/03 18:15:21 augustss Exp $ */
|
||||
/* $NetBSD: usb.c,v 1.67 2002/02/11 15:11:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -613,7 +613,8 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
}
|
||||
}
|
||||
err = usbd_do_request_flags(sc->sc_bus->devices[addr],
|
||||
&ur->ucr_request, ptr, ur->ucr_flags, &ur->ucr_actlen);
|
||||
&ur->ucr_request, ptr, ur->ucr_flags, &ur->ucr_actlen,
|
||||
USBD_DEFAULT_TIMEOUT);
|
||||
if (err) {
|
||||
error = EIO;
|
||||
goto ret;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usbdi.c,v 1.94 2001/12/30 20:26:59 augustss Exp $ */
|
||||
/* $NetBSD: usbdi.c,v 1.96 2002/02/11 15:11:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -178,7 +178,7 @@ usbd_open_pipe(usbd_interface_handle iface, u_int8_t address,
|
||||
u_int8_t flags, usbd_pipe_handle *pipe)
|
||||
{
|
||||
return (usbd_open_pipe_ival(iface, address, flags, pipe,
|
||||
USBD_DEFAULT_INTERVAL));
|
||||
USBD_DEFAULT_TIMEOUT));
|
||||
}
|
||||
|
||||
usbd_status
|
||||
@ -923,20 +923,22 @@ usbd_start_next(usbd_pipe_handle pipe)
|
||||
usbd_status
|
||||
usbd_do_request(usbd_device_handle dev, usb_device_request_t *req, void *data)
|
||||
{
|
||||
return (usbd_do_request_flags(dev, req, data, 0, 0));
|
||||
return (usbd_do_request_flags(dev, req, data, 0, 0,
|
||||
USBD_DEFAULT_TIMEOUT));
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_do_request_flags(usbd_device_handle dev, usb_device_request_t *req,
|
||||
void *data, u_int16_t flags, int *actlen)
|
||||
void *data, u_int16_t flags, int *actlen, u_int32_t timo)
|
||||
{
|
||||
return (usbd_do_request_flags_pipe(dev, dev->default_pipe, req,
|
||||
data, flags, actlen));
|
||||
return (usbd_do_request_flags_pipe(dev, dev->default_pipe, req,
|
||||
data, flags, actlen, timo));
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_do_request_flags_pipe(usbd_device_handle dev, usbd_pipe_handle pipe,
|
||||
usb_device_request_t *req, void *data, u_int16_t flags, int *actlen)
|
||||
usb_device_request_t *req, void *data, u_int16_t flags, int *actlen,
|
||||
u_int32_t timeout)
|
||||
{
|
||||
usbd_xfer_handle xfer;
|
||||
usbd_status err;
|
||||
@ -955,7 +957,7 @@ usbd_do_request_flags_pipe(usbd_device_handle dev, usbd_pipe_handle pipe,
|
||||
xfer = usbd_alloc_xfer(dev);
|
||||
if (xfer == NULL)
|
||||
return (USBD_NOMEM);
|
||||
usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req,
|
||||
usbd_setup_default_xfer(xfer, dev, 0, timeout, req,
|
||||
data, UGETW(req->wLength), flags, 0);
|
||||
xfer->pipe = pipe;
|
||||
err = usbd_sync_transfer(xfer);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usbdi.h,v 1.59 2001/12/24 21:36:15 augustss Exp $ */
|
||||
/* $NetBSD: usbdi.h,v 1.60 2002/02/11 15:11:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
@ -139,10 +139,11 @@ usbd_status usbd_do_request_async(usbd_device_handle pipe,
|
||||
usb_device_request_t *req, void *data);
|
||||
usbd_status usbd_do_request_flags(usbd_device_handle pipe,
|
||||
usb_device_request_t *req,
|
||||
void *data, u_int16_t flags, int *);
|
||||
void *data, u_int16_t flags, int*, u_int32_t);
|
||||
usbd_status usbd_do_request_flags_pipe(
|
||||
usbd_device_handle dev, usbd_pipe_handle pipe,
|
||||
usb_device_request_t *req, void *data, u_int16_t flags, int *actlen);
|
||||
usb_device_request_t *req, void *data, u_int16_t flags, int *actlen,
|
||||
u_int32_t);
|
||||
usb_interface_descriptor_t *usbd_get_interface_descriptor
|
||||
(usbd_interface_handle iface);
|
||||
usb_config_descriptor_t *usbd_get_config_descriptor(usbd_device_handle dev);
|
||||
|
Loading…
Reference in New Issue
Block a user