Skip to content

Commit 33ba380

Browse files
committed
(ckb-daemon OSX) Fixed seize_wait not working correctly on El Cap
1 parent 810b8db commit 33ba380

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
beta-v0.2.2+t01
1+
beta-v0.2.2+t02

src/ckb-daemon/usb_mac.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ static int seize_wait(hid_dev_t handle){
317317
// HACK: We shouldn't seize the HID device until it's successfully added to the service registry.
318318
// Otherwise, OSX might think there's no keyboard/mouse connected.
319319
long location = usbgetlong(handle, CFSTR(kIOHIDLocationIDKey));
320-
char location_str[18];
321-
snprintf(location_str, sizeof(location_str), "@%lx", location);
320+
char location_var[18], location_fixed[18];
321+
snprintf(location_var, sizeof(location_var), "@%lx", location);
322+
snprintf(location_fixed, sizeof(location_fixed), "@%08x", (int)location);
322323
// Open master port (if not done yet)
323324
static mach_port_t master = 0;
324325
kern_return_t res;
@@ -341,7 +342,7 @@ static int seize_wait(hid_dev_t handle){
341342
IORegistryEntryGetPath(child_service, kIOServicePlane, path);
342343
IOObjectRelease(child_service);
343344
// Look for an entry that matches the location of the device and says "HID". If found, we can proceed with adding the device
344-
if(strstr(path, location_str) && strstr(path, "HID")){
345+
if((strstr(path, location_var) || strstr(path, location_fixed)) && strstr(path, "HID")){
345346
IOObjectRelease(child_iter);
346347
return 0;
347348
}

0 commit comments

Comments
 (0)