Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: mouse, keyboard ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mouse, keyboard ...



Hi Lloyd,

You'll want to check out the values for the primaryUsagePage and primaryUsage to figure out what kind of device you're looking at.

Mouse:

PrimaryUsage = 2
PrimaryUsagePage = 1

Keyboard:

PrimaryUsage = 6
PrimaryUsagePage 1

You can reference the hid usage table available @ usb.org for more info.

- Rob

On Wednesday, March 19, 2003, at 07:04 PM, Lloyd Dupont wrote:

using this excellent library
<http://developer.apple.com/samplecode/Sample_Code/
Devices_and_Hardware/HID_Manager/HID_Utilities_Source.htm>

I could list the USD device quite easily like this:
//------
HIDBuildDeviceList(NULL, NULL);
recDevice *pd;
for(pd = HIDGetFirstDevice(); pd; pd = HIDGetNextDevice(pd)) {
printf("--------------------\n");
printf("HID.manufacturer %s\n", pd->manufacturer);
printf("HID.product %s\n", pd->product);
printf("HID.serial %s\n", pd->serial);
}
HIDReleaseDeviceList();
//------

However I see no way to know if a given devices is a keyboard, a mouse,
otherwise...
of course when the product name is "Generic USB Keyboard", I could read
it, but I would like to avoid strcmp() calls and use the keys define,
for example, in a header like <IOKit/hid/IOHIDKeys.h>, whereas I see a
list of enum and #define, but none as a comprehensive name like
"kIOHDEmouseType", "kIOHDEKeyboardType", I'm lost ...

any help ?
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >mouse, keyboard ... (From: Lloyd Dupont <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.