Skip to content

Commit

Permalink
Added some fallbacks if the HID Manager can't provide an actual devic…
Browse files Browse the repository at this point in the history
…e name.
  • Loading branch information
icculus committed Oct 15, 2011
1 parent 7551ba4 commit b3e7a10
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion macosx_hidmanager.c
Expand Up @@ -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. */
Expand Down

0 comments on commit b3e7a10

Please sign in to comment.