node.js - Timeout Error (errno: 2) while reading data from usb -
i getting libusb_transfer_timed_out
error (errcode: 2
) when trying read data usb. using this module.
function onusbattached(device) { console.log('you gotta usb.\n'); device.open(); // open device. // console.log(device.interfaces); var syncinterface = device.interfaces[0]; // sync interface var asyncinterface = device.interfaces[1]; // async interface // console.log('incomingendpoint', incomingendpoint); if(syncinterface.iskerneldriveractive()){ console.log('kernel driver active. detaching kernel driver.'); syncinterface.detachkerneldriver(); } console.log('claiming interface'); syncinterface.claim(); var inendpoint = syncinterface.endpoints[0]; var outendpoint = syncinterface.endpoints[1]; // .controltransfer(bmrequesttype, brequest, wvalue, windex, data_or_length, callback(error, data)) device.controltransfer(0xc0, 0x32, 0, 0, 1, function (err, data) { if(err){ console.log('error while getting data', err); return ; } console.log('got data.', data); }); };
if can point out mistake great !!
Comments
Post a Comment