问题
I have a usb hid keyboard connected to my android device. Now i have a one way communication, from keyboard to android. But i am looking for the opposite way to control keyboard from android device. Now i find a way to control caps lock, numlock and scroll lock in java.
But i couldn't figure out how to do it for android.
What i am looking for is not changing the input method. So this or that solution doesn't work for me. Thanks in advance.
回答1:
Provided you're developing for a version of Android with the USB Host API (which it sounds like you are) you ought to be able to write some code to temporarily grab the keyboard's interface from the kernel, send the appropriate data to set caps lock and then release the interface so that the HID driver will pick it up.
来源:https://stackoverflow.com/questions/11953660/how-to-control-usb-hid-keyboards-caps-lock-from-android