0

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
pablorsk
  • 3,861
  • 1
  • 32
  • 37
  • 1
    That probably depends where the problem is. If the problem is on the host side, the disconnect-connect cycle actually triggers the driver and that is what gets it back to worl. You can do that using `modprobe` if you know the concerned driver. If the problem is on the device side, the disconnect-connect cycle powers-down and powers-up the device. This can be done by getting to the device inside `/sys/devices/pci0000:00/` and finding the device (maybe using `dmesg`) and then using its `power/level` file to turn `on` and `off`. – zeekhuge Aug 04 '17 at 12:03

1 Answers1

0

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.

meuh
  • 11,500
  • 2
  • 29
  • 45