question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rapid disconnect/reconnect of device isn't recognized.

See original GitHub issue

Bug Description:

Rapid disconnection and reconnection doesn’t seem to be properly recognized.

This is related to this bug posted here: https://github.com/microsoft/vscode-serial-monitor/issues/26, where someone posted this issue on the serial monitor.

Steps to Reproduce:

  1. Plug in a device
  2. Unplug the device and quickly plug the device back in.

Expected: The package correctly picks up both events and the device is properly picked up on reconnection Actual: It doesn’t seem to handle the reconnection event, it seems that reconnections happen too quickly for it to handle?

Additional Information

  • Operating System: Windows 11
  • Runtime (node -v or electron -v): 16.13.1
  • Node USB Version (npm ls usb): 2.5.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thegeckocommented, Aug 15, 2022

I would expect an update to resolve this issue as I suspect the older polling mechanism on Windows is the culprit. Easy to test…

1reaction
mildsunrisecommented, Aug 15, 2022

for context: hotplug detection has never really worked correctly in Windows until 2.5.0. before that, we regularly polled the current devices and relied on libusb to tell us whether two devices are the same or not.

if libusb is still recognizing a device as “the same” after a reconnection, then I’m afraid there’s little we can do and this is an issue that libusb should fix.

we could do additional validation by checking that busNumber and deviceAddress have not changed, but something tells me libusb is already doing that. maybe Windows is reusing the deviceAddress?

in any case, even if it does work in 2.5.0, it’s essentially a data race and you should not rely on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a USB Device That Keeps Disconnecting ...
1. Quick Fixes for the "USB Keeps Disconnecting and Reconnecting" Error · 2. Reinstall the USB Drivers · 3. Configure Your PC's Power...
Read more >
Windows 10 usb device disconnects and reconnects often
Restart the computer and check, if it works. If the issue still persists, follow the Method 3. Method 3:.
Read more >
If your computer doesn't recognize your iPhone or iPad
If that doesn't help, disconnect your device and all other USB devices and accessories from your computer. Then reconnect only your device.
Read more >
Device Not Recognized While Connected to the Computer?
Disconnect your device from the computer (Do not reconnect the device until step 4). Step 2. Completely Uninstall the Device Update software from...
Read more >
USB keeps disconnecting and reconnecting in Windows 10
To know more on how to fix USB disconnecting and reconnecting in Windows ... If after you connect a USB device, it keeps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found