0

We have been tasked to write a test application for a raspberry pi IOT device running Raspian, one of the requirements for the application is to determine if the USB hub connected to the pi is working correctly due to the fact our supplier had to modify the pi by unsoldering and resoldering a connection to the pi for the USB hub.

Via Debian Linux CLI command, or via node (test app currently running in Node on the pi), what could we use to let us know if or when something/anything USB has been plugged into the USB ports and possibly which port was used.

Alex P.
  • 30,437
  • 17
  • 118
  • 169
shaun
  • 1,223
  • 1
  • 19
  • 44

1 Answers1

0

If your main application is running as a nodejs app. You can easily use usb-detection node module. Below is some code which I used in one of my RPI project where I had similar requirements.

var usbDetect = require('usb-detection');
usbDetect.startMonitoring();
usbDetect.on('change', function(device) { 
  console.log('change in usb', device); // This will also display device information.
});

Documentation: https://www.npmjs.com/package/usb-detection

Abhas Tandon
  • 1,859
  • 16
  • 26