Ignore HID exception which gets thrown when the bootloader is already up. Remove noisy messages.
This commit is contained in:
+8
-5
@@ -18,11 +18,17 @@ function getUhkDevice() {
|
|||||||
((device.usagePage === 128 && device.usage === 129) || device.interface === 0));
|
((device.usagePage === 128 && device.usage === 129) || device.interface === 0));
|
||||||
|
|
||||||
if (!foundDevice) {
|
if (!foundDevice) {
|
||||||
console.error('UHK Device not found:');
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HID.HID(foundDevice.path);
|
let hid;
|
||||||
|
try {
|
||||||
|
hid = new HID.HID(foundDevice.path);
|
||||||
|
} catch (error) {
|
||||||
|
// Already jumped to the bootloader, so ignore this exception.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return hid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBootloaderDevice() {
|
function getBootloaderDevice() {
|
||||||
@@ -30,10 +36,7 @@ function getBootloaderDevice() {
|
|||||||
device.vendorId === 0x1d50 && device.productId === 0x6120);
|
device.vendorId === 0x1d50 && device.productId === 0x6120);
|
||||||
|
|
||||||
if (!foundDevice) {
|
if (!foundDevice) {
|
||||||
console.error('UHK Bootloader not found:');
|
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
console.info(foundDevice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HID.HID(foundDevice.path);
|
return new HID.HID(foundDevice.path);
|
||||||
|
|||||||
Reference in New Issue
Block a user