Emulating a USB keyboard with a Rasberry PI - trying to send fn+h

55 Views Asked by At

I have captured using tshark a set of 8 byte data that is generated as I type characters on an Apple keyboard connected to a Raspberry Pi 4B via one of its USB-A ports.

When I take the captured data and send that data to an iPhone connected to the Pi's OTG port (using a usb camera adapter), I can simulate various keystrokes, modified keystrokes (shift, ctrl, meta, etc.).

However, I can not get fn key + key combinations to work, e.g. fn+c or fn+h

The captures I get are:

0000000000000001 - the fn key
0000060000000001 - the c + fn key
0000000000000001 - the fn key
0000000000000000 - no keys

but the iPhone only interprets the c key, it does not display the control center.

Plugging the apple keyboard via the usb / camera adapter the fn+c combination works fine.

Is the FN key special? Is the usb / camera adapter doing something special?

1

There are 1 best solutions below

0
user1279887 On

It turns out the issue is related to how the usb gadget advertises itself to the iPhone, e.g. the report_desc needs to be same as what a real Apple keyboard sends to the iPhone.