Merge branch 'master' of github.com:UltimateHackingKeyboard/agent

This commit is contained in:
László Monda
2018-05-08 17:17:36 +02:00
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;