Author Message

<  Setup Discussion  ~  Automatic usb_modeswitch sometimes works - sometimes doesn't

PostPosted: Fri Jul 28, 2017 6:43 am Reply with quote
Posts: 1 Joined: Fri Jul 28, 2017 5:49 am
Hi,

as the topic states I've the strange problem that usb_modeswitch behaves unpredictable.

I've an Alcatel X602D usb modem (Vendor=1bbb ProdID=022c) and an raspberry pi (with the latest Raspbian Jessie updates and Linux 4.9.35-v7+). According to Debian's usb-modeswitch-data changelog the modem is supported since version 20150115-1 (which I have installed).

Installed packages:
Code:
$ dpkg -l | grep usb-modeswitch
ii  usb-modeswitch                 2.2.0+repack0-2                  armhf        mode switching tool for controlling "flip flop" USB devices
ii  usb-modeswitch-data            20150115-1                       all          mode switching data for usb-modeswitch


Now according to dmesg and /var/log/messages usb_modeswitch sometimes kicks in and sometimes doesn't on reboots. It mostly doesn't.

As a secondary problem no log files are created, although I set it in the config file /etc/usb_modeswitch.conf. It's only content is
Quote:
DisableSwitching=0
EnableLogging=1


Most of the time I get the following output for "dmesg -T":
Quote:
[Fr Jul 28 06:04:51 2017] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[Fr Jul 28 06:04:51 2017] usb 1-1.2: New USB device found, idVendor=1bbb, idProduct=022c
[Fr Jul 28 06:04:51 2017] usb 1-1.2: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[Fr Jul 28 06:04:51 2017] usb 1-1.2: Product: HSPA+ USB Modem
[Fr Jul 28 06:04:51 2017] usb 1-1.2: Manufacturer: Spreadtrum
[Fr Jul 28 06:04:51 2017] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[Fr Jul 28 06:04:51 2017] scsi host0: usb-storage 1-1.2:1.0


"usb-devices" then says as expected:
Quote:
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2
P: Vendor=1bbb ProdID=022c Rev=00.00
S: Manufacturer=Spreadtrum
S: Product=HSPA+ USB Modem
C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=250mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage


Only sometimes the following happens:
dmesg:
Quote:
[Fr Jul 28 04:38:24 2017] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[Fr Jul 28 04:38:24 2017] usb 1-1.2: New USB device found, idVendor=1bbb, idProduct=022c
[Fr Jul 28 04:38:24 2017] usb 1-1.2: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[Fr Jul 28 04:38:24 2017] usb 1-1.2: Product: HSPA+ USB Modem
[Fr Jul 28 04:38:24 2017] usb 1-1.2: Manufacturer: Spreadtrum
[Fr Jul 28 04:38:24 2017] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[Fr Jul 28 04:38:24 2017] scsi host0: usb-storage 1-1.2:1.0
[Fr Jul 28 04:38:24 2017] usb 1-1.2: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2


usb-devices:
Quote:
T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2
P: Vendor=1bbb ProdID=022c Rev=00.00
S: Manufacturer=Spreadtrum
S: Product=HSPA+ USB Modem
C: #Ifs= 4 Cfg#= 2 Atr=80 MxPwr=200mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)

Should look that way all the time. As the dmesg-output shows the hardware is always recognized with the correct vendor and product IDs. So it doesn't make sense that sometimes usb_modeswitch get triggered and sometimes doesn't. And even if my modeswitch-data package was too old it still should work with the configs I made.

To make sure I already tried writing my own rules in in /lib/udev/rules.d/40-usb_modeswitch.rules like
Quote:
ATTRS{idVendor}=="1bbb", ATTRS{idProduct}=="022c", RUN+="usb_modeswitch '%b/%k'"

and other variations with no effect.

I also created /etc/usb_modeswitch.d/1bbb:022c with
Quote:
#Alcatel X602D
Configuration=2

But it still doesn't work every time.
Then I tried to make init-scripts to execute usb_modeswitch this way, but I might have been to stupid for that. :roll:

I'm aware that even if usb_modeswitch works I still have to load the correct drivers via modprobe. But I'm mostly not even getting this far (also I'd like to make this an automatic task - maybe via 40-usb_modeswitch.rules? But one step at a time).

Manually executing usb_modeswitch seems to work btw. But still no logfiles and I don't know why.

Might this be a bug in this version? Seems to be a bit old. I could try later versions but the jessie repository only has this one.


Offline
PostPosted: Fri Jul 28, 2017 2:16 pm Reply with quote
Site Admin Posts: 6441 Joined: Sat Nov 03, 2007 12:30 am
This is indeed an open issue:
Code:
[Fr Jul 28 04:38:24 2017] usb 1-1.2: usbfs: interface 0 claimed by usb-storage while 'usb_modeswitch' sets config #2

I will provide a test version this weekend to work around it.

Do you get a usb_modeswitch log when you connect the modem after boot-up? (You won't get any when using usb_modeswitch on the command line, but you can enable verbose output with -W)


Offline
PostPosted: Sun Jul 30, 2017 1:59 pm Reply with quote
Site Admin Posts: 6441 Joined: Sat Nov 03, 2007 12:30 am
So here you go - check out the test version:
viewtopic.php?p=18195#p18195

If that doesn't solve your problem, we will investigate further.


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
3 posts
Users browsing this forum: No registered users and 2 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