node-usb / node-usb-example-electron

Example Electron application for node-usb
MIT License
32 stars 12 forks source link

USB hotplug not working #4

Open RosiersRobin opened 9 months ago

RosiersRobin commented 9 months ago

When running the example, the USB hotplugging (thus detection when a device would be removed) does not work. Any solution to this?

thegecko commented 9 months ago

Please provide some versions (node-usb, electron), your OS and repro steps.

RosiersRobin commented 8 months ago

OS: Windows 10 Home node-usb: ^2.11.0 electron: ^24.0.0

Steps to reproduce

  1. Clone the repo (this repo)
  2. install using npm i
  3. start app using npm start
  4. Plug in a USB device
  5. nothing hapens

Expected behavior USB list should change with the new added device.

Example screenshot of the application: image

thegecko commented 8 months ago

Thanks,

can you outline the sort of device you are trying to detect? HID devices are often claimed by the OS on windows, so things like mice/keyboards/printers etc. may not appear.

Ideally, the interface class type of the device would be helpful.

RosiersRobin commented 8 months ago

I don't know if you're familliar with ESP32? It's just a dev board.

Sillicon Labs CP210x USB to UART Bridge. So a COM port.

image

thegecko commented 8 months ago

For COM ports on desktop, I recommend using https://serialport.io/

I doubt the UART is wired up in any way to be easily accessible via the low-level USB interfaces

RosiersRobin commented 8 months ago

I'm using that library, but there is no hotplug event thing (for as far as I know?)

thegecko commented 8 months ago

Hmm, I am assuming the OS is claiming the COM interface.

Some things to try: