Date: Mon, 19 Mar 2018 04:03:55 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331176 - in stable/11/sys/dev/usb: net serial Message-ID: <201803190403.w2J43tUX015995@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Mon Mar 19 04:03:55 2018 New Revision: 331176 URL: https://svnweb.freebsd.org/changeset/base/331176 Log: MFC r328162: Improve support for USB based 3G/4G/5G dongles from Huawei. PR: 192345 Modified: stable/11/sys/dev/usb/net/if_cdce.c stable/11/sys/dev/usb/serial/u3g.c stable/11/sys/dev/usb/serial/umodem.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/net/if_cdce.c Mon Mar 19 04:03:55 2018 (r331176) @@ -286,6 +286,9 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x76), USB_DRIVER_INFO(0)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x03), USB_IFACE_PROTOCOL(0x16), + USB_DRIVER_INFO(0)}, }; static const STRUCT_USB_DUAL_ID cdce_dual_devs[] = { Modified: stable/11/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/serial/u3g.c Mon Mar 19 04:03:55 2018 (r331176) @@ -307,7 +307,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, E173, 0), U3G_DEV(HUAWEI, E173_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, E3131, 0), - U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI), + U3G_DEV(HUAWEI, E3131_INIT, U3GINIT_HUAWEISCSI2), U3G_DEV(HUAWEI, E180V, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI), @@ -326,6 +326,8 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(HUAWEI, K4505, U3GINIT_HUAWEI), U3G_DEV(HUAWEI, K4505_INIT, U3GINIT_HUAWEISCSI), U3G_DEV(HUAWEI, ETS2055, U3GINIT_HUAWEI), + U3G_DEV(HUAWEI, E3272_INIT, U3GINIT_HUAWEISCSI2), + U3G_DEV(HUAWEI, E3272, 0), U3G_DEV(KYOCERA2, CDMA_MSM_K, 0), U3G_DEV(KYOCERA2, KPC680, 0), U3G_DEV(LONGCHEER, WM66, U3GINIT_HUAWEI), @@ -628,6 +630,45 @@ u3g_huawei_init(struct usb_device *udev) return (0); } +static int +u3g_huawei_is_cdce(uint16_t idVendor, uint8_t bInterfaceSubClass, + uint8_t bInterfaceProtocol) +{ + /* + * This function returns non-zero if the interface being + * probed is of type CDC ethernet, which the U3G driver should + * not attach to. See sys/dev/usb/net/if_cdce.c for matching + * entries. + */ + if (idVendor != USB_VENDOR_HUAWEI) + goto done; + + switch (bInterfaceSubClass) { + case 0x02: + switch (bInterfaceProtocol) { + case 0x16: + case 0x46: + case 0x76: + return (1); + default: + break; + } + break; + case 0x03: + switch (bInterfaceProtocol) { + case 0x16: + return (1); + default: + break; + } + break; + default: + break; + } +done: + return (0); +} + static void u3g_sael_m460_init(struct usb_device *udev) { @@ -841,6 +882,10 @@ u3g_probe(device_t self) if (uaa->info.bInterfaceClass != UICLASS_VENDOR) { return (ENXIO); } + if (u3g_huawei_is_cdce(uaa->info.idVendor, uaa->info.bInterfaceSubClass, + uaa->info.bInterfaceProtocol)) { + return (ENXIO); + } return (usbd_lookup_id_by_uaa(u3g_devs, sizeof(u3g_devs), uaa)); } @@ -883,6 +928,9 @@ u3g_attach(device_t dev) break; id = usbd_get_interface_descriptor(iface); if (id == NULL || id->bInterfaceClass != UICLASS_VENDOR) + continue; + if (u3g_huawei_is_cdce(uaa->info.idVendor, + id->bInterfaceSubClass, id->bInterfaceProtocol)) continue; usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex); iface_valid |= (1<<i); Modified: stable/11/sys/dev/usb/serial/umodem.c ============================================================================== --- stable/11/sys/dev/usb/serial/umodem.c Mon Mar 19 03:57:14 2018 (r331175) +++ stable/11/sys/dev/usb/serial/umodem.c Mon Mar 19 04:03:55 2018 (r331176) @@ -131,6 +131,18 @@ static const STRUCT_USB_DUAL_ID umodem_dual_devs[] = { static const STRUCT_USB_HOST_ID umodem_host_devs[] = { /* Huawei Modem class match */ + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x01)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x02)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x10)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x12)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x61)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x62)}, {USB_VENDOR(USB_VENDOR_HUAWEI),USB_IFACE_CLASS(UICLASS_CDC), USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), USB_IFACE_PROTOCOL(0xFF)},
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803190403.w2J43tUX015995>