/PPKeyboard_How_to_Install

This is the installation procedure for the PinePhone keyboard driver.Please feel free to use it.

Primary LanguageMakefile

PinePhone Keyboard Driver Installation for Mobian

Rev 1.1



Preface

This article is written for Mobian.
Please note that it has not been tested on other Linux distributions.


1. Install PinePhone Keyboard Driver

Install the libraries necessary to install the keyboard driver.

sudo apt install sdcc php

Download the source code from the dedicated keyboard driver Github.

git clone -b master https://megous.com/git/pinephone-keyboard
cd pinephone-keyboard

Edit the driver's Make file.
If you also want to install ppkb-i2c-selftest, uncomment "$(OUT)ppkb-i2c-selftest" at the bottom of the make file.

# Before editing
all:$(OUT)ppkb-i2c-inputd $(OUT)ppkb-usb-flasher $(OUT)ppkb-usb-debugger $(OUT)fw-stock.bin $(OUT)ppkb-i2c-debugger $(OUT)ppkb-i2c-charger-ctl $(OUT)ppkb-i2c-flasher $(OUT)ppkb-i2c-selftest

# After editing
all:$(OUT)ppkb-usb-flasher $(OUT)ppkb-usb-debugger $(OUT)fw-stock.bin $(OUT)ppkb-i2c-debugger $(OUT)ppkb-i2c-charger-ctl $(OUT)ppkb-i2c-flasher $(OUT)ppkb-i2c-inputd $(OUT)ppkb-i2c-selftest

If you can't be bothered to edit it,
you can use the Make file in this repository of mine.

git clone https://github.com/presire/PPKeyboard_How_to_Install.git
cp -f PPKeyboard_How_to_Install/Makefile  pinephone-keyboard/

Build and install the driver for the dedicated keyboard.
Don't forget to put a / (slash) at the end of the installation directory.

make -j $(nproc) OUT=/<keyboard driver installation directory>/ all

If ppkb-i2c-inputd is not installed, execute the following command.
Similarly, Don't forget to put a / (slash) at the end of the installation directory.

make -j $(nproc) OUT=/<keyboard driver installation directory>/ \
                 $(OUT)ppkb-i2c-inputd



2. Enabling the PinePhone keyboard

For Mobian, you need to enable the dedicated keyboard.

cd <keyboard driver installation directory>
sudo ./ppkb-i2c-inputd

It is also recommended to create a desktop entry file in the ~/.config/autostart directory to automatically enable the keyboard.

vi ~/.config/autostart/PPKeyBoardStart.desktop

# ~/.config/autostart/PPKeyBoardStart.desktop file

[Desktop Entry]
Type=Application
Name=Keyboard
Icon=/<keyboard driver installation directory>/PPKeyBoardStart.png
Exec=/<keyboard driver installation directory>/PPKeyBoardStart.sh
Categories=Utility;
NoDisplay=true

Create a shell script.

vi /<keyboard driver installation directory>/PPKeyBoardStart.sh

# /<keyboard driver installation directory>/PPKeyBoardStart.sh file

#!/usr/bin/env bash

appname="ppkb-i2c-inputd"

# use -f to make the readlink path absolute
dirname="$(dirname -- "$(readlink -f -- "${0}")" )"

if [ "$dirname" = "." ]; then
   dirname="$PWD/$dirname"
fi

cd $dirname

# Run ppkb-i2c-inputd binary
echo "<OS Password>" | sudo -S "$dirname/$appname"

Add execution privileges to shell scripts.

chmod u+x /<keyboard driver installation directory>/PPKeyBoardStart.sh

Restart Mobian.

sudo systemctl reboot



3. Enabling and Disabling the Screen Keyboard

If you do not need the screen keyboard, execute the following command.

gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false

If you need a screen keyboard, run the following command.

gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true



4. Charge of a special keyboard

The PinePhone keyboard charges the PinePhone at 500[mA] by default.
For example, to change it to 1500[mA], edit as follows.

sudo vi /sys/class/power_supply/axp20x-usb/input_current_limit

# /sys/class/power_supply/axp20x-usb/input_current_limit file

1500000