Skip to content

USB hotplug not working #4

Open

Description

@RosiersRobin

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

Activity

  1. thegecko commented on Jan 3, 2024

    @thegecko
    Member

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

  2. RosiersRobin commented on Jan 8, 2024

    @RosiersRobin
    Author

    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

  3. thegecko commented on Jan 8, 2024

    @thegecko
    Member

    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.

  4. RosiersRobin commented on Jan 8, 2024

    @RosiersRobin
    Author

    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

  5. thegecko commented on Jan 8, 2024

    @thegecko
    Member

    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

  6. RosiersRobin commented on Jan 8, 2024

    @RosiersRobin
    Author

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

  7. thegecko commented on Jan 8, 2024

    @thegecko
    Member

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

    Some things to try:

    • If you have access to the firmware, you could potentially expose another interface with custom class (0xFF) which the OS doesn't claim and this library can detect.
    • See if the https://github.com/MadLittleMods/node-usb-detection package meets your needs better.
  8. RosiersRobin commented on Nov 27, 2024

    @RosiersRobin
    Author

    So I've tried with the deprecated package, it didn't work.

    Seems like windows doesn't like to tell electron 'hey, there is a new device', since the thing I did currently works perfectly on macos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions