Hard reconect USB device from bash

159 views Asked by At

I have a lot of USB modems connected to a server. Sometimes USB not respond to software like gnokii o gammu (I need read IMEI) and we need disconnect device and reconnect, and the problem is solved.

I need a way to do this from bash. I know is impossible shutdown disabling energy. Any ideas?

I try with:

Both solutions detach device and atach again, but the problem when I request data still failing.

A solution passing this data is better for me :)

  • /dev/ttyUSB0
  • /dev/bus/usb/001/001
1

There are 1 answers

0
meuh On

You may need to remove power from your usb device to make it reset properly. Though the usb standard expected hubs to provide for remote power switching by software, very few hubs actually implement this feature (which cuts down on 1 extra transister per port). You should try searching for usb hubs with PPPS which means per-port power switching.

This uhubctl software for Linux and MacOSX can control such a hub, and the page lists some compatible hubs. For example, this support reply in December 2016 from Plugable Technologies lists two inexpensive hubs they make which you can find, on amazon, for example.