- How to reconnect a logically disconnected USB device?
- 9 Answers 9
- linux rescan usb devices
- How can I tell what devices are connected to my USB Linux?
- How do you reset a USB device from the command line?
- How do I refresh my USB?
- Why is my USB not detected?
- How do I fix an unresponsive USB port?
- How do I know if I have USB 3.0 Linux?
- How do I find my USB serial port in Linux?
- Where is my USB mounted Linux?
- How do I reset my USB ports Windows 10?
- How do I reconnect USB without unplugging?
- How can I fix my USB 3.0 port?
- Can USB ports go bad?
- How do I force Windows to recognize a USB?
- C — how can i reset the USB Bus under linux?
How to reconnect a logically disconnected USB device?
What is going on in the driver or in the hardware, and most importantly, (how) can the device be logically reconnected (without physically plugging it out and back in)?
Note that this question is not about mounting. In the “logically disconnected” state, the kernel believes there is nothing on the USB bus (and so of course there is no entry under /dev ).
9 Answers 9
It is sometimes possible to do a power cycle on branch of the USB bus where the device is plugged :
# echo suspend > /sys/bus/usb/devices/1-1/power/level # echo auto > /sys/bus/usb/devices/1-1/power/level
The 1-1 should be adjusted to your configuration. You can see to which part of the USB tree your device is plugged by running lsusb -t before ejecting it.
You can find detailed information on the linux-usb mailing-list, this thread for example.
Assuming dmesg reports the correct device ID («usb 9-4: USB disconnect [. ]»), this does not work on latest Arch Linux. There is no path /sys/bus/usb/devices/9-4 afterwards.
1. dmesg: WARNING! power/level is deprecated; use power/control instead 2. superuser.com/questions/371068/…
Now check for Kernel. E.g. if it is connected to Port 2 of Front UIP then it would be 1-1.2 and if it is connected to Port 1 of Front UIP then it would be 1-1.1.
For Port 2 : To disconnect USB :
echo '1-1.2' | tee /sys/bus/usb/drivers/usb/unbind
echo '1-1.2' | tee /sys/bus/usb/drivers/usb/bind
Reset the device, or the hub it is connected to, and the device should reappear. Here is a small program to do that:
It works for most USB drives I’ve tried, but there are exceptions, like my Kingston DT 101 II 4GB, which fails INQUIRY and READ CAPACITY commands after reset, and remains unusable until power-cycled.
You can power-cycle the device without unplugging if it gets power from the port, and your USB hub supports per-port power control. Here is a small program to control the power:
Unfortunately, almost no USB hubs support this feature, and it’s very difficult to find one that supports it. Manufacturers do not advertise it. Many hubs also lie about it, for example if you do «lsusb -v» you can see «Per-port power switching» advertised in «wHubCharacteristic», but in reality it does not work. The chipset may support it, but it was easier/cheaper for the manufacturer to connect port power pins directly to the power supply instead of going through the chipset.
linux rescan usb devices
How can I tell what devices are connected to my USB Linux?
- $ lsusb.
- $ dmesg.
- $ dmesg | less.
- $ usb-devices.
- $ lsblk.
- $ sudo blkid.
- $ sudo fdisk -l.
How do you reset a USB device from the command line?
- Compile the program: $ cc usbreset.c -o usbreset.
- Get the Bus and Device ID of the USB device you want to reset: $ lsusb Bus 002 Device 003: ID 0fe9:9010 DVICO.
- Make our compiled program executable: $ chmod +x usbreset.
How do I refresh my USB?
- Reboot the computer. Or .
- Unplug, then re-plug, the physical device connected to the port. Or .
- Disable, then re-enable, the USB Root Hub device that the port is attached to.
Why is my USB not detected?
This can be caused by several different things such as a damaged or dead USB flash drive, outdated software and drivers, partition issues, wrong file system, and device conflicts. . If you’re getting a USB Device not Recognized error, we have a solution for that too, so check out the link.
How do I fix an unresponsive USB port?
- Restart your computer. .
- Look for debris in the USB port. .
- Check for loose or broken internal connections. .
- Try a different USB port. .
- Swap to a different USB cable. .
- Plug your device into a different computer. .
- Try plugging in a different USB device. .
- Check the device manager (Windows).
How do I know if I have USB 3.0 Linux?
- Look at the output of lsusb. Note what the bus number is of the USB 2.0 and USB 3.0 ports. In the article, BUS 1 and BUS 2 are USB 2.0, and BUS 3 is USB 3.0.
- Plug a USB device into one of the ports.
- Use lsusb again. Note the bus number that the device is plugged into.
How do I find my USB serial port in Linux?
- Open terminal and type: ls /dev/tty* .
- Note the port number listed for /dev/ttyUSB* or /dev/ttyACM* . The port number is represented with * here.
- Use the listed port as the serial port in MATLAB ® . For example: /dev/ttyUSB0 .
Where is my USB mounted Linux?
Easiest way to get the path of the mounted USB is open Files, right-click on the USB in the sidebar and click properties. Concatentate the parent folder entry with the name of the USB (look at topbar for name). for example: /home/user/1234-ABCD .
How do I reset my USB ports Windows 10?
- Step 1: Open Device Manager. .
- Step 2: On Device Manager, find Universal Serial Bus controllers and expand it.
- Step 3: You will see a list of the USB controller. .
- Step 4: Restart your computer. .
- Step 1: Open Registry Editor.
How do I reconnect USB without unplugging?
- DevEject. DevEject is a simple software configured to replace «Safely Remove Hardware and Eject Media» in Windows. .
- USB Safely Remove. USB Safely Remove is an extended USB device management program. .
- Zentimo. Zentimo is the successor of USB Safely Remove . .
- Disable and re-enable USB Mass Storage Devide. .
- Uninstall USB Root Hub.
How can I fix my USB 3.0 port?
Update to the Latest BIOS, or Check USB 3.0 is Enabled in BIOS. In many cases, your motherboard will be responsible for software issues related to your USB 3.0 ports or any other ports on the motherboard. For this reason, updating to the latest BIOS may fix things.
Can USB ports go bad?
The implication certainly is that USB ports can go bad. My guess is that it’s more ‘dirt’ related than anything else; the connectors are getting a little dirty over time since they are exposed to the elements. The software can get confused, certainly, but that’s normally something you can clean up.
How do I force Windows to recognize a USB?
- Select Start»Control Panel and double-click the System icon.
- Select the Hardware tab and click the Device Manager button. .
- Double-click the Ports (COM & LPT) icon. .
- Double-click the Universal Serial Bus Controllers icon. .
- Click the Scan for Hardware Changes icon at the top of the Device Manager window.
Akaso
Are Akaso cameras good?Which is the best Akaso action camera?Which Akaso is best?What is the best action camera for under $100?Is Akaso better than Go.
Brain
What apps make smarter?What is the smartest app?What games increase IQ?How can I make my brain super intelligent?How can I get smarter overnight?Does .
Failban
How do I protect SSH with fail2ban?How do I stop fail2ban service?What is fail2ban Ubuntu?Do I need fail2ban?How do I check if fail2ban is working?Wha.
Fresh articles, interesting news and useful guides from the world of modern technologies. We know everything about computers and gadgets that you encounter every day
C — how can i reset the USB Bus under linux?
Daily—about 5 to 10 times—my USB camera disappears from the system. It’s been happening from day 1 because the manufacturer driver is not compatible with Linux. lsusb and dmesg show it correctly at first, but after a longer period of time sometimes it disappears. The best solution to fix it is to reset the USB interface for that camera to get it back. I did it a few times manually using the C source code and it worked, but when I am doing it in a Bash loop it seems it’s failing over and over. Any idea? How can I make both programs work, so that I get my /dev/video0 or 1 or 2 always available? Step 1: Resetting the USB bus under Linux using this code:
/* few times it's resetting but when I use it in a Bash loop it's not doing it */ #include #include int main(int argc, char *argv[]) < struct usb_bus *busses; usb_init(); usb_find_busses(); usb_find_devices(); busses = usb_get_busses(); struct usb_bus *bus; int c, i, a; for (bus = busses; bus; bus = bus->next) < struct usb_device *dev; int val; usb_dev_handle *junk; for (dev = bus->devices; dev; dev = dev->next) < char buf[1024]; junk = usb_open ( dev ); usb_get_string_simple(junk,2,buf,1023); switch(argc) < case 1: if ( junk == NULL ) < printf("Can't open %p (%s)\n", dev, buf ); >else if (strcmp(buf,"HD Pro Webcam C920")==0) < val = usb_reset(junk); printf( "reset %p %d (%s)\n", dev, val, buf ); >break; default: if ( junk == NULL ) < printf("Can't open %p (%s)\n", dev, buf ); >else < val = usb_reset(junk); printf( "reset %p %d (%s)\n", dev, val, buf ); >> usb_close(junk); > > >
Step 2: Running as scanner — to make sure video0 or 1 or 2 is available, if not available resetting the USB bus
#!/bin/bash j=true while $j do for i in 0 1 2 do tmp="/dev/video$i" if [ -e $tmp ] then echo "/dev/video$i" j=false else echo "NO - camera found - restarting the USB $i" echo ROOT_PASSWORD_TO_EXECUTE | sudo -S /var/tmp/c-restartusb/restartusb fi done done echo "Camera - logic ended, expecting the camera is available now"
NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1 NO - camera found - restart the USB 2 NO - camera found - restart the USB 0 NO - camera found - restart the USB 1