diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2000-05-14 17:33:26 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2000-05-14 17:33:26 +0000 |
commit | 81798fe43a9509c84b21e8b4ba479816659a7171 (patch) | |
tree | b2e70c96887b5acc6ea7011128f7eafa7677b974 | |
parent | 3e77629ca5af5fa1c96b3b870abc8e91023e978a (diff) | |
download | FreeBSD-src-81798fe43a9509c84b21e8b4ba479816659a7171.zip FreeBSD-src-81798fe43a9509c84b21e8b4ba479816659a7171.tar.gz |
Sync with NetBSD:
Mostly textual changes.
Set configuration to 0 (reset all endpoints) on open.
-rw-r--r-- | sys/dev/usb/ugen.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 6e02ea5..e504995 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -68,7 +68,7 @@ #ifdef UGEN_DEBUG #define DPRINTF(x) if (ugendebug) logprintf x #define DPRINTFN(n,x) if (ugendebug>(n)) logprintf x -int ugendebug = 10; +int ugendebug = 0; #else #define DPRINTF(x) #define DPRINTFN(n,x) @@ -167,6 +167,7 @@ USB_MATCH(ugen) USB_ATTACH(ugen) { USB_ATTACH_START(ugen, sc, uaa); + usbd_device_handle udev; char devinfo[1024]; usbd_status err; int conf; @@ -175,8 +176,19 @@ USB_ATTACH(ugen) USB_ATTACH_SETUP; printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); - sc->sc_udev = uaa->device; - conf = 1; /* XXX should not hard code 1 */ + sc->sc_udev = udev = uaa->device; + + /* First set configuration index 0, the default one for ugen. */ + err = usbd_set_config_index(udev, 0, 0); + if (err) { + printf("%s: setting configuration index 0 failed\n", + USBDEVNAME(sc->sc_dev)); + sc->sc_dying = 1; + USB_ATTACH_ERROR_RETURN; + } + conf = usbd_get_config_descriptor(udev)->bConfigurationValue; + + /* Set up all the local state for this configuration. */ err = ugen_set_config(sc, conf); if (err) { printf("%s: setting configuration %d failed\n", @@ -311,6 +323,7 @@ ugenopen(dev, flag, mode, p) sc->sc_is_open[USB_CONTROL_ENDPOINT] = 1; return (0); } + /* Make sure there are pipes for all directions. */ for (dir = OUT; dir <= IN; dir++) { if (flag & (dir == OUT ? FWRITE : FREAD)) { @@ -754,7 +767,7 @@ ugenintr(xfer, addr, status) return; } - usbd_get_xfer_status(xfer, 0, 0, &count, 0); + usbd_get_xfer_status(xfer, NULL, NULL, &count, NULL); ibuf = sce->ibuf; DPRINTFN(5, ("ugenintr: xfer=%p status=%d count=%d\n", |