From 2119e2d6b3562ecfd228d9e4fd4f576c37d874dd Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 21 Aug 2019 05:05:31 +1000 Subject: [PATCH] [macOS] Fix VID/PID for HID (dis)connect messages (#107) --- osx/qmk_toolbox/HID.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osx/qmk_toolbox/HID.m b/osx/qmk_toolbox/HID.m index 02decc9393..212da57583 100644 --- a/osx/qmk_toolbox/HID.m +++ b/osx/qmk_toolbox/HID.m @@ -43,12 +43,14 @@ + (void)setupWithPrinter:(Printing *)printer { } static NSString * formatDevice(NSString * str, IOHIDDeviceRef device) { - return [NSString stringWithFormat:@"%@ - %@ %@ -- 0x%X:0x%X", + unsigned short vendorId = [(NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) shortValue]; + unsigned short productId = [(NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey)) shortValue]; + return [NSString stringWithFormat:@"%@ - %@ %@ -- %04X:%04X", IOHIDDeviceGetProperty(device, CFSTR(kIOHIDManufacturerKey)), IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)), str, - (int)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) / 256, - (int)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey)) / 256 + vendorId, + productId ]; }