Author Message

<  New Ideas  ~  Switching MBIM devices

PostPosted: Wed Sep 12, 2012 10:00 pm Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
Up to now I did the rule matching based on interfaces because of the rules to check the class of the first interface, refusing all but storage class devices.

Now I have changed the rule file to match only the 'top' devices; I moved the interface check to the wrapper.

The "add" event seems to be working for hot-plugging; I have yet to test the boot behaviour though.

Again, no multi-config device to test with.
Can you check if a configuration change via "echo" will trigger the usb_modeswitch rules?

Here are the files:
http://www.draisberghof.de/usb_modeswit ... a2.tar.bz2
http://www.draisberghof.de/usb_modeswit ... 1x.tar.bz2

(The changes in the data package are limited to the rules file and the 12d1:1446 config.)


Offline Profile
PostPosted: Thu Sep 13, 2012 11:11 am Reply with quote
Posts: 165Location: Oslo, NorwayJoined: Thu Mar 15, 2012 10:47 pm
Josh wrote:
Up to now I did the rule matching based on interfaces because of the rules to check the class of the first interface, refusing all but storage class devices.

Now I have changed the rule file to match only the 'top' devices; I moved the interface check to the wrapper.

The "add" event seems to be working for hot-plugging; I have yet to test the boot behaviour though.

Again, no multi-config device to test with.
Can you check if a configuration change via "echo" will trigger the usb_modeswitch rules?

Here are the files:
http://www.draisberghof.de/usb_modeswit ... a2.tar.bz2
http://www.draisberghof.de/usb_modeswit ... 1x.tar.bz2

(The changes in the data package are limited to the rules file and the 12d1:1446 config.)


Nice. This works as expected, switching to configuration #2 if I set CheckMBIM, but still allowing me to manually switch the configuration back to 1.

I will use it for a while and let you know if there are any unexpected side effects.

One issue that has come up is that the MBIM support might be integrated into the existing cdc_ncm driver instead of getting its own driver. MBIM was previously known as NCM 2.0, and the differences seen by the driver are minor. The MBIM spec also defines a NCM compat mode where the control interface will have both NCM and MBIM altsettings. This may make it more difficult to detect kernel MBIM support. But anything is possible. You could maybe base the detection on the MBIM subclass modalias?

Code:
bjorn@nemi:/tmp$ modinfo  /usr/local/src/git/linux/drivers/net/usb/cdc_ncm.ko|grep ic02isc0E
alias:          usb:v*p*d*dc*dsc*dp*ic02isc0Eip00in*



Bjørn


Offline Profile
PostPosted: Thu Sep 13, 2012 8:13 pm Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
bmork wrote:
One issue that has come up is that the MBIM support might be integrated into the existing cdc_ncm driver instead of getting its own driver. MBIM was previously known as NCM 2.0, and the differences seen by the driver are minor. The MBIM spec also defines a NCM compat mode where the control interface will have both NCM and MBIM altsettings. This may make it more difficult to detect kernel MBIM support. But anything is possible. You could maybe base the detection on the MBIM subclass modalias?

I'm sure that won't be hard to handle. The most straightforward way for me would be a unique sysfs attribute (after loading the driver), but I could check the module directly as you say - or i could have a look at the "modules.usbmap" file.

A short question about a different issue: do you know of any qmi_wwan backport yet?

I just got myself a E398 and am playing around with it. The "linux-next" compilation is running right now, but I'm not sure if I can use that kernel on my home-grown router.


Offline Profile
PostPosted: Thu Sep 13, 2012 10:21 pm Reply with quote
Posts: 165Location: Oslo, NorwayJoined: Thu Mar 15, 2012 10:47 pm
Josh wrote:
bmork wrote:
One issue that has come up is that the MBIM support might be integrated into the existing cdc_ncm driver instead of getting its own driver. MBIM was previously known as NCM 2.0, and the differences seen by the driver are minor. The MBIM spec also defines a NCM compat mode where the control interface will have both NCM and MBIM altsettings. This may make it more difficult to detect kernel MBIM support. But anything is possible. You could maybe base the detection on the MBIM subclass modalias?

I'm sure that won't be hard to handle. The most straightforward way for me would be a unique sysfs attribute (after loading the driver), but I could check the module directly as you say - or i could have a look at the "modules.usbmap" file.


Good. Then we don't have to worry about that.

Quote:
A short question about a different issue: do you know of any qmi_wwan backport yet?


I did backport an earlier version to 3.2:
http://bugs.debian.org/670241

but that is incomplete now, given the number of critical fixes since then.

It should be fairly easy to "backport" the newest releases by just copying qmi_wwan.c, cdc_wdm.c and cdc_wdm.h and fixing a few minor issues. The biggest problem will be the missing interface number matching, but if you can build the whole kernel (or at least the usb-core) then that should be fixable by cherry-picking
Code:
 commit 81df2d59 USB: allow match on bInterfaceNumber


Quote:
I just got myself a E398 and am playing around with it. The "linux-next" compilation is running right now, but I'm not sure if I can use that kernel on my home-grown router.


3.6 should be in pretty good shape when it's out.


Offline Profile
PostPosted: Sat Sep 15, 2012 9:04 am Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
Worked like a charm.

My router did not balk on kernel 3.5.3, and I used the three files from "next" together with that single patch - hardly a veritable backport, but now I have the latest version ...

Many thanks for all your work on this !

I have followed the 'genesis' of the qmi driver with great interest (on 'linux-usb').


Offline Profile
PostPosted: Tue Oct 23, 2012 10:17 am Reply with quote
Posts: 165Location: Oslo, NorwayJoined: Thu Mar 15, 2012 10:47 pm
Just an update on the MBIM driver status now that it seems to stabilize. The initial version was just accepted into net-next, which means that it should show up in Linux v3.8. After a bit back and forth, the end result was that a new cdc_mbim driver was created as a separate module. So detecting the driver presence will be a simple matter of looking for cdc_mbim.ko:
Code:
bjorn@nemi:/var/tmp$ modinfo /lib/modules/3.7.0-rc1+/kernel/drivers/net/usb/cdc_mbim.ko
filename:       /lib/modules/3.7.0-rc1+/kernel/drivers/net/usb/cdc_mbim.ko
license:        GPL
description:    USB CDC MBIM host driver
author:         Bjørn Mork <bjorn@mork.no>
author:         Greg Suarez <gsuarez@smithmicro.com>
alias:          usb:v*p*d*dc*dsc*dp*ic02isc0Eip00in*
alias:          usb:v*p*d*dc*dsc*dp*ic02isc0Dip00in*
depends:        usbnet,usbcore,cdc-wdm,cdc_ncm
intree:         Y
vermagic:       3.7.0-rc1+ SMP mod_unload modversions


(Note that the NCM alias is included to catch MBIM devices implementing a NCM compatibility mode - probing will decide whether the device is MBIM or NCM)

I have been using the usb_modeswitch patch you posted previously for all my testing so far, and it works perfectly with the single MBIM device I've got. The driver path should of course be updated. But as far as I can see, the solution is ready for release. Including it in a release before Linux v3.8 (guesstimate: February 2013) is probably a good idea if that fits into your release plans.


Bjørn


Offline Profile
PostPosted: Sun Oct 28, 2012 12:59 am Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
Thanks for the update.

One more question though: is there a path or a specific system attribute in the sysfs tree that can be checked in case the driver is already loaded or compiled into the kernel?


Offline Profile
PostPosted: Sun Oct 28, 2012 1:19 am Reply with quote
Posts: 165Location: Oslo, NorwayJoined: Thu Mar 15, 2012 10:47 pm
Josh wrote:
Thanks for the update.

One more question though: is there a path or a specific system attribute in the sysfs tree that can be checked in case the driver is already loaded or compiled into the kernel?


Good question. The best place to check is probably
/sys/bus/usb/drivers/cdc_mbim


Bjørn


Offline Profile
PostPosted: Sun Oct 28, 2012 9:23 am Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
That will do.

I'm beginning to prepare the next release which will incorporate the changes.


Offline Profile
PostPosted: Fri Nov 09, 2012 12:56 am Reply with quote
Site AdminPosts: 6362Joined: Sat Nov 03, 2007 12:30 am
I've sent you a link to a 'preview' of the new release. Maybe you'll find some time to test it ...


Offline Profile

Display posts from previous:  Sort by:

All times are UTC + 1 hour [ DST ]
Page 2 of 2
25 posts
Go to page Previous  1, 2
Users browsing this forum: No registered users and 1 guest
Search for:
Post new topic  Reply to topic
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