OpenWrt Forum Archive

Topic: Huawei KS4511 disappeared - how to re-enumerate USB?

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Running OpenWRT r32651 on a TP-LINK MR3420 with a Vodafone Huawei KS4511, I did my usual failure test of wrapping the modem in aluminium foil and putting it in a metal box.  After a few minutes the 3g-wan connection dropped as it normally does, but then the modem disappeared altogether - /dev/ttyUSB0 was no more!

I was able to recover the modem by unplugging it, and rebooting the router also gets it back, but I'd like to find something less severe.  I've been looking for a "usb reset" capability or some way to re-enumerate the device, but I've been unable to find anything.  Can anyone help?

In trunk there is a package called "usbreset" which lets you issue a port reset.

Thanks - clearly I was confused by the obscure package name :-)

I installed is from http://downloads.openwrt.org/snapshots/ … ar71xx.ipk.  Simply typing "opkg install usbreset" didn't do the trick (maybe I've got a path set up wrong) so I used "wget" to download the file and then "opkg install usbreset_1_ar71xx.ipk".

Documentation is somewhat lacking - usbreset doesn't support "-?", "-h" or "--help", and running it without parameters simple says "Usage: usbreset device-filename" - so I tried "usbreset /dev/usb1" and got "Error in ioctl: Is a directory", though it did cause the modem to restart.

After a bit of Googling I found the source code at http://projects.qi-hardware.com/index.p … usbreset.c which notes (in a comment) that you can also call it as "usbreset /proc/bus/usb/BBB/DDD" where BBB and DDD are the bus and device address numbers.  You can get these from "lsusb":-

Bus 001 Device 003: ID 12d1:14cc Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So the answer is "usbreset  /proc/bus/usb/001/003" - and it works a treat!

(Last edited by kbro on 16 Jul 2012, 02:29)

I spoke too soon.  The usbreset does indeed cause the modem to reset, but that doesn't clear the problem I'm having with it, which is that is reports "NO CARRIER" after the "ATD*99***1#" that I'm doing to get the data link up.  And, yes, this number normally works, especially if I reset the modem by unplugging it and plugging it back in!  I was hoping that usbreset would have the same effect.  Apparently not :-(

You could research whether there are a few modem specific AT commands to enforce a reset.

I'm trying to do that, but Huawei don't seem to be particularly forward about making this sort of information available.  In the meantime, I've discovered that USB power is controlled by GPIO-6 on the MR3420 (and GPIO-8 on the WR703N), so I can reset the modem like this:-

# stop the system attempting to restart the failed modem
ifdown wan
# turn off USB power
echo 0 > /sys/devices/virtual/gpio/gpio6/value
# let things settle
sleep 2
# turn on USB power
echo 1 > /sys/devices/virtual/gpio/gpio6/value
# restart the interface
ifup wan

Obviously this will nuke all USB devices, but that's okay because the modem is currently then only thing there.

The discussion might have continued from here.