Add read-debug-info.js
This commit is contained in:
25
usb/read-debug-info.js
Executable file
25
usb/read-debug-info.js
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
let uhk = require('./uhk');
|
||||
let [endpointIn, endpointOut] = uhk.getUsbEndpoints();
|
||||
var arg = process.argv[2] || '';
|
||||
|
||||
function readDebugInfo() {
|
||||
var payload = new Buffer([uhk.usbCommands.readDebugInfo]);
|
||||
console.log('Sending ', uhk.bufferToString(payload));
|
||||
endpointOut.transfer(payload, function(err) {
|
||||
if (err) {
|
||||
console.error("USB error: %s", err);
|
||||
process.exit(1);
|
||||
}
|
||||
endpointIn.transfer(64, function(err2, receivedBuffer) {
|
||||
if (err2) {
|
||||
console.error("USB error: %s", err2);
|
||||
process.exit(2);
|
||||
}
|
||||
console.log('Received', uhk.bufferToString(receivedBuffer));
|
||||
setTimeout(readDebugInfo, 500)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
readDebugInfo();
|
||||
Reference in New Issue
Block a user