-/* $OpenBSD: if_smsc.c,v 1.18 2015/03/23 22:48:51 jsg Exp $ */
+/* $OpenBSD: if_smsc.c,v 1.19 2015/06/18 09:28:54 mpi Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
/*-
* Copyright (c) 2012
{
struct usb_attach_arg *uaa = aux;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL || uaa->configno != 1)
return UMATCH_NONE;
return (usb_lookup(smsc_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
+ UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE;
}
void
{
struct smsc_softc *sc = (struct smsc_softc *)self;
struct usb_attach_arg *uaa = aux;
- struct usbd_device *dev = uaa->device;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
struct mii_data *mii;
struct ifnet *ifp;
- int err, s, i;
uint32_t mac_h, mac_l;
+ int s, i;
- sc->sc_udev = dev;
-
- err = usbd_set_config_no(dev, SMSC_CONFIG_INDEX, 1);
+ sc->sc_udev = uaa->device;
+ sc->sc_iface = uaa->iface;
/* Setup the endpoints for the SMSC LAN95xx device(s) */
usb_init_task(&sc->sc_tick_task, smsc_tick_task, sc,
usb_init_task(&sc->sc_stop_task, (void (*)(void *))smsc_stop, sc,
USB_TASK_TYPE_GENERIC);
- err = usbd_device2interface_handle(dev, SMSC_IFACE_IDX, &sc->sc_iface);
- if (err) {
- printf("%s: getting interface handle failed\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
id = usbd_get_interface_descriptor(sc->sc_iface);
if (sc->sc_udev->speed >= USB_SPEED_HIGH)
-/* $OpenBSD: if_smscreg.h,v 1.4 2013/04/15 09:23:01 mglocker Exp $ */
+/* $OpenBSD: if_smscreg.h,v 1.5 2015/06/18 09:28:54 mpi Exp $ */
/*-
* Copyright (c) 2012
* Ben Gray <bgray@freebsd.org>.
#define SMSC_RX_LIST_CNT 1
#define SMSC_TX_LIST_CNT 1
-#define SMSC_CONFIG_INDEX 1 /* config number 1 */
-#define SMSC_IFACE_IDX 0
-
#define SMSC_ENDPT_RX 0
#define SMSC_ENDPT_TX 1
#define SMSC_ENDPT_INTR 2