summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authoruaa <uaa@cvs.openbsd.org>2015-06-19 20:39:35 +0000
committeruaa <uaa@cvs.openbsd.org>2015-06-19 20:39:35 +0000
commit1477994317ff9651017240fcce73cb51eee4e0ea (patch)
tree6146435ea1b74b8de7d5c54a17ac1b9027effbfc /sys/dev/usb
parent4dd303de5bb47555c3acbdf5c53175c2e256249a (diff)
Only match devices with a valid configuration.
ok by mpi@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_udav.c22
-rw-r--r--sys/dev/usb/if_udavreg.h5
2 files changed, 5 insertions, 22 deletions
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 3ae65caac9b..b45214b0e55 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_udav.c,v 1.70 2015/03/23 08:41:52 mpi Exp $ */
+/* $OpenBSD: if_udav.c,v 1.71 2015/06/19 20:39:34 uaa Exp $ */
/* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@@ -167,11 +167,11 @@ udav_match(struct device *parent, void *match, void *aux)
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return (udav_lookup(uaa->vendor, uaa->product) != NULL ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
/* Attach */
@@ -181,7 +181,7 @@ udav_attach(struct device *parent, struct device *self, void *aux)
struct udav_softc *sc = (struct udav_softc *)self;
struct usb_attach_arg *uaa = aux;
struct usbd_device *dev = uaa->device;
- struct usbd_interface *iface;
+ struct usbd_interface *iface = uaa->iface;
usbd_status err;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
@@ -195,26 +195,12 @@ udav_attach(struct device *parent, struct device *self, void *aux)
sc->sc_udev = dev;
- /* Move the device into the configured state. */
- err = usbd_set_config_no(dev, UDAV_CONFIG_NO, 1);
- if (err) {
- printf("setting config no failed\n");
- goto bad;
- }
-
usb_init_task(&sc->sc_tick_task, udav_tick_task, sc,
USB_TASK_TYPE_GENERIC);
rw_init(&sc->sc_mii_lock, "udavmii");
usb_init_task(&sc->sc_stop_task, (void (*)(void *)) udav_stop_task, sc,
USB_TASK_TYPE_GENERIC);
- /* get control interface */
- err = usbd_device2interface_handle(dev, UDAV_IFACE_INDEX, &iface);
- if (err) {
- printf("failed to get interface, err=%s\n", usbd_errstr(err));
- goto bad;
- }
-
sc->sc_ctl_iface = iface;
sc->sc_flags = udav_lookup(uaa->vendor, uaa->product)->udav_flags;
diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h
index e91e8d9d8b6..15fba4c99ea 100644
--- a/sys/dev/usb/if_udavreg.h
+++ b/sys/dev/usb/if_udavreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_udavreg.h,v 1.14 2014/01/22 04:13:22 sasano Exp $ */
+/* $OpenBSD: if_udavreg.h,v 1.15 2015/06/19 20:39:34 uaa Exp $ */
/* $NetBSD: if_udavreg.h,v 1.2 2003/09/04 15:17:39 tsutsui Exp $ */
/* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */
/*
@@ -31,9 +31,6 @@
*
*/
-#define UDAV_IFACE_INDEX 0
-#define UDAV_CONFIG_NO 1
-
#define UDAV_TX_LIST_CNT 1
#define UDAV_RX_LIST_CNT 1