The usage page and usage number was changed in 6f0b1adc14 (#630)

This commit is contained in:
Kristian Sloth Lauszus
2018-05-06 21:38:40 +02:00
committed by László Monda
parent ec98e4e1c6
commit 04aa5236c2
2 changed files with 8 additions and 2 deletions

View File

@@ -238,7 +238,10 @@ export class UhkHidDevice {
const dev = devs.find((x: Device) =>
x.vendorId === Constants.VENDOR_ID &&
x.productId === Constants.PRODUCT_ID &&
((x.usagePage === 128 && x.usage === 129) || x.interface === 0));
// hidapi can not read the interface number on Mac, so check the usage page and usage
((x.usagePage === 128 && x.usage === 129) || // Old firmware
(x.usagePage === (0xFF00 | 0x00) && x.usage === 0x01) || // New firmware
x.interface === 0));
if (!dev) {
this.logService.debug('[UhkHidDevice] UHK Device not found:');

View File

@@ -71,7 +71,10 @@ function writeDevice(device, data, options={}) {
function getUhkDevice() {
const foundDevice = HID.devices().find(device =>
device.vendorId === 0x1d50 && device.productId === 0x6122 &&
((device.usagePage === 128 && device.usage === 129) || device.interface === 0));
// hidapi can not read the interface number on Mac, so check the usage page and usage
((device.usagePage === 128 && device.usage === 129) || // Old firmware
(device.usagePage === (0xFF00 | 0x00) && device.usage === 0x01) || // New firmware
device.interface === 0));
if (!foundDevice) {
return null;