Author Message

<  Setup Discussion  ~  How to disable switching on specific supported device?

PostPosted: Fri Dec 25, 2015 4:23 am Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
Recent version of usb_modeswitch start to support huawei me909u-521 (12d1:1573), of which I have one installed on my laptop. But my me909u-521's firmware is someway special. It works fine without switching, using a cdc-ether interface to provide data communication, but after switching its cdc-ether interface is closed. So I wish to disable modeswitch on this device, without disabling usb_modeswitch globally. Is it possible?


Offline
PostPosted: Fri Dec 25, 2015 5:26 am Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
You can comment out the udev rule for this id in /lib/udev/rules.d/40-usb_modeswitch.rules (or you can delete/rename the 12d1:1573 file in /etc/usb_modeswitch.d/).

12d1:1573 is somewhat special since it exists in multiple versions, can you please post the output from lsusb -v -d 12d1:1573 here. I want to see if the problem is due to the interface layout in your card or if there is a logic flaw in the way we switch it.


Offline
PostPosted: Fri Dec 25, 2015 5:43 am Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
The output of $lsusb -vd 12d1:1573 is attached.
There is no preinstalled /etc/usb_modeswitch.d/12d1:1573 in my system, but 12d1:1573 is contained in the /usr/share/usb_modeswitch/configPack.tar.gz. Is it possible to write an /etc/usb_modeswitch.d/12d1:1573 to mask out the preinstalled config within configPack, without changing the preinstalled /lib/udev/rules.d/40-usb_modeswitch.rules?
Attachments:
12d1_1573.log [19.59 KiB]
Downloaded 285 times

Offline
PostPosted: Fri Dec 25, 2015 6:03 am Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
Thanks for the verbose lsusb listing, your device has 3 configs with cfg#1 containing serial interfaces for ppp dialup and a qmi interface, cfg#2 also containing the serial ppp interfaces + a cdc_ether network interface. cfg#3 contains cdc_mbim network interface which is against the mbim standard which specifies that mbim shall be in cfg#2.

Do you know which type of direct ethernet protocol you were using , qmi_wwan in cfg#1, cdc_ether in cfg#2, or cdc_mbim in cfg#3?
usb_modeswitch has an automatic selection of mbim if cdc_mbim driver is present in the system but that means it will select cfg#2 which is according to standard but not according to your dongles..


Offline
PostPosted: Fri Dec 25, 2015 6:48 am Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
The default config of my modem seems cfg#2, the current packaged config file (attached) has it switched to cfg#1, but without qmi_wwan driver applied, or to cfg#3 without cdc_wdm driver applied(I can only see a CDC Data interface without driver replacing the cdc-ether one), leaving only ttyUSBs usable.
A qmi interface is acceptable to me. So I want to know whether it is possible to write an /etc/usb_modeswitch.d/12d1:1573 either to prevent THE MODEM being switched (with usable cdc-ether interface), or to switch to cfg #1 with qmi_wwan driver applied, giving me a usable qmi interface.

Besides, my me909u-521 is not a dongle, but a mini pci-e form card installed inside my laptop. So I have to reboot the laptop to test the usb_modeswitch.
Attachments:
12d1_1573_cfg.txt [36 Bytes]
Downloaded 276 times

Offline
PostPosted: Fri Dec 25, 2015 7:14 am Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
Interface #3 in cfg#1 is the qmi interface and is supported in qmi_wwan by the interface attributes 255,01,17 and you should see the driver binding to the interface in your dmesg log.
You will need libqmi in order for NetworkManager to be able to talk to it.

Probably better for you to create your own 12d1:1573 file with configuration set to 2 instead of 1.
Quote:
/etc/usb_modeswitch.d - a folder for customized config files. You can put new or modified config files here; they will take precedence over the collection of configurations in /usr/share/usb_modeswitch.


Offline
PostPosted: Fri Dec 25, 2015 9:08 am Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
I wrote an /etc/usb_modeswitch.d/12d1:1573 as
Code:
# Huawei ME909u-521
Configuration=2
.

But if let udev to trigger usb_modeswitch, the cdc-ether interface disappears, and I can get the attached log.
Attachments:
usb_modeswitch_1-1.3.log [3.63 KiB]
Downloaded 274 times

Offline
PostPosted: Fri Dec 25, 2015 1:12 pm Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
It seems that if mbim-checking is enabled and usb_modeswitch_dispatcher believes the modem supports mbim, it will manage to switch the modem to the mbim config at all cost, and any device-specific config file is ignored.

Code:
if {$config(NoMBIMCheck)==0 && $usb(bNumConfigurations) > 1} {
                        Log "Device may have an MBIM configuration, check driver ..."
                        if [CheckMBIM] {
                                Log " driver for MBIM devices is available"
                                Log "Find MBIM configuration number ..."
                                if [catch {set cfgno [exec /usr/sbin/usb_modeswitch -j -Q $busParam $devParam -v $usb(idVendor) -p $usb(idProduct)]} err] {
                                        Log "Error when trying to find MBIM configuration, switch to legacy modem mode"
                                } else {
                                        set cfgno [string trim $cfgno]
                                        if {$cfgno > 0} {
                                                set config(Configuration) $cfgno
                                                set config(DriverModule) ""
                                                set flags(config) "Configuration=$cfgno"
                                        } else {
                                                Log " No MBIM configuration found, switch to legacy modem mode"
                                        }
                                }
                        } else {
                                Log " no MBIM driver found, switch to legacy modem mode"
                        }
                }


Eventually, I have no ideas but copy /lib/udev/rules.d/40-usb_modeswitch.rules to /etc/udev/rules.d/40-usb_modeswitch.rules and change the rule for 12d1:1573 to
Code:
ATTR{idVendor}=="12d1", ATTR{idProduct}=="1573", GOTO="modeswitch_rules_end"
.

Is it possible to allow mbim-checking working in a device-specific way in future version?


Offline
PostPosted: Fri Dec 25, 2015 1:51 pm Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
persmule wrote:
It seems that if usb_modeswitch_dispatcher believes the modem supports mbim, it will manage to switch the modem to the mbim config at all cost, and any device-specific config file is ignored.


That is intentional, all Huawei modems with mbim do also have an alternative mode which
is reached by a switch method (usually a switch message) from the device config file.
This switch method is used:
when there is a firmware without mbim interfaces for the same usb id.
when the system does not have the cdc_mbim drivers.

Otherwise the switch method from the device config file is ignored and usb_modeswitch will instead select the mbim configuration.
You can disable the mbim automatic in /etc/usb_modeswitch.conf and keep your override device config file instead of patching the udev rules..

@Josh
There are at least 3 different version of 12d1:1573, single cfg, dual cfg, and now tripple cfg.
I suggest that we remove it from usb_modeswitch, Huawei themselves should take care of the mess they create by reusing the usb id in a way that it it doesn't uniquely identify the hardware.


Offline
PostPosted: Fri Dec 25, 2015 2:13 pm Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
LOM wrote:
@Josh
There are at least 3 different version of 12d1:1573, single cfg, dual cfg, and now tripple cfg.
I suggest that we remove it from usb_modeswitch, Huawei themselves should take care of the mess they create by reusing the usb id in a way that it it doesn't uniquely identify the hardware.


I am happy with this, since the default config of 12d1:1573 is usually not a windoze driver disk but an operable modem. If someone do want to switch their me909, they can write their own config file for it.


Offline
PostPosted: Fri Dec 25, 2015 2:14 pm Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
Since you get the card switched into the mbim config then you must also have the mbim driver in your system.
mbim is preferred over cdc_ether because it has a known and standardized command protocol, what is your reason for wanting cdc_ether instead of that?


Offline
PostPosted: Fri Dec 25, 2015 2:22 pm Reply with quote
Posts: 7 Joined: Fri Dec 25, 2015 3:52 am
I do have cdc_mbim and qmi_wwan driver, as well as NM and MM in my system, since Debian GNU/Linux's kernel is full functional. But the cfg#1 and #3 on my me909 is actually bogus. Trying to switch to them can not give me usable mbim or qmi port, but takes away my usable cdc-ether interface, leaving me a tty-only modem.


Offline
PostPosted: Fri Dec 25, 2015 2:24 pm Reply with quote
Posts: 1261 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
persmule wrote:
LOM wrote:
@Josh
There are at least 3 different version of 12d1:1573, single cfg, dual cfg, and now tripple cfg.
I suggest that we remove it from usb_modeswitch, Huawei themselves should take care of the mess they create by reusing the usb id in a way that it it doesn't uniquely identify the hardware.


I am happy with this, since the default config of 12d1:1573 is usually not a windoze driver disk but an operable modem. If someone do want to switch their me909, they can write their own config file for it.


Well, the default config is usually config #1 but since it contains only interfaces of user defined class(255) and config #2 contains "properly specified" class interfaces then config #2 will become the default, this is decided by the usb core code.
Linux should mimic Windows as much as possible so this card should run cdc_mbim for that reason and for the reason that it is the better protocol.


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
13 posts
Users browsing this forum: No registered users and 9 guests
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum