Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
agent_fsh
Posts: 4
Joined: 14 Jan 2014, 00:59

Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-Pi

Post by agent_fsh » 14 Jan 2014, 01:41

Hi all,

I'm new to usb_modeswitch and am having some issues.

TL;DR:
It worked the first time after soft reboot, but I am now unable to switch modes.

I'm trying to connect a raspberry pi through a Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G). I installed usb_modeswitch, and ran lsusb which showed:

Code: Select all

Bus 001 Device 004: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
I then soft rebooted, and got:

Code: Select all

Bus 001 Device 006: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM
which allowed me to connect to the internet fine using wvdial.

I then edited /etc/usbmode_switch.conf with the following (retrieved from `tar -xzvf /usr/share/usb_modeswitch/configPack.tar.gz 12d1\:1446`):

Code: Select all

DisableSwitching=0
EnableLogging=1

# AT&T Modem

DefaultVendor=0x12d1
DefaultProduct=0x1446

TargetVendor=0x12d1
TargetProduct=0x1506

MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Since then, I haven't been unable to put the modem into the correct mode.

My logs (/var/log/usb_modeswitch_1-1.2\:1.0) are as follows:

Code: Select all

USB_ModeSwitch log from Thu Jan  01 00:00:06 UTC 1970

Raw args from udev: /1-1.2:1.0

Using global config file: /etc/usb_modeswitch.conf
Using top device dir /sys/bus/usb/devices/1-1.2
----------------
USB values from sysfs:
  manufacturer	Huawei Technologies
  product	HUAWEI Mobile
  serial	
----------------
bNumConfigurations is 1 - don't check for active configuration
Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz
SCSI attributes not needed, moving on
checking config: pack/12d1:1446
! matched. Reading config data
Extracting config 12d1:1446 from collection /usr/share/usb_modeswitch/configPack.tar.gz
config: TargetVendor set to 12d1
config: TargetProductList set to 1001,1406,140b,140c,1412,141b,1432,1433,1436,14ac,1506,1511
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Command to be run:
usb_modeswitch -I -W -D -s 20 -u -1 -b 1 -g 4 -v 12d1 -p 1446 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Reading long config from command line

 * 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= 0x1446
TargetVendor=   0x12d1
TargetProduct=  not set
TargetClass=    not set
TargetProductList="1001,1406,140b,140c,1412,141b,1432,1433,1436,14ac,1506,1511"

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 enabled, max. wait time 20 seconds
System integration mode enabled


Use given bus/device number: 001/004 ...
Looking for default devices ...
 bus/device number matched
  searching devices, found USB ID 12d1:1446
   found matching vendor ID
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Skipping the check for the current configuration
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
Bus/dev search active, referring success check to wrapper. Bye.

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Checking success of mode switch for max. 20 seconds ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...

Target config not matching - current values are
    1-1.2:1.0/bInterfaceClass: 08
    bConfigurationValue:       1
    bNumConfigurations:        1
    busnum:                    1
    devnum:                    4
    idProduct:                 1446
    idVendor:                  12d1
    manufacturer:              Huawei Technologies
    product:                   HUAWEI Mobile
    serial:                    

Mode switching may have failed. Exiting
After disabling automatic mode switching, and running sudo usb_modeswitch -c /etc/usb_modeswitch.conf, I get the following:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 004 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 No driver found. Either detached before or never attached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
-> Run lsusb to note any changes. Bye.
subsequent attempts yield:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 004 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 No driver found. Either detached before or never attached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
-> Run lsusb to note any changes. Bye.
Any help would be greatly appreciated!

EDIT:

Additional info from usb-devices:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1446 Rev=00.00
S:  Manufacturer=Huawei Technologies
S:  Product=HUAWEI Mobile
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
Strange that Driver is none...

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

Re: Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-

Post by Josh » 15 Jan 2014, 20:09

agent_fsh wrote:I then edited /etc/usbmode_switch.conf with the following:
Don't use the global config file for device configuration data!
It will be ignored.

Furthermore, the configuration is O.K., you don't need to edit anything. You'd rather want to find out why the mode switching works during a reboot but not directly when plugging. (I hope I understood that correctly.)

There are at least two possible sources for trouble: insufficient power on the USB port or a problem/conflict with the storage driver, probably timing-related.

Try again without tampering with any files, with logging enabled. But before plugging the modem, run this:

Code: Select all

# modprobe usbstorage
# echo 5 >/sys/module/usb_storage/parameters/delay_use

agent_fsh
Posts: 4
Joined: 14 Jan 2014, 00:59

Re: Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-

Post by agent_fsh » 16 Jan 2014, 08:36

Hi Josh,

Thanks for getting back to me.

I first ran:

Code: Select all

sudo apt-get install usb-modeswitch ppp wvdial
, and after a

Code: Select all

sudo reboot
, the output of lsusb was

Code: Select all

Bus 001 Device 006: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
(it worked!)

The logs generated were as follows:

Code: Select all

pi@raspberrypi /var/log $ ls us*
usb_modeswitch_ttyUSB0  usb_modeswitch_ttyUSB1  usb_modeswitch_ttyUSB2  user.log                user.log.1              user.log.2.gz           user.log.3.gz
pi@raspberrypi /var/log $ cat usb_modeswitch_ttyUSB0


USB_ModeSwitch log from Thu Jan  01 00:00:07 UTC 1970

usb_modeswitch called with --symlink-name
 parameter: /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/ttyUSB0/tty/ttyUSB0

My name is ttyUSB0

Checking my endpoints ...
 in /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0
  checking ep_01 ...
  checking ep_81 ...
  ep_81 has interrupt transfer type

--> I am an interrupt port

--> No interrupt interface below me

Return symlink name "gsmmodem" and exit
pi@raspberrypi /var/log $ cat usb_modeswitch_ttyUSB1


USB_ModeSwitch log from Thu Jan  01 00:00:07 UTC 1970

usb_modeswitch called with --symlink-name
 parameter: /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.1/ttyUSB1/tty/ttyUSB1

My name is ttyUSB1

Checking my endpoints ...
 in /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.1
  checking ep_02 ...
  checking ep_83 ...

--> I am not an interrupt port

Return empty name and exit
pi@raspberrypi /var/log $ cat usb_modeswitch_ttyUSB2


USB_ModeSwitch log from Thu Jan  01 00:00:07 UTC 1970

usb_modeswitch called with --symlink-name
 parameter: /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.2/ttyUSB2/tty/ttyUSB2

My name is ttyUSB2

Checking my endpoints ...
 in /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.2
  checking ep_03 ...
  checking ep_84 ...

--> I am not an interrupt port

Return empty name and exit
Anyway. To get back to your requests, when I run:

Code: Select all

pi@raspberrypi ~ $ sudo modprobe usbstorage
FATAL: Module usbstorage not found.
Unfortunately my raspberry pi reboots when you plug something new in over USB (power surge), so I'll need to grab a powered hub before I can test the results from hot-plugging. After rebooting I get the same result.

WRT not editing the global config - how should I best get it to autostart in modem mode?

EDIT: Adding additional log output for:

Code: Select all

pi@raspberrypi ~ $ cat /var/log/usb_modeswitch_1-1.2\:1.0 


USB_ModeSwitch log from Thu Jan  01 00:00:07 UTC 1970

Raw args from udev: /1-1.2:1.0

Using global config file: /etc/usb_modeswitch.conf
Using top device dir /sys/bus/usb/devices/1-1.2
----------------
USB values from sysfs:
  manufacturer	Huawei Technologies
  product	HUAWEI Mobile
  serial	
----------------
bNumConfigurations is 1 - don't check for active configuration
Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz
SCSI attributes not needed, moving on
checking config: pack/12d1:1446
! matched. Reading config data
Extracting config 12d1:1446 from collection /usr/share/usb_modeswitch/configPack.tar.gz
config: TargetVendor set to 12d1
config: TargetProductList set to 1001,1406,140b,140c,1412,141b,1432,1433,1436,14ac,1506,1511
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Command to be run:
usb_modeswitch -I -W -D -s 20 -u -1 -b 1 -g 4 -v 12d1 -p 1446 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Reading long config from command line

 * 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= 0x1446
TargetVendor=   0x12d1
TargetProduct=  not set
TargetClass=    not set
TargetProductList="1001,1406,140b,140c,1412,141b,1432,1433,1436,14ac,1506,1511"

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 enabled, max. wait time 20 seconds
System integration mode enabled


Use given bus/device number: 001/004 ...
Looking for default devices ...
 bus/device number matched
  searching devices, found USB ID 12d1:1446
   found matching vendor ID
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Skipping the check for the current configuration
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
 Device is gone, skipping any further commands
Bus/dev search active, referring success check to wrapper. Bye.

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Checking success of mode switch for max. 20 seconds ...
 Waiting for device file system (1 sec.) ...
 Waiting for device file system (2 sec.) ...
 Waiting for device file system (3 sec.) ...
 Waiting for device file system (4 sec.) ...
 Reading attributes ...
 All attributes matched
Mode switching was successful, found 12d1:1506 (Huawei Technologies: HUAWEI Mobile)
Logger is /usr/bin/logger
Now checking for bound driver ...
 driver has bound, device is known
Checking for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exiting


agent_fsh
Posts: 4
Joined: 14 Jan 2014, 00:59

Re: Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-

Post by agent_fsh » 16 Jan 2014, 20:58

usb-devices when in usb-storage mode:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1446 Rev=00.00
S:  Manufacturer=Huawei Technologies
S:  Product=HUAWEI Mobile
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
usb-devices when in Modem/Networkcard:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  6 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1506 Rev=00.00
S:  Manufacturer=Huawei Technologies
S:  Product=HUAWEI Mobile
C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=option
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=02 Driver=option
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=03 Driver=option
I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=01 Prot=09 Driver=qmi_wwan
I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=08 Driver=qmi_wwan
I:  If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

agent_fsh
Posts: 4
Joined: 14 Jan 2014, 00:59

Re: Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-

Post by agent_fsh » 16 Jan 2014, 21:28

Strangely, if I use a USB hub (to stop the Pi rebooting), hotplugging the device automatically modswitches correctly (if the Pi is on) - the problem is only noticed when cold booting the pi.

I did try increasing the usb_storage delay to 5 seconds, but it doesn't seem to help.

I thought that unbinding and binding the USB device might work, but I get access denied when trying to write to '/sys/bus/usb/drivers/usbhid/unbind' or 'bind', even when sudo.

reinosk8
Posts: 1
Joined: 26 May 2014, 06:14

Re: Huawei E1552/E1800/E173 (AT&T USBConnect Force 4G) on R-

Post by reinosk8 » 26 May 2014, 06:25

i have added a script "autostart" in the /etc/init.d route with permisions 755
the script contains the following lines:

#
sudo service udev stop
sleep 2
sudo service udev start
sleep 9
#

sudo service udev restart doesn't work properly

to activate de script u might run:
sudo update-rc.d autostart defaults

dirty solution but u can clean it with a good script (case $1, start) stop), etc)

sorry about my english, i only speak spanish

Post Reply