Learning About Mac OS X Native Python Programming
: Description : Information and notes regarding using Python to interact with Mac OS X native components
This information is initially related to trying to access USB functionality via native IOKit routines. It is related to my attempts to get Atmel's AVR JTAGICE mkII working under OS X.
- Mac OS X 10.5 has PyObjC installed. It is apparently a more recent version of what is available at the website. It also apparently uses BridgeSupport and the gen_bridge_metadata script. But unfortunately the script chokes on processing IOKit.
- Re: Using ctypes to access OS X frameworks -- describing how to use PyObjC like ctypes with objc.loadBundleFunctions use. Example usage: wmEnable.py
- Pass-by-reference arguments -- "The compiler will generate a method signature for this method and this can be accessed from Python using the property 'signature' of Objective-C methods. See Type Encodings [updated URL] for the list of valid encoding characters for the Apple Objective-C runtime."
- Mac OS X 10.5 also has ctypes installed.
- The disadvantage of ctypes is PyObjC seems to handle more things transparently.
- The ctypes codegenerator which uses gccxml: codegenerator.py
Mac OS X IOKit USB functionality
- Mac OS X USB Debug Kits Downloads
- Some app using IOKit and USB: link link PSUmoni.src.1.4b.zip
- "In the I/O Kit master port case, since Jaguar there's been the constant kIOMasterPortDefault. Just pass that to any call that needs the I/O Kit master port, and you no longer need to call IOMasterPort() explicitly."
- Relevant Apple USB list messages: Re: Garmin GPS/Bulk Reads, Re: Re: USB polling, Fwd: ReadPipeTO timeouts not working?, Re: Fwd: ReadPipeTO timeouts not working?, Re: ReadPipeAsync error = $e00002e8
- Annotation of /trunk/libusb/darwin.c
- "Also note that LIBUSB doesn't support true async communications under OSX."
- Debugging advice in libusb?
@@ TODO: This stuff should probably be on the JTAG ICE page.