Writing driver for Nintendo Gamecube controller via USB

bjurusik

Registered
I just ordered a USB attachment so I can use my Gamecube controller with my Mac, but after searching the web I don't see any drivers for it, and I don't think it's just 'plug and play.' So I was wondering where I can find some info on writing this kind of driver. I searched Yahoo and found Apple's developer docs on the I/O Kit. Is this where I start? I scanned it quickly and saw some mention of kernel programming and C++. I know C++, but not sure what kernel programming is. If someone could point me in the right direction, I'd greatly appreciate it.
 
The kernel is the actual core of the operating system. It's the lowest level guts of everything, normal users never directly use it. Instead they use utility programs that make calls to routines in the kernel.

As for help, I'm afraid that I have never programmed USB devices on MacOS X, but I can point you at some documentation as well as somebody elses project which has published source code.

<http://developer.apple.com/techpubs/macosx/Darwin/General/IOKitFundamentals/index.html>
<http://developer.apple.com/hardware/iokit/>
<http://sourceforge.net/cvs/?group_id=48717>

Good luck, post anything you learn here, or any interesting links you find. I want to hook up my bicycle trainer to my Macintosh eventually. I've developed the USB hardware but I've been too lazy to do the actual software bits on the MacOS or linux side.
 
Last semester I took a course on IBM PC ASM ... aka Assembly Language. Is kernel programming like Mac machine code, or is it higher level?
 
From what I've read it usually is, or it certainly used to be. Maybe the Darwin kernel isn't, but I don't know for sure.

Device drivers often are, such as for your video card. I know there's a lot of low level system DLLs in Windows that definately use assembly.

That link only talks about how to program kernel extensions, which is different than the kernel itself.
 
Well, I did a little more research and found some info on InputSprockets, apparently, this is what programmers used in OS 9 to write drivers. After more research, I found that this has been replaced by the HID Manager. I'm kind of lost by all this talk however ... like, what kind of file is a driver (in PB) and where does it go when I've created it, etc. I've only taken classes in Java, ASM, and Data Structures (using C++), and I'm learning Cocoa slowly. It doesn't seem like writing a driver for something like a game controller would be that hard. I'm guessing it would be like what we did in my ASM class to get input from a port. Write a for loop which continually checks the port, and when something happens it calls a table lookup. However, say I wanted an application that I could map the various buttons to different keyboard strokes ... would this application also be the driver or would this be a seperate, standalone cocoa app? Maybe I wouldn't even need to do any of this, possibly USB overdrive would work?
 
While I can't personaly vouch for the Darwin kernel I do know that the Linux kernel is written in C, not assembly. The source is freely available. Download it and take a look.

Anything that is extremely time dependant and in need of great optimization is usualy written in assembly. Video card drivers are an excellent example of this.

Heck, the networking module in Quake 3 is written largely in assembly. Id wanted the quickest, most efficient packet handling that they could get.
 
Boy, what a lousy bunch of developers we are if we don't even know the difference between a kernel and the Colonel ... :rolleyes: :D

Much of Darwin and the Mach kernel (which is heavily based on BSD and nearly completely written in C or related/derivative languages) has also been "opened" by Apple and the sources are freely downloadable.

See the Darwin page (http://developer.apple.com/darwin/ ) or the OpenDarwin projects page (http://www.opensource.apple.com/projects/darwin/6.0/projects.html )for a list of projects or modules in the OS and their downloadable code) for more info...

Rip
 
Back
Top