-/* $OpenBSD: if_athn_usb.c,v 1.33 2015/03/02 15:23:28 stsp Exp $ */
+/* $OpenBSD: if_athn_usb.c,v 1.34 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return ((athn_usb_lookup(uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
void
struct athn_usb_softc *usc = (struct athn_usb_softc *)self;
struct athn_softc *sc = &usc->sc_sc;
struct usb_attach_arg *uaa = aux;
- int error;
usc->sc_udev = uaa->device;
+ usc->sc_iface = uaa->iface;
usc->flags = athn_usb_lookup(uaa->vendor, uaa->product)->flags;
sc->flags |= ATHN_FLAG_USB;
usb_init_task(&usc->sc_task, athn_usb_task, sc, USB_TASK_TYPE_GENERIC);
- if (usbd_set_config_no(usc->sc_udev, 1, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* Get the first interface handle. */
- error = usbd_device2interface_handle(usc->sc_udev, 0, &usc->sc_iface);
- if (error != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
if (athn_usb_open_pipes(usc) != 0)
return;
-/* $OpenBSD: if_axe.c,v 1.130 2015/05/17 02:44:38 canacar Exp $ */
+/* $OpenBSD: if_axe.c,v 1.131 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org>
{
struct usb_attach_arg *uaa = aux;
- if (!uaa->iface)
- return(UMATCH_NONE);
+ if (uaa->iface == NULL || uaa->configno != 1)
+ return (UMATCH_NONE);
return (axe_lookup(uaa->vendor, uaa->product) != NULL ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
/*
{
struct axe_softc *sc = (struct axe_softc *)self;
struct usb_attach_arg *uaa = aux;
- struct usbd_device *dev = uaa->device;
- usbd_status err;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
struct mii_data *mii;
int i, s;
sc->axe_unit = self->dv_unit; /*device_get_unit(self);*/
- sc->axe_udev = dev;
-
- err = usbd_set_config_no(dev, AXE_CONFIG_NO, 1);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->axe_dev.dv_xname);
- return;
- }
-
+ sc->axe_udev = uaa->device;
+ sc->axe_iface = uaa->iface;
sc->axe_flags = axe_lookup(uaa->vendor, uaa->product)->axe_flags;
usb_init_task(&sc->axe_tick_task, axe_tick_task, sc,
usb_init_task(&sc->axe_stop_task, (void (*)(void *))axe_stop, sc,
USB_TASK_TYPE_GENERIC);
- err = usbd_device2interface_handle(dev, AXE_IFACE_IDX, &sc->axe_iface);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->axe_dev.dv_xname);
- return;
- }
-
sc->axe_product = uaa->product;
sc->axe_vendor = uaa->vendor;
-/* $OpenBSD: if_axen.c,v 1.12 2015/03/20 11:58:04 mpi Exp $ */
+/* $OpenBSD: if_axen.c,v 1.13 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 2013 Yojiro UO <yuo@openbsd.org>
{
struct usb_attach_arg *uaa = aux;
- if (!uaa->iface)
- return UMATCH_NONE;
+ if (uaa->iface == NULL || uaa->configno != 1)
+ return (UMATCH_NONE);
return (axen_lookup(uaa->vendor, uaa->product) != NULL ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
void
{
struct axen_softc *sc = (struct axen_softc *)self;
struct usb_attach_arg *uaa = aux;
- struct usbd_device *dev = uaa->device;
- usbd_status err;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
struct mii_data *mii;
int i, s;
sc->axen_unit = self->dv_unit; /*device_get_unit(self);*/
- sc->axen_udev = dev;
-
- err = usbd_set_config_no(dev, AXEN_CONFIG_NO, 1);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->axen_dev.dv_xname);
- return;
- }
-
+ sc->axen_udev = uaa->device;
+ sc->axen_iface = uaa->iface;
sc->axen_flags = axen_lookup(uaa->vendor, uaa->product)->axen_flags;
usb_init_task(&sc->axen_tick_task, axen_tick_task, sc,
usb_init_task(&sc->axen_stop_task, (void (*)(void *))axen_stop, sc,
USB_TASK_TYPE_GENERIC);
- err = usbd_device2interface_handle(dev, AXEN_IFACE_IDX,
- &sc->axen_iface);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->axen_dev.dv_xname);
- return;
- }
-
sc->axen_product = uaa->product;
sc->axen_vendor = uaa->vendor;
-/* $OpenBSD: if_axenreg.h,v 1.3 2014/01/08 22:24:35 bluhm Exp $ */
+/* $OpenBSD: if_axenreg.h,v 1.4 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 2013 Yojiro UO <yuo@openbsd.org>. All right reserved.
#define AXEN_TX_LIST_CNT 1
-#define AXEN_CONFIG_NO 1
-#define AXEN_IFACE_IDX 0
-
/*
* The interrupt endpoint is currently unused
* by the ASIX part.
-/* $OpenBSD: if_axereg.h,v 1.25 2015/05/17 02:44:38 canacar Exp $ */
+/* $OpenBSD: if_axereg.h,v 1.26 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
#define AXE_CTL_READ 0x01
#define AXE_CTL_WRITE 0x02
-#define AXE_CONFIG_NO 1
-#define AXE_IFACE_IDX 0
-
/* EEPROM Map */
#define AXE_EEPROM_772B_NODEID 0x04
-/* $OpenBSD: if_rsu.c,v 1.26 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_rsu.c,v 1.27 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return ((usb_lookup(rsu_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
void
int i, error;
sc->sc_udev = uaa->device;
+ sc->sc_iface = uaa->iface;
usb_init_task(&sc->sc_task, rsu_task, sc, USB_TASK_TYPE_GENERIC);
timeout_set(&sc->calib_to, rsu_calib_to, sc);
- if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* Get the first interface handle. */
- error = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface);
- if (error != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
/* Read chip revision. */
sc->cut = MS(rsu_read_4(sc, R92S_PMC_FSM), R92S_PMC_FSM_CUT);
if (sc->cut != 3)
-/* $OpenBSD: if_rum.c,v 1.110 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_rum.c,v 1.111 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return UMATCH_NONE;
return (usb_lookup(rum_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE;
}
void
struct ifnet *ifp = &ic->ic_if;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
- usbd_status error;
int i, ntries;
uint32_t tmp;
sc->sc_udev = uaa->device;
-
- if (usbd_set_config_no(sc->sc_udev, RT2573_CONFIG_NO, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* get the first interface handle */
- error = usbd_device2interface_handle(sc->sc_udev, RT2573_IFACE_INDEX,
- &sc->sc_iface);
- if (error != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
+ sc->sc_iface = uaa->iface;
/*
* Find endpoints.
-/* $OpenBSD: if_rumreg.h,v 1.15 2013/11/26 20:33:18 deraadt Exp $ */
+/* $OpenBSD: if_rumreg.h,v 1.16 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
#define RT2573_TX_DESC_SIZE (sizeof (struct rum_tx_desc))
#define RT2573_RX_DESC_SIZE (sizeof (struct rum_rx_desc))
-#define RT2573_CONFIG_NO 1
-#define RT2573_IFACE_INDEX 0
-
#define RT2573_MCU_CNTL 0x01
#define RT2573_WRITE_MAC 0x02
#define RT2573_READ_MAC 0x03
-/* $OpenBSD: if_run.c,v 1.108 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_run.c,v 1.109 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return UMATCH_NONE;
return (usb_lookup(run_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE;
}
void
struct ifnet *ifp = &ic->ic_if;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
- int i, nrx, ntx, ntries, error;
+ int i, nrx, ntx, ntries;
uint32_t ver;
sc->sc_udev = uaa->device;
-
- if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* get the first interface handle */
- error = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface);
- if (error != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
+ sc->sc_iface = uaa->iface;
/*
* Find all bulk endpoints. There are 7 bulk endpoints: 1 for RX
-/* $OpenBSD: if_urtw.c,v 1.52 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: if_urtw.c,v 1.53 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2009 Martynas Venckus <martynas@openbsd.org>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return ((urtw_lookup(uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
void
int i;
sc->sc_udev = uaa->device;
+ sc->sc_iface = uaa->iface;
sc->sc_hwrev = urtw_lookup(uaa->vendor, uaa->product)->rev;
- if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* Get the first interface handle. */
- if (usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface) != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
printf("%s: ", sc->sc_dev.dv_xname);
if (sc->sc_hwrev & URTW_HWREV_8187) {
-/* $OpenBSD: if_urtwn.c,v 1.47 2015/05/12 11:46:15 stsp Exp $ */
+/* $OpenBSD: if_urtwn.c,v 1.48 2015/06/12 15:47:31 mpi Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return ((usb_lookup(urtwn_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
void
int i, error;
sc->sc_udev = uaa->device;
+ sc->sc_iface = uaa->iface;
usb_init_task(&sc->sc_task, urtwn_task, sc, USB_TASK_TYPE_GENERIC);
timeout_set(&sc->scan_to, urtwn_next_scan, sc);
timeout_set(&sc->calib_to, urtwn_calib_to, sc);
- if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) {
- printf("%s: could not set configuration no\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /* Get the first interface handle. */
- error = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface);
- if (error != 0) {
- printf("%s: could not get interface handle\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
if (uaa->product == USB_PRODUCT_DLINK_DWA123D1 ||
uaa->product == USB_PRODUCT_DLINK_DWA125D1 ||
uaa->product == USB_PRODUCT_ELECOM_WDC150SU2M ||
-/* $OpenBSD: if_wi_usb.c,v 1.65 2015/06/10 20:50:05 miod Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.66 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return (UMATCH_NONE);
return (wi_usb_lookup(uaa->vendor, uaa->product) != NULL ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE);
}
struct usb_attach_arg *uaa = aux;
/* int s; */
struct usbd_device *dev = uaa->device;
- struct usbd_interface *iface;
- usbd_status err;
+ struct usbd_interface *iface = uaa->iface;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
int i;
DPRINTFN(5,(" : wi_usb_attach: sc=%p", sc));
- err = usbd_set_config_no(dev, WI_USB_CONFIG_NO, 1);
- if (err) {
- printf("%s: setting config no failed\n", sc->wi_usb_dev.dv_xname);
- return;
- }
-
/* XXX - any tasks? */
- err = usbd_device2interface_handle(dev, WI_USB_IFACE_IDX, &iface);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->wi_usb_dev.dv_xname);
- return;
- }
-
/* XXX - flags? */
sc->wi_usb_udev = dev;
-/* $OpenBSD: if_wi_usb.h,v 1.2 2005/10/31 05:37:13 jsg Exp $ */
+/* $OpenBSD: if_wi_usb.h,v 1.3 2015/06/12 15:47:31 mpi Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
* Materiel Command, USAF, under agreement number F30602-01-2-0537.
*/
-#define WI_USB_CONFIG_NO 1
-
#define WI_USB_ENDPT_TX 1
#define WI_USB_ENDPT_RX 2
#define WI_USB_ENDPT_INTR 3
#define WI_USB_ENDPT_MAX 4
-#define WI_USB_IFACE_IDX 0
-
/* XXX */
#define WI_USB_DATA_MAXLEN WI_DEFAULT_DATALEN