Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keyboard Driver HowTo?



Hi Dave,

I would never pretend to think that your dense.

You've described the 2 basic steps. I recall how I implemented a custom mouse driver sample by doing the following
1. modifying the class name to something like com.myCompany.mouseDriver::
2. modifying the plist so that I had a higher match score than the Apple driver by following the guidelines in Tech QA 1076
<http://developer.apple.com/qa/qa2001/qa1076.html>


I used USBProber to verify that my sample driver was getting matched to support an Apple Mouse. Once you get to this point, you can begin modifying the incoming report. On this I have no sample, but by looking at what the IOHIDKeyboard code does, you can get an idea as to what you'll need to do.

Mr. Machielse asked whether there would be a problem with such a modified kernel extension for Tiger. This should not be the case since the driver is IOKit based.

best wishes

rich

At 2:25 PM -0800 2/3/05, Dave Camp wrote:
This is very timely, as we've been approached by a PC keyboard manufacturer that wants to enter the Mac market. Most of the non-standard keys I can handle from a user land app (buttons for email, music, pictures etc). However, the keys for Option and Command are mapped backwards making the keyboard mostly unusable...

On Feb 3, 2005, at 1:39 PM, Rich Kubota wrote:

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.

I've written a lot of Mac code, but never a kext before, so maybe you can clarify this a bit. If it helps to pretend I'm dense, please do so. :-)


What you are saying we should do is:
- Change the IOUSBHIDDriver project target to match against our keyboard (plist change) and I presume change the name of the class to something appropriate.
- In InterruptReadHandler, twiddle the raw data before handleReport is called to make whatever modifications are desired.


Is that it?

Thanks,
Dave

-- Sincerely, Rich Kubota email@hidden (408) 974-6212 _______________________________________________ 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

This email sent to email@hidden
References: 
 >Keyboard Driver HowTo? (From: "P.V. Machielse" <email@hidden>)
 >Re: Keyboard Driver HowTo? (From: Rich Kubota <email@hidden>)
 >Re: Keyboard Driver HowTo? (From: Dave Camp <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.