Index: if_umb.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_umb.c,v retrieving revision 1.49 diff -u -p -r1.49 if_umb.c --- if_umb.c 11 Jan 2022 10:34:13 -0000 1.49 +++ if_umb.c 31 Mar 2023 01:40:12 -0000 @@ -237,12 +237,13 @@ const struct umb_quirk umb_quirks[] = { 2, UMATCH_VENDOR_PRODUCT }, - +#if 0 { { USB_VENDOR_QUECTEL, USB_PRODUCT_QUECTEL_EC25 }, 0, 1, UMATCH_VENDOR_PRODUCT }, +#endif { { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_ME906S }, Index: umsm.c =================================================================== RCS file: /cvs/src/sys/dev/usb/umsm.c,v retrieving revision 1.122 diff -u -p -r1.122 umsm.c --- umsm.c 23 Aug 2022 08:12:30 -0000 1.122 +++ umsm.c 31 Mar 2023 01:40:12 -0000 @@ -293,53 +293,66 @@ int umsm_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa = aux; + const struct umsm_type *umsmt; usb_interface_descriptor_t *id; uint16_t flag; if (uaa->iface == NULL) return UMATCH_NONE; + umsmt = umsm_lookup(uaa->vendor, uaa->product); + if (umsmt == NULL) + return UMATCH_NONE; + /* * Some devices (eg Huawei E220) have multiple interfaces and some * of them are of class umass. Don't claim ownership in such case. */ - if (umsm_lookup(uaa->vendor, uaa->product) != NULL) { - id = usbd_get_interface_descriptor(uaa->iface); - flag = umsm_lookup(uaa->vendor, uaa->product)->umsm_flag; - - if (id == NULL || id->bInterfaceClass == UICLASS_MASS) { - /* - * Some high-speed modems require special care. - */ - if (flag & DEV_HUAWEI) { - if (uaa->ifaceno != 2) - return UMATCH_VENDOR_IFACESUBCLASS; - else - return UMATCH_NONE; - } else if (flag & DEV_UMASS) { - return UMATCH_VENDOR_IFACESUBCLASS; - } else if (flag & DEV_TRUINSTALL) { - return UMATCH_VENDOR_IFACESUBCLASS; - } else - return UMATCH_NONE; + + id = usbd_get_interface_descriptor(uaa->iface); + flag = umsmt->umsm_flag; + + if (id == NULL || id->bInterfaceClass == UICLASS_MASS) { /* - * Some devices have interfaces which fail to attach but in - * addition seem to make the remaining interfaces unusable. Only - * attach whitelisted interfaces in this case. + * Some high-speed modems require special care. */ - } else if ((uaa->vendor == USB_VENDOR_MEDIATEK && - uaa->product == USB_PRODUCT_MEDIATEK_DC_4COM) && - !(id->bInterfaceClass == UICLASS_VENDOR && - ((id->bInterfaceSubClass == 0x02 && - id->bInterfaceProtocol == 0x01) || - (id->bInterfaceSubClass == 0x00 && - id->bInterfaceProtocol == 0x00)))) { - return UMATCH_NONE; - } else + if (flag & DEV_HUAWEI) { + if (uaa->ifaceno != 2) + return UMATCH_VENDOR_IFACESUBCLASS; + else + return UMATCH_NONE; + } else if (flag & DEV_UMASS) { return UMATCH_VENDOR_IFACESUBCLASS; + } else if (flag & DEV_TRUINSTALL) { + return UMATCH_VENDOR_IFACESUBCLASS; + } else + return UMATCH_NONE; + /* + * Some devices have interfaces which fail to attach but in + * addition seem to make the remaining interfaces unusable. Only + * attach whitelisted interfaces in this case. + */ + } else if ((uaa->vendor == USB_VENDOR_MEDIATEK && + uaa->product == USB_PRODUCT_MEDIATEK_DC_4COM) && + !(id->bInterfaceClass == UICLASS_VENDOR && + ((id->bInterfaceSubClass == 0x02 && + id->bInterfaceProtocol == 0x01) || + (id->bInterfaceSubClass == 0x00 && + id->bInterfaceProtocol == 0x00)))) { + return UMATCH_NONE; + + /* See the Quectel LTE&5G Linux USB Driver User Guide */ + } else if (uaa->vendor == USB_VENDOR_QUECTEL) { + /* Some interfaces can be used as network devices */ + if (id->bInterfaceClass != UICLASS_VENDOR) + return UMATCH_NONE; + + /* Interface 4 can be used as a network device */ + if (uaa->ifaceno >= 4) + return UMATCH_NONE; } - return UMATCH_NONE; + return UMATCH_VENDOR_IFACESUBCLASS; } void