Move getBlhostCmd() from shared.js to uhk.js

This commit is contained in:
László Monda
2018-01-30 21:35:35 +01:00
parent 73e07eae2d
commit 288d4f75b6
4 changed files with 25 additions and 25 deletions
+23
View File
@@ -79,6 +79,28 @@ function checkFirmwareImage(imagePath, extension) {
}
}
function getBlhostCmd(pid) {
let blhostPath;
switch (process.platform) {
case 'linux':
const arch = exec('uname -m', {silent:true}).stdout.trim();
blhostPath = `linux/${arch}/blhost`;
break;
case 'darwin':
blhostPath = 'mac/blhost';
break;
case 'win32':
blhostPath = 'win/blhost.exe';
break;
default:
echo('Your operating system is not supported.');
exit(1);
break;
}
return `${__dirname}/blhost/${blhostPath} --usb 0x1d50,0x${pid.toString(16)}`;
}
let configBufferIds = {
hardwareConfig: 0,
stagingUserConfig: 1,
@@ -153,6 +175,7 @@ exports = module.exports = moduleExports = {
getTransferData,
checkModuleSlot,
checkFirmwareImage,
getBlhostCmd,
reenumerate,
usbCommands: {
getDeviceProperty : 0x00,