I'm using RPI Zero W as keyboard gadget. It's supposed to act as keyboard getaway from Bluetooth keyboard to USB keyboard. I'm running "showkey" shell command process giving me codes of just pressed keys.
I can get pressed key codes in one of the flowing ways:
# showkey -k // press "a" key
keycode 30 press
keycode 30 release
# showkey -s // press "a" key
As a final result to send to /dev/hidg0 I need to form a 8-byte HID packet. For the "a" key press it looks like
Could you please advice how such
"showkey" codes can be converted into such binary(?) HID packet? My attempts so convert values between HEX, DEC, ASCII, and Binary, are all failed.
I'm dealing with PHP script, so ideally, I would prefer to do just something like
or I can send a common shell call:
echo -ne "\0\0\x4\0\0\0\0\0" > /dev/hidg0
UPD: Keyboard is QWERTY.
UPD: PI Zero W has Wifi and Bluetooth. Incoming key codes come from Bluetooth keyboard.
Thanks a lot!