7

So I've got a strange problem that I've been running onto. I've got a bitcoin usb miner, Bitfury, and I'm using CGMiner to mine.

When I start the application, as root, the USB device is not detected automatically. CGMiner only detects the stick when it's re-plugged (it detects an hotplug event, and then works as intended)

I'd like to set up a headless mini-server, and therefore, I'd rather not stand up and unplug and then replug the device everytime the servers restarts, as I'm too lazy for that, and it's somewhat difficult do to when I'm not physically at my home.

So, is it possible to, like, turn off the USB system and restart it? Or is there a better way to do it?

Currently, I'm running Fedora 20 on HP t5730 terminal, but I've encountered the problem on Raspbian on Raspberry PI, so I don't think it's something OS-side. Maybe it's the device itself, or CGMiner's fault, but I was yet unable to find anything on that topic.

2 Answers2

1

Unload your USB HCI kernel modules (anything *hci_hcd and *usb*) and reload them. This is the only reliable way to actually cut the power to the USB ports.

There are other less severe method to achieve the same thing, but they are not guaranteed to work depending on how your device fails.

BatchyX
  • 3,063
  • Strange, there are no hci or usb modules loaded when lsmod'ding (except usb-storage). – user63936 Mar 30 '14 at 21:05
  • It's most likely because it's compiled built-in. The alternative is a bit cumbersome, as you need to unbind all usb devices/hubs from their driver and rebind them. And it's not as reliable; I managed to crash machines while doing this. – BatchyX Mar 30 '14 at 21:09
0

This answer details the usage of the usbreset utility. Go upvote that if this is helpful.

This is how I "unplug then replug" my USB wireless dongle, which often hangs. Before finding this script, I would have to physically unplug it then replug it in order for it to reset.

$ usbreset
Usage:
  usbreset PPPP:VVVV - reset by product and vendor id
  usbreset BBB/DDD   - reset by bus and device number
  usbreset "Product" - reset by product name

Devices: Number 001/003 ID 046d:080a
Number 003/002 ID 045e:07a5 Microsoft® 2.4GHz Transceiver v9.0 Number 001/002 ID 0cf3:9271 USB2.0 WLAN

$ sudo usbreset 0cf3:9271 Resetting USB2.0 WLAN ... ok

As you can see, I run the script once without any arguments to see which devices are connected. I then run it again with sudo and the product / vendor id (which is consistent across reboots) to virtually unplug and replug the device.

dotancohen
  • 15,864