
Sometimes devices connected to USB ports need to be re-set. It’s not unusual GSM modems and WiFi dongles to freeze and the only way to bring them back to life is to remove and re-attach.
OLinuXino USB ports has power switches and current limiters which can be controller by Linux drivers.
After some experimenting we found that it’s not so easy actually to do it with the standard file system and shell.
A friend suggested to try this code. It worked very well, so here is how to use it. First you need to download and compile it, then to make it executable:
$ mkdir usbreset $ cd usbreset $ wget $ https://raw.githubusercontent.com/jkulesza/usbreset/master/usbreset.c $ cc usbreset.c -o usbreset $ chmod +x usbreset
Then you need to see where your USB device is. In our case I connected MOD-WIFI-R5370 WiFi USB dongle:
$ lsusb
you will see something like:
Bus 002 Device 039: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
to reset this device use the command:
./usbreset /dev/bus/usb/002/039
The device USB port will be power off for a second then power on again.
All above is tested and work with official Olimex Linux images from images.olimex.com, but should work on other Linux distributions too.
Recent Comments