We've bought a commercial application who just work only if their dongle usb is connected to the server. However sometimes the application can not recognize the dongle, so it doesn't work, but if someone eject the dongle physically from USB port and attach it again it will recognize and work fine.

There are 43 modules loaded on the server and attach/eject the dongle does not increase/decrease number of modules.

Also I have usbmon0, usbmon1 and usbmon2 files in /dev before/after eject/attach the dongle and number of files in /dev will not change before/after eject/attach the dongle.

journalctl -f command after ejecting the dongle:

Jan 19 18:10:28 iwr kernel: usb 2-2.1: USB disconnect, device number 5

journalctl -f command after attaching the dongle:

Jan 19 18:11:11 iwr kernel: usb 2-2.1: new full-speed USB device number 6 using uhci_hcd
Jan 19 18:11:11 iwr kernel: usb 2-2.1: New USB device found, idVendor=0403, idProduct=c580
Jan 19 18:11:11 iwr kernel: usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jan 19 18:11:11 iwr kernel: usb 2-2.1: Product: HID UNIKEY
Jan 19 18:11:11 iwr kernel: usb 2-2.1: Manufacturer: OEM
Jan 19 18:11:11 iwr kernel: usbhid 2-2.1:1.0: couldn't find an input interrupt endpoint

Can I eject and then attach it logically? (issue a command, remove a module, etc.)

  • 1
    Please check if any of those solutions work.
    – TNW
    Jan 19, 2016 at 15:35
  • 1
    Thanks TNW for replying, I tried them but none of them worked for me. echo 2-2.1 > /sys/bus/usb/devices/2-2.1/driver/unbind worked for eject and echo 2-2.1 > /sys/bus/usb/drivers/usb/bind Jan 19, 2016 at 18:43

1 Answer 1


Many answers found on the Internet (including those in TNW's comment) rely on /sys/bus/usb/devices/2-2/power/level or /sys/bus/usb/devices/2-2/power/control which are both deprecated since 2.6.something kernel. For newer kernels, the suggested procedure is to unbind and rebind its driver, which usually results in a power cycle:

# Find out which driver to unbind
tree /sys/bus/usb/devices/2-2.1 | grep driver
|-- driver -> ../../../../../../bus/usb/drivers/whatever

# Unbind the driver
echo 2-2.1 > /sys/bus/usb/drivers/whatever/unbind

# Rebind the driver
echo 2-2.1 > /sys/bus/usb/drivers/whatever/bind
  • 2
    Thanks dear Dmitry. As Dmitry said, /sys/bus/usb/devices/2-2/power/level and /sys/bus/usb/devices/2-2/power/control does not work (level and control files do not exist) because the kernel version is 3.10.0 . but echo 2-2.1 > /sys/bus/usb/devices/2-2.1/driver/unbind worked for eject and echo 2-2.1 > /sys/bus/usb/drivers/usb/bind worked for attach. Jan 19, 2016 at 18:38
  • I'm glad that helped, and thanks for reporting back! Jan 19, 2016 at 20:31
  • 1
    How do you identify the device number when you have many devices? Aug 23, 2018 at 16:57
  • @djsmiley2k usually by looking at vendor ID and device ID of each USB device Aug 23, 2018 at 19:21
  • 1
    I found it in dmesg, at the start of the logged message ;D - I'm so blind! :) Aug 23, 2018 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.