Switching MBIM devices
Posted: 06 Sep 2012, 17:51
Hello, I need some ideas on how to handle new CDC MBIM devices intended for Windows 8. These will typically present 2 or more configurations in the unswitched mode, where the first configuration will be a "Windows 7 compatibility" mode similar to what we are used to: A single mass storage device with a driver CD and some magic command to morph the device into another mode with a number of serial and NDIS interfaces.
When we get CDC MBIM driver support in the kernel we may want to start not switching modes, but instead just set some configuration > 1. I see that usb_modeswitch already has support for setting a non default configuration, but the problem is that this will happen after switching.
And we must expect vendors recycling the device IDs, so we need to support selecting mode switching or configuration switching based on the available configurations.
I just got this sample:
As you can see, this matches existing usb_modeswitch data for 12d1:1446. And that needs to stay to support all older devices. But this one we'd like to have unswitched and set to configuration #2 so that we can use the MBIM function.
How should we do that? I don't think we want to add any new policy to the kernel. Could we make a generic udev rule overriding usb_modeswitch and choosing the MBIM configurations instead, maybe?
When we get CDC MBIM driver support in the kernel we may want to start not switching modes, but instead just set some configuration > 1. I see that usb_modeswitch already has support for setting a non default configuration, but the problem is that this will happen after switching.
And we must expect vendors recycling the device IDs, so we need to support selecting mode switching or configuration switching based on the available configurations.
I just got this sample:
Code: Select all
Bus 002 Device 038: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x12d1 Huawei Technologies Co., Ltd.
idProduct 0x1446 E1552/E1800/E173 (HSPA modem)
bcdDevice 0.00
iManufacturer 4 Huawei Technologies
iProduct 3 HUAWEI MBIM Device
iSerial 5 <FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF><FF>
bNumConfigurations 2
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 1 Huawei Configuration
bmAttributes 0xc0
Self Powered
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 87
bNumInterfaces 2
bConfigurationValue 2
iConfiguration 2 Huawei Configuration
bmAttributes 0xc0
Self Powered
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 14
bFunctionProtocol 0
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 14
bInterfaceProtocol 0
iInterface 0
CDC Header:
bcdCDC 1.10
CDC MBIM:
bcdMBIMVersion 1.00
wMaxControlMessage 1536
bNumberFilters 16
bMaxFilterSize 40
wMaxSegmentSize 4096
bmNetworkCapabilities 0x20
8-byte ntb input size
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 2
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 2
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 32
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 32
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 2
Device Status: 0x0000
(Bus Powered)
As you can see, this matches existing usb_modeswitch data for 12d1:1446. And that needs to stay to support all older devices. But this one we'd like to have unswitched and set to configuration #2 so that we can use the MBIM function.
How should we do that? I don't think we want to add any new policy to the kernel. Could we make a generic udev rule overriding usb_modeswitch and choosing the MBIM configurations instead, maybe?