Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
norm.henderson
Posts: 6
Joined: 22 Jun 2011, 14:26

Huawei 12d1:1446 switches manually but not on boot / hotplug

Post by norm.henderson » 22 Jun 2011, 14:37

Hi, I have a new install of 1.1.8 usb_modeswitch and the data, on voyage linux (i.e. Debian). I had been using an older version of usb_modeswitch on this system with a different modem for the last year, and it was running fine.

The modem is a Huawei E367. I had to modify the configuration in /usr/share/usb_modeswitch/12d1:1446 as follows:
As distributed:
DefaultVendor= 0x12d1
DefaultProduct=0x1446
TargetVendor= 0x12d1
TargetProductList="1001,1406,140b,140c,1412,141b,1433,14ac,1506"
CheckSuccess=20
MessageContent="55534243123456780000000000000011062000000100000000000000000000"

What works:
...
TargetVendor= 0x12d1
TargetProduct=0x14ac
CheckSuccess=20
MessageEndpoint = 0x01
MessageContent = "55534243000000000000000000000011060000000000000000000000000000"

However: it only works manually, ie: usb_modeswitch -c /usr/share/usb_modeswitch/12d1:1446

I cannot get the Udev rule to do anything, there is no evidence that it's even trying to run (although I know nothining about Udev so...)

Suggestions?

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 22 Jun 2011, 18:02

Please enable logging as explained on the main doc page, paragraph "Troubleshooting". Try first with the unmodified configuration.

norm.henderson
Posts: 6
Joined: 22 Jun 2011, 14:26

Post by norm.henderson » 22 Jun 2011, 20:07

Thanks for the quick reply Josh, actually I set EnableLogging=1 in /etc/usb_modeswitch.conf from the start, and yet no log files have been produced. Voyage Linux is designed to run on a read-only flash drive, however /var/log is on a writable device so that's not the issue.

Here is what I got in syslog by unplugging the modem (11:56:57) and replugging it (11:57:14), and then (11:59:30) manually running usb_modeswitch -c /usr/share/usb_modeswitch/12d1:1446

Jun 22 11:56:57 voyage vmunix: [ 2079.990232] usb 2-1: USB disconnect, address 3
Jun 22 11:57:14 voyage vmunix: [ 2097.156090] usb 2-1: new high speed USB device using ehci_hcd and address 4
Jun 22 11:57:14 voyage vmunix: [ 2097.291107] usb 2-1: New USB device found, idVendor=12d1, idProduct=1446
Jun 22 11:57:14 voyage vmunix: [ 2097.291132] usb 2-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Jun 22 11:57:14 voyage vmunix: [ 2097.291152] usb 2-1: Product: HUAWEI Mobile
Jun 22 11:57:14 voyage vmunix: [ 2097.291168] usb 2-1: Manufacturer: Huawei Technologies
Jun 22 11:57:14 voyage vmunix: [ 2097.296260] usb 2-1: configuration #1 chosen from 1 choice
Jun 22 11:57:15 voyage vmunix: [ 2097.335677] usb-storage: device found at 4
Jun 22 11:57:15 voyage vmunix: [ 2097.335692] usb-storage: waiting for device to settle before scanning
Jun 22 11:57:15 voyage vmunix: [ 2097.348348] usb-storage: device found at 4
Jun 22 11:57:15 voyage vmunix: [ 2097.348363] usb-storage: waiting for device to settle before scanning
Jun 22 11:57:20 voyage vmunix: [ 2102.332766] usb-storage: device scan complete
Jun 22 11:57:20 voyage vmunix: [ 2102.354566] usb-storage: device scan complete
Jun 22 11:59:30 voyage vmunix: [ 2232.592899] usb 2-1: usbfs: process 4716 (usb_modeswitch) did not claim interface 0 before use
Jun 22 11:59:30 voyage vmunix: [ 2232.597151] usb 2-1: USB disconnect, address 4
Jun 22 11:59:34 voyage vmunix: [ 2236.628088] usb 2-1: new high speed USB device using ehci_hcd and address 5
Jun 22 11:59:34 voyage vmunix: [ 2236.763188] usb 2-1: New USB device found, idVendor=12d1, idProduct=14ac
Jun 22 11:59:34 voyage vmunix: [ 2236.763212] usb 2-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Jun 22 11:59:34 voyage vmunix: [ 2236.763232] usb 2-1: Product: HUAWEI Mobile
Jun 22 11:59:34 voyage vmunix: [ 2236.763248] usb 2-1: Manufacturer: Huawei Technologies
Jun 22 11:59:34 voyage vmunix: [ 2236.767844] usb 2-1: configuration #1 chosen from 1 choice
Jun 22 11:59:34 voyage vmunix: [ 2236.805677] usb-storage: device found at 5
Jun 22 11:59:34 voyage vmunix: [ 2236.805691] usb-storage: waiting for device to settle before scanning
Jun 22 11:59:34 voyage vmunix: [ 2236.817562] usb-storage: device found at 5
Jun 22 11:59:34 voyage vmunix: [ 2236.817577] usb-storage: waiting for device to settle before scanning
Jun 22 11:59:38 voyage vmunix: [ 2240.700077] usbcore: registered new interface driver usbserial
Jun 22 11:59:38 voyage vmunix: [ 2240.705267] usbcore: registered new interface driver usbserial_generic
Jun 22 11:59:38 voyage vmunix: [ 2240.705288] usbserial: USB Serial Driver core
Jun 22 11:59:38 voyage vmunix: [ 2240.800714] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
Jun 22 11:59:38 voyage vmunix: [ 2240.801425] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
Jun 22 11:59:38 voyage vmunix: [ 2240.801989] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
Jun 22 11:59:38 voyage vmunix: [ 2240.802662] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB3
Jun 22 11:59:38 voyage vmunix: [ 2240.803524] usbcore: registered new interface driver option
Jun 22 11:59:39 voyage vmunix: [ 2241.805282] usb-storage: device scan complete
Jun 22 11:59:39 voyage vmunix: [ 2241.820533] usb-storage: device scan complete

I'm happy to run other diagnostics if you can suggest them, with the original config file and with the one that I'm currently using.

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 23 Jun 2011, 00:21

So the real problem is that usb_modeswitch seems to never have been started automatically.

You probably need to debug the udev actions. It's not hard to enable, but udev spits out a lot of information.

You should have /etc/udev/udev.conf.

Edit and set udev_log="debug". Usually, debug output will be active immediately. If not you may have to reboot.

Now, plug your modem and see /var/log/syslog. Search for "usb_modeswitch". In case of it running there should be three entries: "RUN ...", "started" and "finished", probably some lines apart.


norm.henderson
Posts: 6
Joined: 22 Jun 2011, 14:26

Syslog output

Post by norm.henderson » 23 Jun 2011, 09:00

Hi again Josh,
I enabled debug in udev.conf, restarted udev and plugged in the modem. The results don't seem to be what you expected. Sorry for the long post, I don't see a way to upload a file to this forum and don't really know what's relevant or not, in the below.
Thanks, Norm

Jun 23 06:36:44 voyage vmunix: [ 1177.080064] usb 2-1: new high speed USB device using ehci_hcd and address 5
Jun 23 06:36:44 voyage vmunix: [ 1177.214860] usb 2-1: New USB device found, idVendor=12d1, idProduct=1446
Jun 23 06:36:44 voyage vmunix: [ 1177.214884] usb 2-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Jun 23 06:36:44 voyage vmunix: [ 1177.214904] usb 2-1: Product: HUAWEI Mobile
Jun 23 06:36:44 voyage vmunix: [ 1177.214920] usb 2-1: Manufacturer: Huawei Technologies

...

Jun 23 06:36:44 voyage udevd-event[4401]: run_program: 'usb_modeswitch '2-1:1.0/2-1:1.0''

...

Jun 23 06:38:45 voyage udevd-event[4401]: run_program: '/lib/udev/usb_modeswitch' returned with status 0
Jun 23 06:38:45 voyage udevd-event[4401]: run_program: '/sbin/modprobe --use-blacklist usb:v12D1p1446d0000dc00dsc00dp00ic08isc06ip50'
Jun 23 06:38:46 voyage udevd-event[4401]: run_program: '/sbin/modprobe' returned with status 0
Jun 23 06:38:46 voyage udevd-event[4401]: pass_env_to_socket: passed -1 bytes to socket '@/org/kernel/udev/monitor',
Jun 23 06:38:46 voyage udevd-event[4401]: udev_event_run: seq 1165 finished with 0

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 23 Jun 2011, 09:55

I have edited your post and reduced it to the relevant lines.

Now we know that the first script is actually running. The second script /usr/sbin/usb_modeswitch_dispatcher is not - or else you would get something in /var/log.

Well, at least we know how the first script is called. Now you can call it manually:

Code: Select all

sudo /lib/udev/usb_modeswitch '2-1:1.0/2-1:1.0'
If you get no error but also no changes ("lsusb"), you could start to insert "echo" lines in the script to check for progress and variable values.

BTW: did you install the Debian package or did you install from the source available here?

There is one important difference between these two regarding the little script we are looking at. If you are using the Debian version, try to replace it temporarily with the file from the source package (rename the original file to something else and copy "usb_modeswitch.sh" from the source to "/lib/udev/usb_modeswitch").


norm.henderson
Posts: 6
Joined: 22 Jun 2011, 14:26

Post by norm.henderson » 23 Jun 2011, 22:32

So I feel dumb - the problem was that tclsh wasn't installed. Apparently it wasn't needed in the old version of usb_modeswitch I was using before, I was fooled by the presence of a man page, and no explicit error was produced. Hot plug now works. I'll try a reboot in the morning but I'm expecting that will bring up the modem as well. Thanks for the help tracking it down Josh!

- Norm Henderson

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 24 Jun 2011, 00:23

Well, you learned how to debug udev - so don't feel that your effort was wasted 8)

Post Reply