1)修改 drivers/usb/serial/option.c
在
static const struct usb_device_id option_ids[] = { ... { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0199, 0xff, 0xff, 0xff), /* ZTE MF820S */ ... { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ ... { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
这个数组里添加 ID
static const struct option_blacklist_info net_intf4_blacklist = { .reserved = BIT(4), };
第4个功能处于黑名单
在
static int option_probe(struct usb_serial *serial, const struct usb_device_id *id) .... /* * Don't bind reserved interfaces (like network ones) which often have * the same class/subclass/protocol as the serial interfaces. Look at * the Windows driver .INF files for reserved interface numbers. */ blacklist = (void *)id->driver_info; if (blacklist && test_bit(iface_desc->bInterfaceNumber, &blacklist->reserved)) return -ENODEV; ....
过滤黑名单,某些功能设备不是串口,是网口
2. 修改 drivers/net/usb/qmi_wwan.c
static const struct usb_device_id products[] = { ... {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ ... {QMI_FIXED_INTF(0x05c6, 0x9000, 4) ... {QMI_FIXED_INTF(0x05c6, 0x9003, 4)}, /* 上海移软 */
相关驱动
USB Host Driver for Network Control Model (NCM) drivers/net/usb/cdc_ncm.c (cdc_mbim, huawei_cdc_ncm 都以它为基础)
USB CDC EEM network interface driver drivers/net/usb/cdc_eem.c
* This driver is an implementation of the CDC “Ethernet Emulation
* Model” (EEM) specification, which encapsulates Ethernet frames
* for transport over USB using a simpler USB device model than the
* previous CDC “Ethernet Control Model” (ECM, or “CDC Ethernet”).
*
* For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf
CDC Ethernet based networking peripherals cdc_ether.c (rndis)
qmi_wwan.c The probing code is heavily inspired by cdc_ether
This driver supports wwan (3G/LTE/?) devices using a vendor
* specific management protocol called Qualcomm MSM Interface (QMI) –
* in addition to the more common AT commands over serial interface
* management
*
* QMI is wrapped in CDC, using CDC encapsulated commands on the
* control (“master”) interface of a two-interface CDC Union
* resembling standard CDC ECM. The devices do not use the control
* interface for any other CDC messages. Most likely because the
* management protocol is used in place of the standard CDC
* notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
*
* Alternatively, control and data functions can be combined in a
* single USB interface.
*
* Handling a protocol like QMI is out of the scope for any driver.
* It is exported as a character device using the cdc-wdm driver as
* a subdriver, enabling userspace applications (“modem managers”) to
* handle it.