var usb = require('usb');
usb.on('attach', function(device) {
console.log("usb attached" + device);
});
var devices = usb.getDeviceList();
console.log(devices);
var device = devices[0];
device.open();
device.interfaces[0].endpoints[0].transfer(64, function(error, data) {
console.log(error, data); // null, <Buffer 00, 00, 00, 00, 00, 00, 00, 00
});
var buf = new Buffer([0xFF, 0x12, 0x01]);
device.interfaces[0].endpoints[1].transfer(buf, function(error) {
console.log(error); // null
});
我的结果为{[错误:LIBUSB_ERROR_NOT_FOUND]错误:-5} 请帮帮我。