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
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
let uhk = require('./uhk');
|
||||
let process = require('process');
|
||||
const uhk = require('./uhk');
|
||||
|
||||
uhk.silent = true;
|
||||
let isHardwareConfig = process.argv[2] === 'h';
|
||||
let configTypeString = isHardwareConfig ? 'hardware' : 'user';
|
||||
const isHardwareConfig = process.argv[2] === 'h';
|
||||
|
||||
uhk.sendUsbPacketsByCallback(() => {
|
||||
return new Buffer([uhk.usbCommands.getProperty, isHardwareConfig ? uhk.systemPropertyIds.hardwareConfigSize : uhk.systemPropertyIds.userConfigSize]);
|
||||
});
|
||||
const device = uhk.getUhkDevice();
|
||||
const sendData = new Buffer([uhk.usbCommands.getProperty,
|
||||
isHardwareConfig ?
|
||||
uhk.systemPropertyIds.hardwareConfigSize
|
||||
: uhk.systemPropertyIds.userConfigSize]);
|
||||
|
||||
uhk.registerReceiveCallback((buffer) => {
|
||||
configSize = buffer[1] + (buffer[2]<<8);
|
||||
console.log(configSize);
|
||||
process.exit(0);
|
||||
});
|
||||
device.write(uhk.getTransferData(sendData));
|
||||
const response = Buffer.from(device.readSync());
|
||||
console.log(response[1] + (response[2]<<8));
|
||||
|
||||
Reference in New Issue
Block a user