[AD] [PATCH] Fixed MacOS X issue where mice with more than one HID usage/usagePage in the USB descriptor would fail to be detected as a mouse.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi Everyone —

First time post/patch to here, so forgive me if I did something wrong.  This patch is to fix the OS X HID code to detect mice when they are part of multi-function devices.  In particular, I have a Microsoft Optical Mouse with Tilt Wheel that reports back multiple usage/usagePage values, and it’s primary values don’t happen to be generic desktop/mouse. 

Thanks!
dennis

---
 src/macosx/hidman.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/macosx/hidman.m b/src/macosx/hidman.m
index 6e5ac65..f62ee07 100644
--- a/src/macosx/hidman.m
+++ b/src/macosx/hidman.m
@@ -372,8 +372,8 @@ HID_DEVICE_COLLECTION *_al_osx_hid_scan(int type, HID_DEVICE_COLLECTION* col)
 			/* Add key for device type to refine the matching dictionary. */
 			usage_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
 			usage_page_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage_page);
-			CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDPrimaryUsageKey), usage_ref);
-			CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDPrimaryUsagePageKey), usage_page_ref);
+			CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDDeviceUsageKey), usage_ref);
+			CFDictionarySetValue(class_dictionary, CFSTR(kIOHIDDeviceUsagePageKey), usage_page_ref);
 		}
 		result = IOServiceGetMatchingServices(master_port, class_dictionary, &hid_object_iterator);
 		if ((result == kIOReturnSuccess) && (hid_object_iterator)) {
-- 
1.9.3 (Apple Git-50)





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/