Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
necotheone
Posts: 7
Joined: 05 Jun 2015, 12:46

[SOLVED] Automatic switch at boot Huawei E398 - Raspberry Pi

Post by necotheone » 05 Jun 2015, 12:56

Hello all:

I have a problem with my Huawei E398:

I tried to configure the rules.d to make an automatic switch at the boot of my RPi, but it didn't work. Tried a thousand pages to do it, but nothing works...
At last, I modify the /etc/rc.local with the following lines:

Code: Select all

sudo usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1 -W -I
But I know this is NOT the appropiate solution, only a patch.

Any suggestions? I can put the code of any file you want to see.

Regards!
Last edited by necotheone on 08 Jun 2015, 12:22, edited 2 times in total.

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

Re: Automatic switch at boot

Post by Josh » 05 Jun 2015, 13:53

Please be more specific.

What distribution are you running? Is usb_modeswitch already installed as a distro package? If so, which version? Can you determine the USB host kernel driver (some variants are known to be buggy)?

necotheone
Posts: 7
Joined: 05 Jun 2015, 12:46

Re: Automatic switch at boot

Post by necotheone » 05 Jun 2015, 14:03

Josh wrote:Please be more specific.

What distribution are you running? Is usb_modeswitch already installed as a distro package? If so, which version? Can you determine the USB host kernel driver (some variants are known to be buggy)?
usb_modesitch v1.2.3 installed as a distro package.
Running Raspbian.

How can I determine the USB host kernel driver?

Being more specific, I want to connect automatically an Huawei E398 (def. vendor 12d1, def. product 1505 - Tar. vendor 12d1, tar. product 1506) and start wvdial also automatically (I did it editing the /etc/network/interfaces) because I want to make an external service provided by the RPi.

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

Re: Automatic switch at boot

Post by Josh » 07 Jun 2015, 11:22

Is there a file named "/lib/udev/rules.d/40-usb_modeswitch.rules"?

If so, does it include a line mentioning "12d1" and "1505"?

necotheone
Posts: 7
Joined: 05 Jun 2015, 12:46

Re: Automatic switch at boot

Post by necotheone » 07 Jun 2015, 16:44

Josh wrote:Is there a file named "/lib/udev/rules.d/40-usb_modeswitch.rules"?

If so, does it include a line mentioning "12d1" and "1505"?
Yes, it has a file named like this and insideis this:

Code: Select all

# Huawei EC156, Huawei E372u-8
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1505", RUN+="usb_modeswitch '%b/%k'"

necotheone
Posts: 7
Joined: 05 Jun 2015, 12:46

Re: Automatic switch at boot

Post by necotheone » 07 Jun 2015, 16:48

One interesting point here, is that if I run the command that I posted on the first message:

Code: Select all

sudo usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1 -W -I
It shows this:

Code: Select all

Taking all parameters from the 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= 0x1505
TargetVendor=   0x12d1
TargetProduct=  0x1506
TargetClass=    not set
TargetProductList=""

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=1
ResponseEndpoint= not set

InquireDevice disabled
Success check disabled
System integration mode disabled


usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 001
usb_os_find_devices: Found 004 on 001
usb_os_find_devices: Found 003 on 001
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
Looking for target devices ...
  searching devices, found USB ID 12d1:1505
   found matching vendor ID
  searching devices, found USB ID 0424:ec00
  searching devices, found USB ID 0424:9514
  searching devices, found USB ID 1d6b:0002
 No devices in target mode or class found
Looking for default devices ...
  searching devices, found USB ID 12d1:1505
   found matching vendor ID
   found matching product ID
   adding device
  searching devices, found USB ID 0424:ec00
  searching devices, found USB ID 0424:9514
  searching devices, found USB ID 1d6b:0002
 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)

USB description data (for identification)
-------------------------
Manufacturer: Huawei Technologies
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Looking for active driver ...
USB error: could not get bound driver: No data available
 No driver found. Either detached before or never attached
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reading the response to message 1 (CSW) ...
 OK, response successfully read (0 bytes).
Resetting response endpoint 0x81
USB error: could not clear/halt ep 129: Protocol error
 Could not reset endpoint (probably harmless): -71
Resetting message endpoint 0x01
USB error: could not clear/halt ep 1: Protocol error
 Could not reset endpoint (probably harmless): -71
USB error: could not release intf 0: No such device
 Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.
As you see, it seems to be a lot of errors, but it changes the E398 tho the 12d1:1506 anyway.

necotheone
Posts: 7
Joined: 05 Jun 2015, 12:46

Re: [SOLVED] Automatic switch at boot

Post by necotheone » 08 Jun 2015, 10:08

Well, I solved this creating a file:

Code: Select all

sudo nano /etc/udev/rules.d/41-usb_modeswitch.rules
And including the following code:

Code: Select all

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1505", RUN+="usb_modeswitch '%b/%k'"
Thanks for your help.

Regards!

Post Reply