I am new to node.js, in fact I am playing with Electron. My application is designed to configure the device from a specific provider and to read recorded files.
Config - a text file in the root of the device. Recorded files in a folder.
I want to know when a new device with connection points is connected and disconnected. I can perform these tasks (detect and list mount points) separately, but I cannot figure out how to glue them together. To have a callback on connect / disconnect, I use a module node-usb
and
var usb = require('usb');
usb.on('attach', ...);
But there are no mount points, an example output:
{ busNumber: 253,
deviceAddress: 3,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 528,
bDeviceClass: 0,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 64,
idVendor: 34148,
idProduct: 4096,
bcdDevice: 4352,
iManufacturer: 1,
iProduct: 2,
iSerialNumber: 3,
bNumConfigurations: 1 },
portNumbers: [] }
My target platforms are OS X and Windows. The only way I can see is to create my own C ++ module.
Is there an easy way to achieve this?