Trying to get access to the USB device in Electron app

This page summarizes the projects mentioned and recommended in the original post on /r/electronjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • serialport

    Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!

  • We use node-serialport instead of the WebSerial API, since it was only recently that Electron supported WebSerial permission overrides to make things like a 'devices screen' viable. The WebBluetooth APIs are still in a situation where you have to do polling shenanigans to get a full device list. I've found the mutated permissions system leaves a lot to be desired when debugging, whereas the NAPI modules are a lot more straightforward.

  • usb

    Improved USB library for Node.js

  • We use node-usb for USB hotplug detection, and rerun the serial poll, diffing the output with the ID information from node-usb to produce reliable device hinting.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • native-addon-loader

    Webpack .node file loader

  • Electron

    :electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

  • I wouldn't recommend using the main process to access the device. Any long-running blocking calls will cause all kinds of hard to debug problems. Ideally the main process does literally nothing except message passing and window handling. Defer any work to a hidden renderer window, or if you're on the latest Electron version, perhaps the UtilityProcess API would be a good fit.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts