Author Message

<  Setup Discussion  ~  Want to reset Huawei E3372

PostPosted: Thu Sep 28, 2017 10:44 am Reply with quote
Posts: 1 Joined: Thu Sep 28, 2017 9:34 am
Hi

It took me a while to get this to work, on one machine it did work but not on the one I needed it (Nagios server, USB used as SMS device)
Before that I tried different USB sticks (E3276-601), but none of them worked on a CentOS6.9, Xeon CPU, Server MB, Adaptec hardware server.

I have tried to stick with this USB as it presents a eth interface that can be used with an API https://github.com/knq/hilink, and this really works!

I could not work it out why it worked on one but not the other, but then I read somewhere something about the "I" switch, and that finally did it!
It probably is due to this the iscssi??

Code:
/usr/sbin/usb_modeswitch -I -v 12d1 -p 1f01 -c /etc/usb_huawei.conf -W


The file /etc/usb_huawei.conf
Code:
# huawei E3372 usb modem
# it's huawei
HuaweiNewMode=1
# this are the current settings
DefaultVendor=0x12d1
DefaultProduct=0x1f01
# this is were we want to go
TargetVendor=0x12d1
TargetProductList="158e,14db,14dc"
# this is the message we are sending
MessageContent="55534243123456780000000000000a11062000000000000100000000000000"


Now I am sometimes not at the server cabinet, but I have ssh shell access.
I tried to reset the USB modem, i.e. from 14dc BACK to 1f01, I used a variety of ways, but none works.

A shell script:
Code:
#!/bin/bash
for i in /sys/bus/pci/drivers/[uoex]hci_hcd/*:*; do
    echo "Doing it on $i"
    echo "${i##*/}" > "${i%/*}/unbind"
    echo "${i##*/}" > "${i%/*}/bind"
done


A program in C
Code:
https://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line


I have used the usb_modeswitch (2.5.1) to do this:
Code:
/usr/sbin/usb_modeswitch -R -I -v 12d1 -p 1f01 -c /etc/usb_huawei.conf -W


But this one comes up with an error message:
Code:
[root /etc] #>/src/usb-modeswitch-2.5.1/usb_modeswitch -R -I -v 12d1 -p 1f01 -c /etc/usb_huawei_back.conf
Look for target devices ...
Error: entry in product ID list has wrong length: 0x1f01. Ignored
 No devices in target mode or class found
Look for default devices ...
 Found devices in default mode (1)
Access device 003 on bus 001
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 2
Error: can't use storage command in MessageContent with interface 0; interface class is 2, expected 8. Abort


I tried different MessageContents, but to no avail.

Any ideas how can I RESET this stick so it comes back as if it would have been JUST inserted?

It seems in the moment I can only do this buy pulling it out of the USB port and sticking it back in!
Which is not ideal.

thanks
Jobst


Offline
PostPosted: Fri Sep 29, 2017 7:38 am Reply with quote
Site Admin Posts: 6420 Joined: Sat Nov 03, 2007 12:30 am
If you just want a compliant USB device reset, ignore your conf file. Also, you want to do it on the switched device, no? So you have to give the "14dc" product ID because that's the device you are targeting:
Code:
/usr/sbin/usb_modeswitch -R -v 12d1 -p 14dc -W

However, it's likely that such a device reset will not trigger a switch-back. Keep in mind that this whole mode-switching business is outside any specification.
The only known way to set modems back to the initial install mode is to cut their power for a moment. On some embedded platforms, there is supposed to be a way to tell the host driver to enable/disable USB power.

Other than that, re-plugging is the only way.


Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 1
2 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron