hc
2024-08-13 755336cb89d9507a85518c0bbb55ed1db039c2fa
kernel/drivers/usb/serial/option.c
....@@ -248,18 +248,31 @@
248248 #define QUECTEL_VENDOR_ID 0x2c7c
249249 /* These Quectel products use Quectel's vendor ID */
250250 #define QUECTEL_PRODUCT_EC21 0x0121
251
+#define QUECTEL_PRODUCT_EM061K_LTA 0x0123
252
+#define QUECTEL_PRODUCT_EM061K_LMS 0x0124
251253 #define QUECTEL_PRODUCT_EC25 0x0125
254
+#define QUECTEL_PRODUCT_EM060K_128 0x0128
252255 #define QUECTEL_PRODUCT_EG91 0x0191
253256 #define QUECTEL_PRODUCT_EG95 0x0195
254257 #define QUECTEL_PRODUCT_BG96 0x0296
255258 #define QUECTEL_PRODUCT_EP06 0x0306
256259 #define QUECTEL_PRODUCT_EM05G 0x030a
257260 #define QUECTEL_PRODUCT_EM060K 0x030b
261
+#define QUECTEL_PRODUCT_EM05G_CS 0x030c
262
+#define QUECTEL_PRODUCT_EM05GV2 0x030e
263
+#define QUECTEL_PRODUCT_EM05CN_SG 0x0310
258264 #define QUECTEL_PRODUCT_EM05G_SG 0x0311
265
+#define QUECTEL_PRODUCT_EM05CN 0x0312
266
+#define QUECTEL_PRODUCT_EM05G_GR 0x0313
267
+#define QUECTEL_PRODUCT_EM05G_RS 0x0314
259268 #define QUECTEL_PRODUCT_EM12 0x0512
260269 #define QUECTEL_PRODUCT_RM500Q 0x0800
261270 #define QUECTEL_PRODUCT_RM520N 0x0801
271
+#define QUECTEL_PRODUCT_EC200U 0x0901
262272 #define QUECTEL_PRODUCT_EC200S_CN 0x6002
273
+#define QUECTEL_PRODUCT_EC200A 0x6005
274
+#define QUECTEL_PRODUCT_EM061K_LWW 0x6008
275
+#define QUECTEL_PRODUCT_EM061K_LCN 0x6009
263276 #define QUECTEL_PRODUCT_EC200T 0x6026
264277 #define QUECTEL_PRODUCT_RM500K 0x7001
265278
....@@ -396,6 +409,8 @@
396409 #define LONGCHEER_VENDOR_ID 0x1c9e
397410
398411 /* 4G Systems products */
412
+/* This one was sold as the VW and Skoda "Carstick LTE" */
413
+#define FOUR_G_SYSTEMS_PRODUCT_CARSTICK_LTE 0x7605
399414 /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
400415 * It seems to contain a Qualcomm QSC6240/6290 chipset */
401416 #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
....@@ -586,6 +601,11 @@
586601 /* Sierra Wireless products */
587602 #define SIERRA_VENDOR_ID 0x1199
588603 #define SIERRA_PRODUCT_EM9191 0x90d3
604
+
605
+/* UNISOC (Spreadtrum) products */
606
+#define UNISOC_VENDOR_ID 0x1782
607
+/* TOZED LT70-C based on UNISOC SL8563 uses UNISOC's vendor ID */
608
+#define TOZED_PRODUCT_LT70C 0x4055
589609
590610 /* Device flags */
591611
....@@ -1077,6 +1097,35 @@
10771097 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
10781098 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
10791099 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
1100
+
1101
+ #if 1 //Added by Quectel
1102
+ { USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
1103
+ { USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
1104
+ { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20(MDM9215) */
1105
+ { USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC20(MDM9x07)/EC25/EG25 */
1106
+ { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
1107
+ { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
1108
+ { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
1109
+ { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
1110
+ { USB_DEVICE(0x2C7C, 0x030B) }, /* Quectel EG065K/EG060K */
1111
+ { USB_DEVICE(0x2C7C, 0x0514) }, /* Quectel BL EG060K RNDIS Only */
1112
+ { USB_DEVICE(0x2C7C, 0x0512) }, /* Quectel EG12/EP12/EM12/EG16/EG18 */
1113
+ { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
1114
+ { USB_DEVICE(0x2C7C, 0x0700) }, /* Quectel BG95/BG77/BG600L-M3/BC69 */
1115
+ { USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */
1116
+ { USB_DEVICE(0x2C7C, 0x0415) }, /* Quectel AG15 */
1117
+ { USB_DEVICE(0x2C7C, 0x0452) }, /* Quectel AG520 */
1118
+ { USB_DEVICE(0x2C7C, 0x0455) }, /* Quectel AG550 */
1119
+ { USB_DEVICE(0x2C7C, 0x0620) }, /* Quectel EG20 */
1120
+ { USB_DEVICE(0x2C7C, 0x0800) }, /* Quectel RG500/RM500/RG510/RM510 */
1121
+ { USB_DEVICE(0x2C7C, 0x0900) }, /* Quectel RG500/RM500/RG510/RM510 */
1122
+ { USB_DEVICE(0x2C7C, 0x0801) }, /* Quectel RG520/RM520/SG520 */
1123
+ { USB_DEVICE(0x2C7C, 0x6026) }, /* Quectel EC200 */
1124
+ { USB_DEVICE(0x2C7C, 0x6120) }, /* Quectel UC200 */
1125
+ { USB_DEVICE(0x2C7C, 0x6000) }, /* Quectel EC200/UC200 */
1126
+ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR, .idVendor = 0x2C7C }, /* Match All Quectel Modules */
1127
+ #endif
1128
+
10801129 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
10811130 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
10821131 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) },
....@@ -1134,6 +1183,10 @@
11341183 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x90fa),
11351184 .driver_info = RSVD(3) },
11361185 /* u-blox products */
1186
+ { USB_DEVICE(UBLOX_VENDOR_ID, 0x1311) }, /* u-blox LARA-R6 01B */
1187
+ { USB_DEVICE(UBLOX_VENDOR_ID, 0x1312), /* u-blox LARA-R6 01B (RMNET) */
1188
+ .driver_info = RSVD(4) },
1189
+ { USB_DEVICE_INTERFACE_CLASS(UBLOX_VENDOR_ID, 0x1313, 0xff) }, /* u-blox LARA-R6 01B (ECM) */
11371190 { USB_DEVICE(UBLOX_VENDOR_ID, 0x1341) }, /* u-blox LARA-L6 */
11381191 { USB_DEVICE(UBLOX_VENDOR_ID, 0x1342), /* u-blox LARA-L6 (RMNET) */
11391192 .driver_info = RSVD(4) },
....@@ -1159,13 +1212,40 @@
11591212 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
11601213 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11611214 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
1215
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05CN, 0xff),
1216
+ .driver_info = RSVD(6) | ZLP },
1217
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05CN_SG, 0xff),
1218
+ .driver_info = RSVD(6) | ZLP },
11621219 { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
1220
+ .driver_info = RSVD(6) | ZLP },
1221
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_GR, 0xff),
1222
+ .driver_info = RSVD(6) | ZLP },
1223
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05GV2, 0xff),
1224
+ .driver_info = RSVD(4) | ZLP },
1225
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_CS, 0xff),
1226
+ .driver_info = RSVD(6) | ZLP },
1227
+ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_RS, 0xff),
11631228 .driver_info = RSVD(6) | ZLP },
11641229 { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_SG, 0xff),
11651230 .driver_info = RSVD(6) | ZLP },
11661231 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
11671232 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) },
11681233 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) },
1234
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K_128, 0xff, 0xff, 0x30) },
1235
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K_128, 0xff, 0x00, 0x40) },
1236
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K_128, 0xff, 0xff, 0x40) },
1237
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LCN, 0xff, 0xff, 0x30) },
1238
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LCN, 0xff, 0x00, 0x40) },
1239
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LCN, 0xff, 0xff, 0x40) },
1240
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LMS, 0xff, 0xff, 0x30) },
1241
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LMS, 0xff, 0x00, 0x40) },
1242
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LMS, 0xff, 0xff, 0x40) },
1243
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LTA, 0xff, 0xff, 0x30) },
1244
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LTA, 0xff, 0x00, 0x40) },
1245
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LTA, 0xff, 0xff, 0x40) },
1246
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LWW, 0xff, 0xff, 0x30) },
1247
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LWW, 0xff, 0x00, 0x40) },
1248
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM061K_LWW, 0xff, 0xff, 0x40) },
11691249 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff),
11701250 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11711251 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) },
....@@ -1180,6 +1260,10 @@
11801260 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0xff, 0x30) },
11811261 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0x40) },
11821262 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0) },
1263
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0900, 0xff, 0, 0), /* RM500U-CN */
1264
+ .driver_info = ZLP },
1265
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200A, 0xff, 0, 0) },
1266
+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200U, 0xff, 0, 0) },
11831267 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) },
11841268 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
11851269 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) },
....@@ -1281,6 +1365,14 @@
12811365 .driver_info = NCTRL(0) | RSVD(1) },
12821366 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */
12831367 .driver_info = RSVD(0) },
1368
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990 (rmnet) */
1369
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1370
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1081, 0xff), /* Telit FE990 (MBIM) */
1371
+ .driver_info = NCTRL(0) | RSVD(1) },
1372
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1082, 0xff), /* Telit FE990 (RNDIS) */
1373
+ .driver_info = NCTRL(2) | RSVD(3) },
1374
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1083, 0xff), /* Telit FE990 (ECM) */
1375
+ .driver_info = NCTRL(0) | RSVD(1) },
12841376 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
12851377 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
12861378 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
....@@ -1959,6 +2051,8 @@
19592051 .driver_info = RSVD(2) },
19602052 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
19612053 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
2054
+ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_CARSTICK_LTE),
2055
+ .driver_info = RSVD(0) },
19622056 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
19632057 .driver_info = NCTRL(0) | NCTRL(1) },
19642058 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100),
....@@ -2170,6 +2264,10 @@
21702264 .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
21712265 { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0db, 0xff), /* Foxconn T99W265 MBIM */
21722266 .driver_info = RSVD(3) },
2267
+ { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0ee, 0xff), /* Foxconn T99W368 MBIM */
2268
+ .driver_info = RSVD(3) },
2269
+ { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0f0, 0xff), /* Foxconn T99W373 MBIM */
2270
+ .driver_info = RSVD(3) },
21732271 { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
21742272 .driver_info = RSVD(4) | RSVD(5) | RSVD(6) },
21752273 { USB_DEVICE(0x1782, 0x4d10) }, /* Fibocom L610 (AT mode) */
....@@ -2194,6 +2292,7 @@
21942292 { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) },
21952293 { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) },
21962294 { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) },
2295
+ { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) },
21972296 { } /* Terminating entry */
21982297 };
21992298 MODULE_DEVICE_TABLE(usb, option_ids);
....@@ -2202,7 +2301,28 @@
22022301 * recognizes separately, thus num_port=1.
22032302 */
22042303
2304
+
2305
+
2306
+#if 1 //Added by Quectel
2307
+static void cfmakeraw(struct ktermios *t)
2308
+{
2309
+ t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
2310
+ t->c_oflag &= ~OPOST;
2311
+ t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
2312
+ t->c_cflag &= ~(CSIZE|PARENB);
2313
+ t->c_cflag |= CS8;
2314
+ t->c_cc[VMIN] = 1;
2315
+ t->c_cc[VTIME] = 0;
2316
+}
2317
+
2318
+static void option_init_termios(struct tty_struct *tty)
2319
+{
2320
+ cfmakeraw(&tty->termios);
2321
+}
2322
+#endif
2323
+
22052324 static struct usb_serial_driver option_1port_device = {
2325
+ .init_termios = option_init_termios,
22062326 .driver = {
22072327 .owner = THIS_MODULE,
22082328 .name = "option1",
....@@ -2229,6 +2349,7 @@
22292349 #ifdef CONFIG_PM
22302350 .suspend = usb_wwan_suspend,
22312351 .resume = usb_wwan_resume,
2352
+ .reset_resume = usb_wwan_resume,
22322353 #endif
22332354 };
22342355
....@@ -2252,6 +2373,57 @@
22522373 struct usb_interface_descriptor *iface_desc =
22532374 &serial->interface->cur_altsetting->desc;
22542375 unsigned long device_flags = id->driver_info;
2376
+if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)
2377
+ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
2378
+ return -ENODEV;
2379
+
2380
+//Quectel EC20(MDM9215)'s interface 4 can be used as USB Network device
2381
+if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)
2382
+ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
2383
+ return -ENODEV;
2384
+
2385
+if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
2386
+ __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
2387
+ struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
2388
+ if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
2389
+ //ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
2390
+ return -ENODEV;
2391
+ }
2392
+
2393
+if ((idProduct&0xF000) == 0x0000) {
2394
+ //MDM interface 4 is QMI
2395
+ if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
2396
+ && intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
2397
+ return -ENODEV;
2398
+ }
2399
+}
2400
+#if 1 //Added by Quectel
2401
+ //Quectel UC20's interface 4 can be used as USB Network device
2402
+ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)
2403
+ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
2404
+ return -ENODEV;
2405
+
2406
+ //Quectel EC20(MDM9215)'s interface 4 can be used as USB Network device
2407
+ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)
2408
+ && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
2409
+ return -ENODEV;
2410
+
2411
+ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
2412
+ __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
2413
+ struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
2414
+ if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
2415
+ //ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
2416
+ return -ENODEV;
2417
+ }
2418
+
2419
+ if ((idProduct&0xF000) == 0x0000) {
2420
+ //MDM interface 4 is QMI
2421
+ if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
2422
+ && intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
2423
+ return -ENODEV;
2424
+ }
2425
+ }
2426
+ #endif
22552427
22562428 /* Never bind to the CD-Rom emulation interface */
22572429 if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE)