megi's PinePhone Development Log RSS

Surgenons in Gaza Surgeons in Gaza

2022–01–22: Pinephone Keyboard – kernel driver merged

I have updated Samuel's WIP driver that the distros started using to make it work with his IP5209 charger driver on the final production keyboard. The result is now merged into my kernel tree and works on both Pinephone and Pinephone Pro.

This also means, that keyboard battery voltage and current can now be read from sysfs. You don't need to use my userspace tools for that anymore.

I've also updated the drivers to make them report probe errors, and improved the charger driver to make it not fail when the charger is asleep during boot. You still have to wake the charger up by pressing the button on the side of the keyboard before being able to access it via sysfs.

You can run:

dmesg | grep kb151

to see if the keyboard driver is functioning properly. If you see any errors there, you may have a bad physical connection between the phone and the keyboard. You can try improving the connection, and rebooting the phone.

You may see for example:

[    0.388320] kb151 5-0015: Found KB151 with firmware 1.0 (features=0xf)
[    0.916089] kb151 5-0015: Charger is initialized

or

[    0.828521] kb151 2-0015: KB151 was not detected on the bus (-6)

If you want to run ppkb-i2c-inputd, just add kb151.disable_input option to kernel boot arguments to disable the kernel driver. Kernel driver handles Fn layer differently from the userspace daemon. With userspace daemon, pressing Fn+~ or Fn+- will really write out those characters to the console. Userspace driver also has Pine Key layer, which can be used to invoke function keys. Kernel driver doesn't have ability to invoke F1 - F10 keys in any way directly.

Enjoy!