Op 3-feb-05 om 22:39 heeft Rich Kubota het volgende geschreven:
I thought that I'd respond to some of your comments and questions
Great, thanks :-)
At 4:35 PM +0100 2/3/05, P.V. Machielse wrote:
I want to do the following: remap some keys on a _specific_
usb-keyboard. For instance: when I press the right option key, I want
it to be reported as 'enter'.
When I first started reading your question, I thought that
implementing a keyboard layout would be a better alternative than
implementing a replacement kernel extension. However, in the above
statement, one of the things which you desire is to modify the
behavior when a "modifier" key is pressed so that a different
keystroke is passed to the system. For this kind of change, a kernel
extension is required.
That is what I figured. I noticed a few utilities (iject) that can
switch the meta-keys, but I didn't exactly find the functionality I
want. The developer article at
<http://www.obdev.at/developers/articles/00001.html> gives an overview
of the technical possibilities, but it seems to refer to now obsolete
kernel extensions. Still, an up to date overview like this is what I'm
looking for...
On the face of it, the task doesn't look too daunting. It should be a
simple matter of adapting the already available open source Apple
keyboard driver. Looking around on the Apple dev web site didn't turn
up (m)any clues about how usb keyboard input is handled, but
downloading the USBFamily.kext code made things a little clearer.
the IOUSBHIDDriver.cpp code does show that the process point for the
incoming report is with the
handleReport(_buffer) call line 1081.
At this point, the call takes you to the
IOHIDDevice::handleReport call in the IOHIDDevice.cpp file which is a
part of the IOHIDFamily source. The actual processing of the keystroke
is in the
IOHIDKeyboard::handleReport() call which is in the IOHIDKeyboard.cpp
code.
Here you can see how the report is processed.
This should help get you started. What you should be able to do is
implement a vendor specific driver for your keyboard modeled after the
standard HID class driver. When the incoming report is received, you
have a chance to inspect the bytes and twiddle them to make it appear
that a keys were pressed or released.
OK, so now it is a matter of finding out the contents of _buffer, and
manipulating them directly. I presume the kext should be installed
alongside with the other plug-ins?
For Tiger, a simpler mechanism will be introduced, but I don't have
the details for this.
I hope to have it done before Tiger ships... Does this mean there is a
reasonable chance my kext will break on Tiger? (I guess this is fairly
common for kexts)
---
Hieper Software
e: email@hidden
w: www.hieper.nl
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden