Mailing Lists: Apple Mailing Lists

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

Beyond Getting Started Questions



Hi,

This is my first post on the USB list. I have a few questions about OS X
driver development.

First some background:

I am developing a kext driver to support my specific hardware which uses a
Cypress MPU. It enums as vendor specific. I already have an OS 9 driver and
having mastered that, about 75% of that code and knowledge can be tossed out
for OS X.

I've pretty much decided that what I'm doing requires a kernel driver. My
driver needs to handle the following services:
1. Firmware loader. My hardware uses a I2C 32KB EEProm for boot and
configurations and a 512KB Flash for MPU code and programmable logic
firmware storage. By using the Cypress MPU, I can program a brand new or
previous unit with new firmware. This also means that for new or wiped
units, the service or client will need to also look for the default Cypress
0547 vendor ID. I suppose this can be done as personality setting in the
kext's plist.
2. Data Acquisition. A client application must acquire a continuous data
stream 96KB/s to 500KB/s over 256seconds minimum but typically all day long
without any data dropouts. With a bulk pipe of 64Bytes, this means that a
client app if doing Bulk transfers through IOUSBUserClientInit could not be
pre-empted for very long.
3. Serial services. First, the MPU uses a console style interface on a pair
of endpoints for command and monitoring by a separate client application.
Second, the MPU provides an extra serial link to RS232 to enable the
computer the computer to be connected over a 20Km RF Link. Third is a
possible link to a RS232 GPS(currently the MPU handles all GPS traffic)

First, I've done the basic driver, which is an OS X kext that loads when the
USB device is plugged in. So far it just grabs the IOUSBInterface,
configures the device and spits out a few IOLog messages.

I'm working on the next step which is creating an acquisition IOService.
From looking at the some of the open source as examples, I see that they use
new IOServiceClassObject and then call init(), attach(this),
registerService(), and release(). This service when enabled will do a
continuous bulk read into a approx 1 to 4MB buffer for a client app to fetch
from in variable size chunks(48KB typically). After that I will add a
IOUserClient Class to bridge the application.

Question#1.
Does this look like the right approach?

Question#2.
Is it possible to still use IOUSBUserClientInit simultaneously with my
driver. I wrote a console app for debugging based on one of the sample
projects which uses the user USB connection when my kext is not loaded. When
my kext is loaded the IOUSBDevice is in use and the console app doesn't
work. It shouldn't be trying to do its own SetConfiguration(). I tried to
get around this by not having my kext retain() the interface after starting,
but this will cause the you-must-restart-your-computer. I'm getting a
permanent universal power symbol in my finger print;)
I think that I just figured it out. I called close() for the IOUSBDevice
which allows the console test app to open it. This may not be perfect though
as the console app current also calls SetConfiguration.

Question#3. 
The new security restrictions require that kexts be owned by system and
wheel/root group. When I manually set my kext to have the same file access
permissions as all the other kext, I still get the security dialog. Is there
something more than just permissions or did I miss a setting? I swear they
look the same using 'ls' command.
Once, I tried to install the Apple usb debug enabled kext, following the
directions. When I rebooted, I got the kext security dialog with no way to
click the Fix-and-Use button (No USBFamily, means no Mouse and no Keyboard).
I ended up re-installing OS X; I suspect there might be an easier way to get
back by using the console boot mode.

Question#4.
How can I add some extra property key value for my kext instead of
hardcoding them? Things like a setting for enabling diagnostic output. Or
more to the point how do I access them in the kext? Would this kind of
setting go into the kext's plist or a separate configuration somewhere else?
Is it the kext's personally plist that's passed to init(OSDictionary*)?

Question#5.
Is there a vsprintf() in IOKit somewhere? I know there's sprintf(). I'd like
to wrap my IOLog messages. Currently I'm using my own based on a MSL source
with the stdlib stuff ripped out. Worked just fine in a OS9 USB extension
and seems to work ok here, but I'd rather go native.

Thanks for any insight,
Bill Rector
Codar Ocean Sensors
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: [OS X] Is ResetPipe() asyncronous...? (From: Fernando Urbina <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.