views:

346

answers:

1

I'm developing an application that runs on a machine that has several usb keyboards attached. Occasionally keyboards will added or removed. Each time a key is pressed, the application needs to find out which key was pressed, and which keyboard was used.

I have got a working version of the application which uses RawInput under windows. However windows can take a while to work out whats happened if you add or remove a hub or two full of keyboards, and I'm looking too see if the same can be achieved on a different OS more robustly.

Mac OS X/Cocoa would be the second choice if it is possible, but I am open to suggestions for any other platforms like linux if you can suggest a way to do it.

A: 

On Mac OS X, you can use the HID Manager to get direct visibility into which HID elements are being actuated on which devices.

That should work not just for keyboard but for all HID devices — mice, game pads, etc. — though of course you can restrict what your code pays attention to to only specific devices or devices of a specific class.

You'll need to be familiar with the concepts of USB device matching and USB Human Interface Device communication in general, but if you are then it should be fairly straightforward to get something up and running with the HID Manager on Mac OS X Leopard (10.5).

Chris Hanson
Thanks ChrisI've looked at the apple dev site. Looks like it'll work. As the keyboards will be used by the public, I need to prevent them exiting the app, starting apps or doing anything else undesirable on the keyboard.On Windows I use a registry hack to disable keys, any mac suggestions?
Twelve47