refactor(usb): Use hid-api instead of lib-usb (#404)
* refactor(usb): Rewrite jump-to-bootloder to node-hid * refactor(usb): Rewrite the whole usb packages to HID-API * refactor(usb): Deleted not valid usb command files * refactor(usb): Deleted not supported usb commands * Remove obsolete script. * Remove obsolete script. * Fix script. * Fix script. * No need to assign the silent property because it has been removed. * This workaround may work on other platforms, but it certainly doesn't work on Linux. It makes some scripts not work, so I'm commenting it out. * Fix bootloader VID and PID.
This commit is contained in:
committed by
László Monda
parent
3cbd3bb5ea
commit
30c74c06d3
@@ -9,7 +9,9 @@ console.log('Trying to jump to the bootloader...');
|
||||
setInterval(() => {
|
||||
timeoutMs -= pollingIntervalMs;
|
||||
|
||||
if (uhk.getBootloaderDevice()) {
|
||||
let device = uhk.getBootloaderDevice();
|
||||
|
||||
if (device) {
|
||||
console.log('Bootloader is up');
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -19,9 +21,10 @@ setInterval(() => {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (uhk.getUhkDevice() && !jumped) {
|
||||
device = uhk.getUhkDevice();
|
||||
if (device && !jumped) {
|
||||
console.log('UHK found, jumping to bootloader');
|
||||
uhk.sendUsbPacket(new Buffer([uhk.usbCommands.jumpToBootloader]), {noReceive:true});
|
||||
device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.jumpToBootloader])));
|
||||
jumped = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user