| |
Automatic Activation, Hotplug and UDEV, Configuration
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 13 Jul 2012, 01:13
Hello,
I'm trying to switch Huawei E173s modem on a BeagleBone. My distro is customized (based on ptxdist) and I'm running on a kernel 3.1. This modem is already supported by usb_modeswitch and I can successfully switch and get the ttyUSB* nodes on my PC.
So far, I've cross-compiled usb_modeswitch and the data package without problems.
At boot, I modprobe ohci_hcd, usbserial and option.
When I plug my modem with or without udev running, I get this:
Code: Select all [ 141.570747] usb 1-1: new high speed USB device number 2 using musb-hdrc
[ 142.005054] usb 1-1: New USB device found, idVendor=12d1, idProduct=1c0b
[ 142.012104] usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 142.019591] usb 1-1: Product: HUAWEI Mobile
[ 142.023993] usb 1-1: Manufacturer: HUAWEI
[ 142.186486] Initializing USB Mass Storage driver...
[ 142.192398] scsi0 : usb-storage 1-1:1.0
[ 142.197140] scsi1 : usb-storage 1-1:1.1
[ 142.201561] usbcore: registered new interface driver usb-storage
[ 142.207867] USB Mass Storage support registered.
[ 144.652068] scsi 1:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
[ 144.660851] scsi 0:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 144.673482] sr0: scsi-1 drive
[ 144.676600] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 144.683366] sr 0:0:0:0: Attached scsi generic sg0 type 5
[ 144.690209] sd 1:0:0:0: Attached scsi generic sg1 type 0
[ 144.697916] sd 1:0:0:0: [sda] Attached SCSI removable disk
Even if I turn on logging in /etc/usb_modeswitch.conf, I can't get them on /var/log.
As I found somewhere in this forum, it seems tclsh is missing. So I tried to extract this file http://www.draisberghof.de/usb_modeswit ... static.bz2 on /usr/sbin/tclsh. Well, maybe something is still broken:
Code: Select all root@Phi:~ tclsh
invalid command name "errorInfo"
Welcome to Jim version 0.70, Copyright (c) 2005-8 Salvatore Sanfilippo
. pwd
/home
. exit
What commands must my distro have to usb_modeswitch work properly?
I'll try to cross-compile tclsh, however, if someone can already help me, thank you!
-
Josh
- Site Admin
- Posts: 6593
- Joined: 03 Nov 2007, 00:30
Post
by Josh » 13 Jul 2012, 19:46
You need the Tcl shell only if you have udev on the system (somehow I doubt that).
The easiest way for mode switching would be to just use the program directly on the command line with the config file taken from the data package: Code: Select all # usb_modeswitch -I -c <path-to-file>/12d1:1c0b
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 16 Jul 2012, 16:45
Yes it does have udev!
I tried the command line call. First, after booting, I killed udev and plugged the modem:
Code: Select all root@Phi:~ ps aux | grep udev
root 66 0.6 0.3 2020 856 ? Ss 00:41 0:00 /sbin/udevd --daemon
root 100 0.0 0.2 2016 640 ? S 00:41 0:00 /sbin/udevd --daemon
root 104 0.0 0.2 2016 616 ? S 00:41 0:00 /sbin/udevd --daemon
root 165 0.0 0.1 2120 416 ttyO0 S+ 00:42 0:00 grep udev
root@Phi:~ kill 66
root@Phi:~ ps aux | grep udev
root 167 0.0 0.1 2120 416 ttyO0 S+ 00:42 0:00 grep udev
root@Phi:~ [ 62.160748] usb 1-1: new high speed USB device number 2 using musb-hdrc
[ 62.594645] usb 1-1: New USB device found, idVendor=12d1, idProduct=1c0b
[ 62.601692] usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 62.609171] usb 1-1: Product: HUAWEI Mobile
[ 62.613565] usb 1-1: Manufacturer: HUAWEI
[ 62.776581] Initializing USB Mass Storage driver...
[ 62.782290] scsi0 : usb-storage 1-1:1.0
[ 62.787001] scsi1 : usb-storage 1-1:1.1
[ 62.791421] usbcore: registered new interface driver usb-storage
[ 62.797720] USB Mass Storage support registered.
[ 65.241348] scsi 1:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
[ 65.251397] scsi 0:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 65.262865] sr0: scsi-1 drive
[ 65.265978] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 65.272702] sr 0:0:0:0: Attached scsi generic sg0 type 5
[ 65.279716] sd 1:0:0:0: Attached scsi generic sg1 type 0
[ 65.287393] sd 1:0:0:0: [sda] Attached SCSI removable disk
root@Phi:~ lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 12d1:1c0b
Then the command:
Code: Select all root@Phi:~ usb_modeswitch -I -c /usr/share/usb_modeswitch/12d1:1c0b
No default vendor/product ID given. Aborting.
Trying passing default vendor and product ids:
Code: Select all root@Phi:~ usb_modeswitch -v 0x12d1 -p 0x1c0b -I \
>-c /usr/share/usb_modeswitch/12d1\:1c0b
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
No devices in default mode found. Nothing to do. Bye.
root@Phi:~ lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 12d1:1c0b
The config file (original file from usb-modeswitch 1.2.3):
Code: Select all # Huawei E173s
TargetVendor= 0x12d1
TargetProductList="1c05,1c07,1c08"
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Any idea?
-
Josh
- Site Admin
- Posts: 6593
- Joined: 03 Nov 2007, 00:30
Post
by Josh » 16 Jul 2012, 17:35
That is strange.
Yes, with the new config file format you have to give the default ID on the command line, but that should work.
Can you try again, this time adding the "-W" paramteter?
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 16 Jul 2012, 20:47
Hmm, I think now things make sense..
My libusb-compat is 0.1.3...
Hope it will work, thanks Josh!!! Sorry for taking your time with this basic issue!
Code: Select all root@Phi:~ usb_modeswitch -v 0x12d1 -p 0x1c0b -I \
>-W -c /usr/share/usb_modeswitch/12d1\:1c0b
Reading config file: /usr/share/usb_modeswitch/12d1:1c0b
* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.3 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x1c0b
TargetVendor= 0x12d1
TargetProduct= not set
TargetClass= not set
TargetProductList="1c05,1c07,1c08"
DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
InquireDevice disabled
Success check disabled
System integration mode disabled
libusb-compat error: usb_find_devices: couldn't initialize device 1.2 (error -5)
Looking for target devices ...
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 1d6b:0002
No devices in target mode or class found
Looking for default devices ...
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 1d6b:0002
No devices in default mode found. Nothing to do. Bye.
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 16 Jul 2012, 21:49
Well, now I'm confused... The most recent version of libusb-compat is 0.1.4, it seems the problem may not be my 0.1.3 version.
Please Josh, could you inform me which version of libusb-compat has been tested?
-
Josh
- Site Admin
- Posts: 6593
- Joined: 03 Nov 2007, 00:30
Post
by Josh » 16 Jul 2012, 22:55
There are no known errors with any libusb version ...
Error 5 (general I/O) points to a possible hardware problem.
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 16 Jul 2012, 23:35
Thanks again for your answer!
I've discovered that the node /dev/bus/usb/001/002 was missing (using strace command). This is created by udev, and I was killing it at boot to try the usb-modeswitch command without udev's interference.
Now, I commented E173s rule at /lib/udev/rules.d/40-usb_modeswitch.rules, and I keep udev running. The result is:
Code: Select all root@Phi:~ lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 12d1:1c0b
root@Phi:~ usb_modeswitch -v 0x12d1 -p 0x1c0b -I \
>-W -c /usr/share/usb_modeswitch/12d1\:1c0b
Reading config file: /usr/share/usb_modeswitch/12d1:1c0b
* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.3 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)
! [ 186.221795] usb 1-1: USB disconnect, device number 2
PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x1c0b
TargetVendor= 0x12d1
TargetProduct= not set
TargetClass= not set
TargetProductList="1c05,1c07,1c08"
DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
InquireDevice disabled
Success check disabled
System integration mode disabled
Looking for target devices ...
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 12d1:1c0b
found matching vendor ID
searching devices, found USB ID 1d6b:0002
No devices in target mode or class found
Looking for default devices ...
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 12d1:1c0b
found matching vendor ID
found matching product ID
adding device
searching devices, found USB ID 1d6b:0002
Found device in default mode, class or configuration (1)
Accessing device 002 on bus 001 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x0f (out) and 0x8f (in)
USB description data (for identification)
-------------------------
Manufacturer: HUAWEI
Product: HUAWEI Mobile
Serial No.: not provided
-------------------------
Looking for active driver ...
OK, driver found; name unknown, limitation of libusb1
OK, driver "unkown" detached
Setting up communication with interface 0
Using endpoint 0x0f for message sending ...
Trying to send message 1 to endpoint 0x0f ...
OK, message successfully sent
Resetting response endpoint 0x8f
Resetting message endpoint 0x0f
Could not reset endpoint (probably harmless): -34
Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.
root@Phi:~
root@Phi:~ lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Now, it seems the kernel isn't correctly resetting my usb port.
I had noticed this kind of behavior before, when I was trying to make an wifi dongle work.
I know that, because if I force the usb session to begin, I get the modem back:
Code: Select all root@Phi:~ echo 'F' > /proc/driver/musb_hdrc.1;
root@Phi:~ [ 251.020753] usb 1-1: new high speed USB device number 3 using musb-hdrc
[ 251.453703] usb 1-1: New USB device found, idVendor=12d1, idProduct=1c0b
[ 251.460753] usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 251.468233] usb 1-1: Product: HUAWEI Mobile
[ 251.472628] usb 1-1: Manufacturer: HUAWEI
[ 251.614038] scsi2 : usb-storage 1-1:1.0
[ 251.619249] scsi3 : usb-storage 1-1:1.1
[ 254.100372] scsi 2:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 254.109284] scsi 3:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
[ 254.124598] sr0: scsi-1 drive
[ 254.137545] sr 2:0:0:0: Attached scsi generic sg0 type 5
[ 254.149671] sd 3:0:0:0: Attached scsi generic sg1 type 0
[ 254.157531] sd 3:0:0:0: [sda] Attached SCSI removable disk
Just to help people facing the same situation, I read on BeagleBoard Groups that a guy successfully got E173 to work on a BeagleBone running Ubuntu 12.04.
Anyway, thanks again for your help Josh!
-
Josh
- Site Admin
- Posts: 6593
- Joined: 03 Nov 2007, 00:30
Post
by Josh » 17 Jul 2012, 19:04
Hmm, it's a shot in the dark, but you can try the "old" Huawei switching command instead of the "official" one. Maybe it will make the modem behave better ...
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
-
fernando.endo
- Posts: 6
- Joined: 12 Jul 2012, 22:29
- Location: firmware engineer
-
Contact:
Post
by fernando.endo » 20 Jul 2012, 16:34
Hello, to close this issue and help people facing the same problem:
I've compiled ubuntu 12.04 kernel to my beaglebone by following the instructions (it comes with option module already selected):
---
Advanced Users only: BeagleBone Kernel source, used in these demo images: https://github.com/RobertCNelson/linux- ... am33x-v3.2
git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev
git checkout origin/am33x-v3.2 -b am33x-v3.2
./build_kernel.sh
---
from http://elinux.org/BeagleBoardUbuntu
I needed to download the linux-stable kernel from kernel.org repository: http://git.kernel.org/?p=linux/kernel/g ... ;a=summary
usb-modeswitch worked fine and I got /dev/ttyUSB0 to 2. The modem answers ATZ commands and it connected to the internet using PPP!
Thanks a lot Josh!!! it was a kernel problem! I was using the kernel 3.1 from am335x-linux repository.
|
|