Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
jobst
Posts: 1
Joined: 28 Sep 2017, 09:34

Want to reset Huawei E3372

Post by jobst » 28 Sep 2017, 10:44

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: Select all

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

Code: Select all

# 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: Select all

#!/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: Select all

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: Select all

/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: Select all

[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

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

Re: Want to reset Huawei E3372

Post by Josh » 29 Sep 2017, 07:38

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: Select all

/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.

usbmodeswitchuser
Posts: 6
Joined: 09 Mar 2020, 03:36

Re: Want to reset Huawei E3372

Post by usbmodeswitchuser » 22 Feb 2021, 12:50

Even though this is an old thread, I got it as one of the first web search results.
In short, won't an unbind-sleep-bind sequence do the trick? The sequence is taken from,
for example, https://askubuntu.com/questions/1036341 ... e-terminal. The systemd
journal probably lists the bus and ports too.

https://knowledge.ni.com/KnowledgeArtic ... 000P7bZSAS looks to me an inferior
alternative for MS windows. The way I understand it, it resets the hub. Not just
the device of interest. But I only mentions it for completeness. I haven't tried it. And
there are probably better alternatives. I wasn't looking much.

as an aside, should

Code: Select all

udevadm trigger --verbose --type=subsystems --action=remove --subsystem-match=usb --attr-match="idVendor=abcd"
work as wejustll? It is taken from https://wiki.archlinux.org/index.php/Ud ... ing_events.
It doesn't work for me. I am confused about its semantics.

Post Reply