Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Give usbd_do_request_flags() an extra argument f...



details:   https://anonhg.NetBSD.org/src/rev/494d1ad3bcfa
branches:  trunk
changeset: 522102:494d1ad3bcfa
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Feb 11 15:11:49 2002 +0000

description:
Give usbd_do_request_flags() an extra argument for the timeout.

diffstat:

 sys/dev/usb/ugen.c   |  18 ++++++++++--------
 sys/dev/usb/ulpt.c   |   6 +++---
 sys/dev/usb/urio.c   |   6 +++---
 sys/dev/usb/usb.c    |   7 ++++---
 sys/dev/usb/usbdi.c  |  16 +++++++++-------
 sys/dev/usb/usbdi.h  |   9 +++++----
 sys/dev/usb/uvisor.c |   8 ++++----
 7 files changed, 38 insertions(+), 32 deletions(-)

diffs (257 lines):

diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/ugen.c        Mon Feb 11 15:11:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.56 2002/01/02 16:20:14 augustss Exp $       */
+/*     $NetBSD: ugen.c,v 1.57 2002/02/11 15:11:49 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -40,7 +40,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.56 2002/01/02 16:20:14 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.57 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -423,6 +423,7 @@
                                usbd_free_xfer(sce->isoreqs[i].xfer);
                        return (ENOMEM);
                case UE_CONTROL:
+                       sce->timeout = USBD_DEFAULT_TIMEOUT;
                        return (EINVAL);
                }
        }
@@ -1033,12 +1034,12 @@
                        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 || sce->pipeh == NULL)
+               if (sce == NULL 
+                   /* XXX this shouldn't happen, but the distinction between
+                      input and output pipes isn't clear enough.
+                      || sce->pipeh == NULL */
+                       )
                        return (EINVAL);
                sce->timeout = *(int *)addr;
                return (0);
@@ -1232,8 +1233,9 @@
                                        goto ret;
                        }
                }
+               sce = &sc->sc_endpoints[endpt][IN];
                err = usbd_do_request_flags(sc->sc_udev, &ur->request,
-                         ptr, ur->flags, &ur->actlen);
+                         ptr, ur->flags, &ur->actlen, sce->timeout);
                if (err) {
                        error = EIO;
                        goto ret;
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/ulpt.c
--- a/sys/dev/usb/ulpt.c        Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/ulpt.c        Mon Feb 11 15:11:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ulpt.c,v 1.47 2002/02/11 10:04:28 augustss Exp $       */
+/*     $NetBSD: ulpt.c,v 1.48 2002/02/11 15:11:49 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $       */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.47 2002/02/11 10:04:28 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.48 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -312,7 +312,7 @@
        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) {
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/urio.c
--- a/sys/dev/usb/urio.c        Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/urio.c        Mon Feb 11 15:11:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: urio.c,v 1.10 2001/12/31 12:15:22 augustss Exp $       */
+/*     $NetBSD: urio.c,v 1.11 2002/02/11 15:11:49 augustss Exp $       */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.10 2001/12/31 12:15:22 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.11 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -546,7 +546,7 @@
        sc->sc_refcnt++;
 
        err = usbd_do_request_flags(sc->sc_udev, &req, ptr, req_flags,
-                                   &req_actlen);
+                 &req_actlen, USBD_DEFAULT_TIMEOUT);
 
        if (--sc->sc_refcnt < 0)
                usb_detach_wakeup(USBDEV(sc->sc_dev));
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/usb.c Mon Feb 11 15:11:49 2002 +0000
@@ -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 $        */
 
 /*
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.66 2002/02/03 18:15:21 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.67 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -512,7 +512,8 @@
                        }
                }
                err = usbd_do_request_flags(sc->sc_bus->devices[addr],
-                         &ur->request, ptr, ur->flags, &ur->actlen);
+                         &ur->request, ptr, ur->flags, &ur->actlen,
+                         USBD_DEFAULT_TIMEOUT);
                if (err) {
                        error = EIO;
                        goto ret;
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/usbdi.c       Mon Feb 11 15:11:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.95 2002/02/11 12:42:48 augustss Exp $      */
+/*     $NetBSD: usbdi.c,v 1.96 2002/02/11 15:11:49 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $      */
 
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.95 2002/02/11 12:42:48 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.96 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -925,20 +925,22 @@
 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, NULL, 0,
+                                     USBD_DEFAULT_INTERVAL));
 }
 
 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));
+                                          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;
@@ -957,7 +959,7 @@
        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);
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h       Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/usbdi.h       Mon Feb 11 15:11:49 2002 +0000
@@ -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: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $      */
 
 /*
@@ -139,10 +139,11 @@
                                  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);
@@ -150,7 +151,7 @@
 usbd_status usbd_set_interface(usbd_interface_handle, int);
 int usbd_get_no_alts(usb_config_descriptor_t *, int);
 usbd_status  usbd_get_interface(usbd_interface_handle iface, u_int8_t *aiface);
-void usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di, int);
+void usbd_fill_deviceinfo(usbd_device_handle,struct usb_device_info*,u_int32_t);
 int usbd_get_interface_altindex(usbd_interface_handle iface);
 
 usb_interface_descriptor_t *usbd_find_idesc(usb_config_descriptor_t *cd,
diff -r 663ddb1a644a -r 494d1ad3bcfa sys/dev/usb/uvisor.c
--- a/sys/dev/usb/uvisor.c      Mon Feb 11 15:00:35 2002 +0000
+++ b/sys/dev/usb/uvisor.c      Mon Feb 11 15:11:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvisor.c,v 1.12 2001/11/13 06:24:57 lukem Exp $        */
+/*     $NetBSD: uvisor.c,v 1.13 2002/02/11 15:11:49 augustss Exp $     */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.12 2001/11/13 06:24:57 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.13 2002/02/11 15:11:49 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -341,7 +341,7 @@
        USETW(req.wIndex, 0);
        USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
        err = usbd_do_request_flags(sc->sc_udev, &req, ci,
-                                   USBD_SHORT_XFER_OK, &actlen);
+                 USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT);
        if (err)
                return (err);
 
@@ -377,5 +377,5 @@
        USETW(req.wIndex, 0);
        USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
        (void)usbd_do_request_flags(sc->sc_udev, &req, &coninfo, 
-                                   USBD_SHORT_XFER_OK, &actlen);
+                 USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT);
 }



Home | Main Index | Thread Index | Old Index