Sending Android Keyevents via Leonardo Arduino

Erik63

Member
Mar 12, 2016
10
0
0
I hope I am posting this to the right forum, if not, can someone point me to a more appropriate one.

I am trying to send keyevent commands from my Leonardo Arduino to my Android tablet, part of a head unit. I can send the commands via ADB shell on my laptop, but I cannot figure out how to send them via the arduino.

I have been looking for weeks on how to do this, I have gotten some close hits (http://www.instructables.com/id/USB-Pedal-HID-Keyboard-With-Arduino-Leonardo/) but they are in the area of sending the standard ASCII keyboard codes, and I am looking to send screen diming/brighten and sleep/wake.

Has anyone had experience in this area?

Thanks,
-Erik
 

Erik63

Member
Mar 12, 2016
10
0
0
I have noticed that I can execute an "input keyevent" in a serial terminal via a USB keyboard, but the instruction is just ignored, no errors, and if I just type "input" it gives me the usage method so I know it is there. Does the Android need to be rooted to execute the command, or is it a permission issue?
Thanks,
-Erik