

(available freely by googling the above title). I just came across a paper titled "Exploiting Smart-Phone USB Connectivity For Fun And Profit" by Angelos Stavrou, Zhaohui Wang, Computer Science Department George Mason University, Fairfax, VA. Seems someone have done it by patching the kernel. (The though just occurs that this approach will only allow the device to function as a keyboard inside windows, not during the boot process)
APP FOR MAC THAT IS A BLUE TOOTH KEYBOARD EMULATOR INSTALL
If memory serves, every peripheral keyboard I've used in the last 10 years has needed to install a driver for full functionality, so this may not be considered non-standard behavior.

However, if you're open to installing a driver for this behavior, It should be possible to write a custom driver that can handle Android USB protocol, and correctly translate to the correct calls/interrupts for keyboard functionality. If installing drivers on the computer is out of the question, these may be the only two options. His two solutions of modifying the firmware to communicate using HID standards, as well as a hardware middleman that translates from the Android Accessory protocol to HID both seem valid to me. I think KristopherMicinski is right that the level of control you get with the stock Android USB API is inadequate for this purpose. It is likely a very non-trivial undertaking. That being said, It may be possible to use Android's USB capabilities, as well as writing a custom driver if default HID is not sufficient, to achieve your goal.

Any keyboard functionality (non-standard buttons) beyond the capabilities of the standard HID drivers will need to install some software on the computer.
