From b3e7a1098557e176b07c9f695597351f2fd6227a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 15 Oct 2011 13:44:16 -0400 Subject: [PATCH] Added some fallbacks if the HID Manager can't provide an actual device name. --- macosx_hidmanager.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macosx_hidmanager.c b/macosx_hidmanager.c index c4d7934..a7b1e2c 100644 --- a/macosx_hidmanager.c +++ b/macosx_hidmanager.c @@ -47,7 +47,14 @@ static char *get_device_name(IOHIDDeviceRef device) CFStringRef cfstr = (CFStringRef) IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)); if (!cfstr) - return NULL; + { + /* Maybe we can't get "AwesomeMouse2000", but we can get "Logitech"? */ + cfstr = (CFStringRef) IOHIDDeviceGetProperty(device, + CFSTR(kIOHIDManufacturerKey)); + } /* if */ + + if (!cfstr) + return strdup("Unidentified mouse device"); /* oh well. */ CFRetain(cfstr); len = (CFStringGetLength(cfstr)+1) * 12; /* 12 is overkill, but oh well. */