diff options
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r-- | drivers/usb/serial/option.c | 170 |
1 files changed, 108 insertions, 62 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index fe22e90bc879..89ae1f65e1b1 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -475,31 +475,54 @@ enum option_blacklist_reason { | |||
475 | OPTION_BLACKLIST_RESERVED_IF = 2 | 475 | OPTION_BLACKLIST_RESERVED_IF = 2 |
476 | }; | 476 | }; |
477 | 477 | ||
478 | #define MAX_BL_NUM 8 | ||
478 | struct option_blacklist_info { | 479 | struct option_blacklist_info { |
479 | const u32 infolen; /* number of interface numbers on blacklist */ | 480 | /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ |
480 | const u8 *ifaceinfo; /* pointer to the array holding the numbers */ | 481 | const unsigned long sendsetup; |
481 | enum option_blacklist_reason reason; | 482 | /* bitfield of interface numbers for OPTION_BLACKLIST_RESERVED_IF */ |
483 | const unsigned long reserved; | ||
482 | }; | 484 | }; |
483 | 485 | ||
484 | static const u8 four_g_w14_no_sendsetup[] = { 0, 1 }; | ||
485 | static const struct option_blacklist_info four_g_w14_blacklist = { | 486 | static const struct option_blacklist_info four_g_w14_blacklist = { |
486 | .infolen = ARRAY_SIZE(four_g_w14_no_sendsetup), | 487 | .sendsetup = BIT(0) | BIT(1), |
487 | .ifaceinfo = four_g_w14_no_sendsetup, | ||
488 | .reason = OPTION_BLACKLIST_SENDSETUP | ||
489 | }; | 488 | }; |
490 | 489 | ||
491 | static const u8 alcatel_x200_no_sendsetup[] = { 0, 1 }; | ||
492 | static const struct option_blacklist_info alcatel_x200_blacklist = { | 490 | static const struct option_blacklist_info alcatel_x200_blacklist = { |
493 | .infolen = ARRAY_SIZE(alcatel_x200_no_sendsetup), | 491 | .sendsetup = BIT(0) | BIT(1), |
494 | .ifaceinfo = alcatel_x200_no_sendsetup, | 492 | }; |
495 | .reason = OPTION_BLACKLIST_SENDSETUP | 493 | |
494 | static const struct option_blacklist_info zte_0037_blacklist = { | ||
495 | .sendsetup = BIT(0) | BIT(1), | ||
496 | }; | 496 | }; |
497 | 497 | ||
498 | static const u8 zte_k3765_z_no_sendsetup[] = { 0, 1, 2 }; | ||
499 | static const struct option_blacklist_info zte_k3765_z_blacklist = { | 498 | static const struct option_blacklist_info zte_k3765_z_blacklist = { |
500 | .infolen = ARRAY_SIZE(zte_k3765_z_no_sendsetup), | 499 | .sendsetup = BIT(0) | BIT(1) | BIT(2), |
501 | .ifaceinfo = zte_k3765_z_no_sendsetup, | 500 | .reserved = BIT(4), |
502 | .reason = OPTION_BLACKLIST_SENDSETUP | 501 | }; |
502 | |||
503 | static const struct option_blacklist_info huawei_cdc12_blacklist = { | ||
504 | .reserved = BIT(1) | BIT(2), | ||
505 | }; | ||
506 | |||
507 | static const struct option_blacklist_info net_intf1_blacklist = { | ||
508 | .reserved = BIT(1), | ||
509 | }; | ||
510 | |||
511 | static const struct option_blacklist_info net_intf3_blacklist = { | ||
512 | .reserved = BIT(3), | ||
513 | }; | ||
514 | |||
515 | static const struct option_blacklist_info net_intf4_blacklist = { | ||
516 | .reserved = BIT(4), | ||
517 | }; | ||
518 | |||
519 | static const struct option_blacklist_info net_intf5_blacklist = { | ||
520 | .reserved = BIT(5), | ||
521 | }; | ||
522 | |||
523 | static const struct option_blacklist_info zte_mf626_blacklist = { | ||
524 | .sendsetup = BIT(0) | BIT(1), | ||
525 | .reserved = BIT(4), | ||
503 | }; | 526 | }; |
504 | 527 | ||
505 | static const struct usb_device_id option_ids[] = { | 528 | static const struct usb_device_id option_ids[] = { |
@@ -599,12 +622,15 @@ static const struct usb_device_id option_ids[] = { | |||
599 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, | 622 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) }, |
600 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, | 623 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) }, |
601 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, | 624 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) }, |
602 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, | 625 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), |
603 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, | 626 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
627 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), | ||
628 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | ||
604 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, | 629 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
605 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, | 630 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, |
606 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) }, | 631 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) }, |
607 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff) }, | 632 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), |
633 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | ||
608 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, | 634 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, |
609 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, | 635 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, |
610 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, | 636 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, |
@@ -705,7 +731,8 @@ static const struct usb_device_id option_ids[] = { | |||
705 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, | 731 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
706 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, | 732 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, |
707 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ | 733 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
708 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff) }, | 734 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
735 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
709 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0003, 0xff, 0xff, 0xff) }, | 736 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0003, 0xff, 0xff, 0xff) }, |
710 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0004, 0xff, 0xff, 0xff) }, | 737 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0004, 0xff, 0xff, 0xff) }, |
711 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0005, 0xff, 0xff, 0xff) }, | 738 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0005, 0xff, 0xff, 0xff) }, |
@@ -720,51 +747,62 @@ static const struct usb_device_id option_ids[] = { | |||
720 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x000f, 0xff, 0xff, 0xff) }, | 747 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x000f, 0xff, 0xff, 0xff) }, |
721 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0010, 0xff, 0xff, 0xff) }, | 748 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0010, 0xff, 0xff, 0xff) }, |
722 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, | 749 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, |
723 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, | 750 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff), |
751 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
724 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, | 752 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, |
725 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, | 753 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, |
726 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, | 754 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, |
727 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, | 755 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, |
728 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) }, | 756 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff), |
757 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
729 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) }, | 758 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) }, |
730 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff) }, | 759 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff) }, |
731 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) }, | 760 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) }, |
732 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff) }, | 761 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff), |
762 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
733 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0022, 0xff, 0xff, 0xff) }, | 763 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0022, 0xff, 0xff, 0xff) }, |
734 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, | 764 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, |
735 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, | 765 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, |
736 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, | 766 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff), |
767 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
737 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */ | 768 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */ |
738 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, | 769 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, |
739 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, | 770 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, |
740 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, | 771 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, |
741 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, | 772 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, |
742 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&four_g_w14_blacklist }, | 773 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_mf626_blacklist }, |
743 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, | 774 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, |
744 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, | 775 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, |
745 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) }, | 776 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) }, |
746 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, | 777 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff), |
778 | .driver_info = (kernel_ulong_t)&zte_0037_blacklist }, | ||
747 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) }, | 779 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) }, |
748 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, | 780 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, |
749 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) }, | 781 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) }, |
750 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, | 782 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff), |
783 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
751 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, | 784 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, |
752 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) }, | 785 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) }, |
753 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, | 786 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, |
754 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, | 787 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff), |
788 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
755 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) }, | 789 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) }, |
756 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, | 790 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, |
757 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, | 791 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff), |
792 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
758 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */ | 793 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */ |
759 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, | 794 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, |
760 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, | 795 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff), |
796 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
761 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) }, | 797 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) }, |
762 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, | 798 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, |
763 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, | 799 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff), |
800 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
764 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, | 801 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, |
765 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, | 802 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, |
766 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, | 803 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, |
767 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, | 804 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff), |
805 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
768 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, | 806 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, |
769 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) }, | 807 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) }, |
770 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, | 808 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, |
@@ -779,11 +817,13 @@ static const struct usb_device_id option_ids[] = { | |||
779 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, | 817 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, |
780 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, | 818 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, |
781 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, | 819 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, |
782 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, | 820 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff), |
821 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
783 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, | 822 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, |
784 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, | 823 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, |
785 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, | 824 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, |
786 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) }, | 825 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff), |
826 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
787 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) }, | 827 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) }, |
788 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) }, | 828 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) }, |
789 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) }, | 829 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) }, |
@@ -1214,10 +1254,35 @@ static void __exit option_exit(void) | |||
1214 | module_init(option_init); | 1254 | module_init(option_init); |
1215 | module_exit(option_exit); | 1255 | module_exit(option_exit); |
1216 | 1256 | ||
1257 | static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | ||
1258 | const struct option_blacklist_info *blacklist) | ||
1259 | { | ||
1260 | unsigned long num; | ||
1261 | const unsigned long *intf_list; | ||
1262 | |||
1263 | if (blacklist) { | ||
1264 | if (reason == OPTION_BLACKLIST_SENDSETUP) | ||
1265 | intf_list = &blacklist->sendsetup; | ||
1266 | else if (reason == OPTION_BLACKLIST_RESERVED_IF) | ||
1267 | intf_list = &blacklist->reserved; | ||
1268 | else { | ||
1269 | BUG_ON(reason); | ||
1270 | return false; | ||
1271 | } | ||
1272 | |||
1273 | for_each_set_bit(num, intf_list, MAX_BL_NUM + 1) { | ||
1274 | if (num == ifnum) | ||
1275 | return true; | ||
1276 | } | ||
1277 | } | ||
1278 | return false; | ||
1279 | } | ||
1280 | |||
1217 | static int option_probe(struct usb_serial *serial, | 1281 | static int option_probe(struct usb_serial *serial, |
1218 | const struct usb_device_id *id) | 1282 | const struct usb_device_id *id) |
1219 | { | 1283 | { |
1220 | struct usb_wwan_intf_private *data; | 1284 | struct usb_wwan_intf_private *data; |
1285 | |||
1221 | /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ | 1286 | /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ |
1222 | if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && | 1287 | if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && |
1223 | serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && | 1288 | serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && |
@@ -1230,14 +1295,14 @@ static int option_probe(struct usb_serial *serial, | |||
1230 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) | 1295 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) |
1231 | return -ENODEV; | 1296 | return -ENODEV; |
1232 | 1297 | ||
1233 | /* Don't bind network interfaces on Huawei K3765, K4505 & K4605 */ | 1298 | /* Don't bind reserved interfaces (like network ones) which often have |
1234 | if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID && | 1299 | * the same class/subclass/protocol as the serial interfaces. Look at |
1235 | (serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K3765 || | 1300 | * the Windows driver .INF files for reserved interface numbers. |
1236 | serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4505 || | 1301 | */ |
1237 | serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4605) && | 1302 | if (is_blacklisted( |
1238 | (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1 || | 1303 | serial->interface->cur_altsetting->desc.bInterfaceNumber, |
1239 | serial->interface->cur_altsetting->desc.bInterfaceNumber == 2)) | 1304 | OPTION_BLACKLIST_RESERVED_IF, |
1240 | return -ENODEV; | 1305 | (const struct option_blacklist_info *) id->driver_info)) |
1241 | 1306 | ||
1242 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ | 1307 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ |
1243 | if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && | 1308 | if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && |
@@ -1246,7 +1311,6 @@ static int option_probe(struct usb_serial *serial, | |||
1246 | return -ENODEV; | 1311 | return -ENODEV; |
1247 | 1312 | ||
1248 | data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1313 | data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
1249 | |||
1250 | if (!data) | 1314 | if (!data) |
1251 | return -ENOMEM; | 1315 | return -ENOMEM; |
1252 | data->send_setup = option_send_setup; | 1316 | data->send_setup = option_send_setup; |
@@ -1255,23 +1319,6 @@ static int option_probe(struct usb_serial *serial, | |||
1255 | return 0; | 1319 | return 0; |
1256 | } | 1320 | } |
1257 | 1321 | ||
1258 | static enum option_blacklist_reason is_blacklisted(const u8 ifnum, | ||
1259 | const struct option_blacklist_info *blacklist) | ||
1260 | { | ||
1261 | const u8 *info; | ||
1262 | int i; | ||
1263 | |||
1264 | if (blacklist) { | ||
1265 | info = blacklist->ifaceinfo; | ||
1266 | |||
1267 | for (i = 0; i < blacklist->infolen; i++) { | ||
1268 | if (info[i] == ifnum) | ||
1269 | return blacklist->reason; | ||
1270 | } | ||
1271 | } | ||
1272 | return OPTION_BLACKLIST_NONE; | ||
1273 | } | ||
1274 | |||
1275 | static void option_instat_callback(struct urb *urb) | 1322 | static void option_instat_callback(struct urb *urb) |
1276 | { | 1323 | { |
1277 | int err; | 1324 | int err; |
@@ -1343,9 +1390,8 @@ static int option_send_setup(struct usb_serial_port *port) | |||
1343 | int val = 0; | 1390 | int val = 0; |
1344 | dbg("%s", __func__); | 1391 | dbg("%s", __func__); |
1345 | 1392 | ||
1346 | if (is_blacklisted(ifNum, | 1393 | if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP, |
1347 | (struct option_blacklist_info *) intfdata->private) | 1394 | (struct option_blacklist_info *) intfdata->private)) { |
1348 | == OPTION_BLACKLIST_SENDSETUP) { | ||
1349 | dbg("No send_setup on blacklisted interface #%d\n", ifNum); | 1395 | dbg("No send_setup on blacklisted interface #%d\n", ifNum); |
1350 | return -EIO; | 1396 | return -EIO; |
1351 | } | 1397 | } |