I am trying to generate keyboard keydown and keyup events programmatically. I am currently using CGPostKeyboardEvent to do this, but I am searching for a way to do this at
What's wrong with Quartz Event Services?
I think you are on the right track, but you should use CGEventCreateKeyboardEvent instead of CGPostKeyboardEvent
because the latter is deprecated since Mac OS X 10.6.
Event taps can inject at the HID level if you run as root
http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/tdef/CGEventTapLocation