Automatic Activation, Hotplug and UDEV, Configuration
Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 09 Sep 2010, 16:57

boran, your device is definitely switched. The problem is the old kernel as you guessed right.

There is no way to use the "option" driver in your version; so the "usbserial" driver has to be used. This is not (yet) automated in usb_modeswitch. But I might add it in the future.

Do a "modprobe -v usbserial vendor=0x12d1 product=140c" and see if you get ttyUSB ports.


boran
Posts: 6
Joined: 09 Sep 2010, 16:26

Post by boran » 09 Sep 2010, 17:11

I see. But no, doesn't work that way either.

modprobe -vvv usbserial vendor=0x12d1 product=140c
ls -al /dev/ttyU*
ls: cannot access /dev/ttyU*: No such file or directory

I also tried removing modules first, just in case:
rmmod usb-storage
rmmod usb-serial
lsusb
Bus 001 Device 006: ID 12d1:140c Huawei Technologies Co., Ltd.

modprobe usbserial vendor=0x12d1 product=0x140c

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

Post by Josh » 09 Sep 2010, 17:17

O.K., please turn on logging as indicated on the doc page, paragraph "Troubleshooting".

Also, post what "dmesg" says after trying to load "usbserial" (the last 30 lines or so).

boran
Posts: 6
Joined: 09 Sep 2010, 16:26

Post by boran » 09 Sep 2010, 17:22

These would seem to be the relevant lines, one sees the cd & storage noted in previous comments.

[623445.039138] usb 1-6: USB disconnect, address 5
[623450.487024] usb 1-6: new high speed USB device using ehci_hcd and address 6
[623450.647949] usb 1-6: configuration #1 chosen from 1 choice
[623455.277605] scsi11 : SCSI emulation for USB Mass Storage devices
[623455.278199] usb-storage: device found at 6
[623455.278205] usb-storage: waiting for device to settle before scanning
[623455.278527] scsi12 : SCSI emulation for USB Mass Storage devices
[623455.278905] usb-storage: device found at 6
[623455.278912] usb-storage: waiting for device to settle before scanning
[623460.269488] usb-storage: device scan complete
[623460.271474] scsi 11:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[623460.272985] usb-storage: device scan complete
[623460.275484] scsi 12:0:0:0: Direct-Access HUAWEI MMC Storage 2.31 PQ: 0 ANSI: 2
[623460.303271] sr1: scsi-1 drive
[623460.303362] sr 11:0:0:0: Attached scsi CD-ROM sr1
[623460.303432] sr 11:0:0:0: Attached scsi generic sg3 type 5
[623460.307349] sd 12:0:0:0: [sdc] Attached SCSI removable disk
[623460.307418] sd 12:0:0:0: Attached scsi generic sg4 type 0
[713378.408478] usbcore: deregistering interface driver usb-storage

actually the only reference to usbserial goes back to the old modem two days ago:
grep serial /var/log/kern.log
Sep 8 09:42:21 kernel: [ 42.961192] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

boran
Posts: 6
Joined: 09 Sep 2010, 16:26

Post by boran » 09 Sep 2010, 17:28

I also just noticed I misunderstood the module name:

grep usb /proc/modules
usbserial 35688 2 option,airprime, Live 0xf8a11000
usbcore 146028 7 option,airprime,usbserial,libusual,uhci_hcd,ehci_hcd, Live 0xf888d000

But it won't let me unload it:

rmmod airprime
Sep 9 17:28:03 kernel: [714458.248643] usbcore: deregistering interface driver airprime
Sep 9 17:28:03 kernel: [714458.248699] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial deregistering driver airprime

rmmod usbserial
ERROR: Module usbserial is in use by option

Is 'option' a module I can remove just like that?

EDIT: I did it anyway and reloaded usbserial

modprobe -vvv usbserial vendor=0x12d1 product=140c
insmod /lib/modules/2.6.24-16-server/kernel/drivers/usb/serial/usbserial.ko vendor=0x12d1 product=140c
Sep 9 17:29:39 kernel: [714553.482267] usbcore: registered new interface driver usbserial
Sep 9 17:29:39 kernel: [714553.482298] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
Sep 9 17:29:39 kernel: [714553.482377] usbcore: registered new interface driver usbserial_generic
Sep 9 17:29:39 kernel: [714553.482382] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial Driver core

ls -al /dev/ttyUS*
ls: cannot access /dev/ttyUS*: No such file or directory

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

Post by Josh » 09 Sep 2010, 17:57

Typo:

modprobe -vvv usbserial vendor=0x12d1 product=0x140c

boran
Posts: 6
Joined: 09 Sep 2010, 16:26

Post by boran » 09 Sep 2010, 18:21

:shock:

Very nice...

modprobe -vvv usbserial vendor=0x12d1 product=0x140c

insmod /lib/modules/2.6.24-16-server/kernel/drivers/usb/serial/usbserial.ko vendor=0x12d1 product=0x140c
Sep 9 18:11:14 kernel: [717044.630794] usbcore: registered new interface driver usbserial
Sep 9 18:11:14 kernel: [717044.630826] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
Sep 9 18:11:14 kernel: [717044.630858] usbserial_generic 1-6:1.0: generic converter detected
Sep 9 18:11:14 kernel: [717044.631044] usb 1-6: generic converter now attached to ttyUSB0
Sep 9 18:11:14 kernel: [717044.631065] usbserial_generic 1-6:1.1: generic converter detected
Sep 9 18:11:14 kernel: [717044.631178] usb 1-6: generic converter now attached to ttyUSB1
Sep 9 18:11:14 kernel: [717044.631193] usbserial_generic 1-6:1.2: generic converter detected
Sep 9 18:11:14 kernel: [717044.631299] usb 1-6: generic converter now attached to ttyUSB2
Sep 9 18:11:14 kernel: [717044.631316] usbserial_generic 1-6:1.3: generic converter detected
Sep 9 18:11:14 kernel: [717044.631427] usb 1-6: generic converter now attached to ttyUSB3
Sep 9 18:11:14 kernel: [717044.631449] usbserial_generic 1-6:1.4: generic converter detected
Sep 9 18:11:14 kernel: [717044.631555] usb 1-6: generic converter now attached to ttyUSB4
Sep 9 18:11:14 kernel: [717044.631573] usbserial_generic 1-6:1.5: generic converter detected
Sep 9 18:11:14 kernel: [717044.631675] usb 1-6: generic converter now attached to ttyUSB5
Sep 9 18:11:14 kernel: [717044.631697] usbcore: registered new interface driver usbserial_generic
Sep 9 18:11:14 kernel: [717044.631704] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial Driver core

# ls -altr /dev/ttyU*
crw-rw---- 1 root dialout 188, 3 2010-09-09 18:11 /dev/ttyUSB3
crw-rw---- 1 root dialout 188, 2 2010-09-09 18:11 /dev/ttyUSB2
crw-rw---- 1 root dialout 188, 1 2010-09-09 18:11 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 0 2010-09-09 18:11 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 5 2010-09-09 18:11 /dev/ttyUSB5
crw-rw---- 1 root dialout 188, 4 2010-09-09 18:11 /dev/ttyUSB4

Fantastic. I owe you a beer etc.
Thanks.

So I should just add that line to an /etc/init.d startup file?

This means that I don't need USB_ModeSwitch, if I understand correctly. Above we are forcing the usb serial driver to connect to a usb device with the designated ID?

Now I checked a second (same Ubuntu+ hw) identical system, but where I have not yet installed USB_ModeSwitch. There I did:

rmmod airprime option usbserial
modprobe -v usbserial vendor=0x12d1 product=0x140c
insmod /lib/modules/2.6.24-16-server/kernel/drivers/usb/serial/usbserial.ko vendor=0x12d1 product=0x140c

but it did not generate any ttyUSBs, even though lsusb sees the device:
lsusb
Bus 003 Device 003: ID 12d1:140c Huawei Technologies Co., Ltd.
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

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

Post by Josh » 09 Sep 2010, 18:27

Nah, you need usb_modeswitch in any case. The ID is the same but the initial state is different. That's why the "TargetClass" parameter is important. Upon plugin, your class is "8", after switching it is "255" (or 0xff).

You can probably load usbserial with the parameters at any time (if you don't have auto-unload active). Ideally it will bind as soon as it sees the device in modem mode.
But here I'm guessing; if you want to be sure, add an udev rule to load the driver at the right moment.


boran
Posts: 6
Joined: 09 Sep 2010, 16:26

Post by boran » 10 Sep 2010, 09:28

Thanks,
so if I summarise the procedure (for others with thsi usb stick and older kernels...
------
a) Compile/install usb-modeswitch-1.1.4 according to:
http://www.draisberghof.de/usb_modeswitch/

apt-get install libusb-dev (needed for Ubuntu 8.04)
make install

B) likewise install usb-modeswitch-data
(also via 'make install')

C) Create a "12d1:140c" spec which corresponds to the ID showns by 'lsusb':
vi /etc/usb_modeswitch.d/12d1:140c
---
########################################################
# Huawei, newer modems
DefaultVendor= 0x12d1
DefaultProduct=0x140c
#TargetVendor= 0x12d1
#TargetProductList="1001,1406,140b,140c,1412,141b,14ac"
TargetClass=0xff
CheckSuccess=20
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
----

D) vi /lib/udev/rules.d/40-usb_modeswitch.rules
--- add on the line before Huawei E180 ----
# Huawei E180v [http://www.draisberghof.de/usb_modeswit ... php?p=3301]
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="140c", RUN+="usb_modeswitch '%b/%k'"
----

E) Now switch the usb mode and kick the serial driver
/usr/sbin/usb_modeswitch -c /etc/usb_modeswitch.d/12d1:140c
modprobe -v usbserial vendor=0x12d1 product=0x140c

F) these two commands could be added to /etc/rc.local to have them execute on each reboot.

Post Reply