Date: Tue, 5 Aug 2014 12:08:50 +0000 (UTC) From: Nick Hibma <n_hibma@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269584 - in head/sys/dev/usb: . net Message-ID: <53e0c952.58c8.6c9734e6@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: n_hibma Date: Tue Aug 5 12:08:50 2014 New Revision: 269584 URL: http://svnweb.freebsd.org/changeset/base/269584 Log: Add support for Huawei E3272 modems which are supported by the CDC ethernet class. Note: This is untested as I do not have a device like this. That is reflected in the MFC timeout. PR: 192345 Submitted by: rozhuk.im gmail.com MFC after: 4 weeks Modified: head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Tue Aug 5 12:04:40 2014 (r269583) +++ head/sys/dev/usb/net/if_cdce.c Tue Aug 5 12:08:50 2014 (r269584) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR cdce_debug #include <dev/usb/usb_debug.h> #include <dev/usb/usb_process.h> +#include <dev/usb/usb_msctest.h> #include "usb_if.h" #include <dev/usb/net/usb_ethernet.h> @@ -251,8 +252,11 @@ static driver_t cdce_driver = { }; static devclass_t cdce_devclass; +static eventhandler_tag cdce_etag; -DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); +static int cdce_driver_loaded(struct module *, int, void *); + +DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, cdce_driver_loaded, 0); MODULE_VERSION(cdce, 1); MODULE_DEPEND(cdce, uether, 1, 1, 1); MODULE_DEPEND(cdce, usb, 1, 1, 1); @@ -267,6 +271,10 @@ static const struct usb_ether_methods cd .ue_setpromisc = cdce_setpromisc, }; +static const STRUCT_USB_HOST_ID cdce_switch_devs[] = { + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, MSC_EJECT_HUAWEI2)}, +}; + static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VPI(USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250, CDCE_FLAG_NO_UNION)}, @@ -281,6 +289,16 @@ static const STRUCT_USB_HOST_ID cdce_hos {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, + + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x16), + USB_DRIVER_INFO(0)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x46), + USB_DRIVER_INFO(0)}, + {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x76), + USB_DRIVER_INFO(0)}, }; static const STRUCT_USB_DUAL_ID cdce_dual_devs[] = { @@ -474,6 +492,48 @@ cdce_ncm_init(struct cdce_softc *sc) } #endif +static void +cdce_test_autoinst(void *arg, struct usb_device *udev, + struct usb_attach_arg *uaa) +{ + struct usb_interface *iface; + struct usb_interface_descriptor *id; + + if (uaa->dev_state != UAA_DEV_READY) + return; + + iface = usbd_get_iface(udev, 0); + if (iface == NULL) + return; + id = iface->idesc; + if (id == NULL || id->bInterfaceClass != UICLASS_MASS) + return; + if (usbd_lookup_id_by_uaa(cdce_switch_devs, sizeof(cdce_switch_devs), uaa)) + return; /* no device match */ + + if (usb_msc_eject(udev, 0, USB_GET_DRIVER_INFO(uaa)) == 0) { + /* success, mark the udev as disappearing */ + uaa->dev_state = UAA_DEV_EJECTING; + } +} + +static int +cdce_driver_loaded(struct module *mod, int what, void *arg) +{ + switch (what) { + case MOD_LOAD: + /* register our autoinstall handler */ + cdce_etag = EVENTHANDLER_REGISTER(usb_dev_configured, + cdce_test_autoinst, NULL, EVENTHANDLER_PRI_ANY); + return (0); + case MOD_UNLOAD: + EVENTHANDLER_DEREGISTER(usb_dev_configured, cdce_etag); + return (0); + default: + return (EOPNOTSUPP); + } +} + static int cdce_probe(device_t dev) { Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Aug 5 12:04:40 2014 (r269583) +++ head/sys/dev/usb/usbdevs Tue Aug 5 12:08:50 2014 (r269584) @@ -2342,9 +2342,11 @@ product HUAWEI E392 0x1505 LTE modem product HUAWEI E3131 0x1506 3G modem product HUAWEI K3765_INIT 0x1520 K3765 Initial product HUAWEI K4505_INIT 0x1521 K4505 Initial +product HUAWEI E3272_INIT 0x155b LTE modem initial product HUAWEI ETS2055 0x1803 CDMA modem product HUAWEI E173 0x1c05 3G modem product HUAWEI E173_INIT 0x1c0b 3G modem initial +product HUAWEI E3272 0x1c1e LTE modem /* HUAWEI 3com products */ product HUAWEI3COM WUB320G 0x0009 Aolynk WUB320g
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e0c952.58c8.6c9734e6>