Using Keyboard Case with Arch (DanctNix) (complete instructions)
#1

I recently installed Megi's userland keyboard driver on the PinePhone running Mobian. What I really wanted to do was get my pinephone and keyboard case running as a mini-computer with a CLI (no GUI). I discovered DanctNIX barebones Arch Linux image and finally got the userland driver running on that also. So this is a complete list of steps required to do so. You can find all of this information in various places, but I'm hoping it's handy to have it all in one location for someone...

1. Fix the keyboard case's pogo pads

First, the hardware of the keyboard needs to be hacked a bit. It won't work out-of-box. Locate the Pogo pin pads in the back cover of the new keyboard case where the phone's pogo pins are supposed to make contact. The pogo pads on the keyboard case will not make contact with the pogo pins on the back of the phone unless you do something to raise the pads. 

I carefully pried the plastic holding the pogo pads from the back of the case and slipped a small folded strip of paper beneath them. The plastic holding the pads is glued to the case (which will be the new back of the phone case) and can be pried away carefully. There were no screws in my keyboard case holding the pogo pads.

reference https://xnux.eu/pinephone-keyboard/faq.html#ts in the troubleshooting section at the bottom.

2. Install Arch Linux

Arch Linux ARM builds for pinephone (and PPPro and other devices) are located here: https://github.com/dreemurrs-embedded/Pi...h/releases The latest versions include kb151, the i2c keyboard driver needed by the pinephone's keyboard case. I installed the barebones version which merely boots to a tty and the rest of these instructions are specifically for CLI.

I used the Jumpdrive method which is documented here: https://wiki.pine64.org/wiki/PinePhone_I..._JumpDrive

Connect to your local WIFI...
$nmtui

Select Activate Connection, then select your WIFI and enter password. You can use the arrow keys to move around the TUI (FN+> is UP, FN+{ is DOWN, FN+" is LEFT, and FN+} is RIGHT).

Determine your pinephone's IP address...
$ip a

Look for the ip address for the WLAN0 network connection.

For simplicity, SSH into your pinephone from a linux PC (x.x.x.x is the ip address of your pinephone)...

$ssh alarm@x.x.x.x

Update and upgrade with the following:
$ sudo pacman -Syu

Install some stuff you'll need...
$ sudo pacman -S nano terminus-font git gcc php make

3. Rotate the screen and increase font size

Still SSH'ing into your pinephone...
$ cd /boot
$ sudo nano boot.txt

Locate the line starting with setenv bootargs... This is a list of kernel parameters. Append the following to the end of the list (include a single space to separate it from the prior parameter). The fbcon parameter will rotate your screen 90 degrees clockwise putting it in landscape mode and the kb151 parameter will effectively disable kb151 so we can use the userland driver, which we'll install later. (if you're entering all this from the pinephone keyboard case, don't do the kb151 parameter yet, or make sure you finish everything before rebooting).

fbcon=rotate:1 kb151.disable_input

(Megi added a second fbcon parameter to set the font, but I wasn't able to get this to work, so I added it to the system-wide bash script, which we'll get to in a second....)

To save changes and close Nano, type CTRL-X, Y, and Enter.

back on the command line, run the following to update the boot.scr file from boot.txt...

$ sudo ./mkscr

Reference https://xnux.eu/log/#058 regarding disabling kb151; I tried a couple other methods, but only this one worked.

Add a setfont step to the system wide bash login script /etc/bash.bashrc...

$ sudo nano /etc/bash.bashrc

Add the following line at the end of the file to change the tty font to Terminus c32n (or whatever you like)...

setfont ter-c32n

To save changes and close Nano, type CTRL-X, Y, and Enter.

4. Download, build, and install the userland driver

$ git clone https://mff.cz/git/pinephone-keyboard/
$ cd pinephone-keyboard
$ make

Now we write the systemd unit file...

$ sudo nano /etc/systemd/system/ppkb-i2c-inputd.service

Enter the following into this new .service file...

  [Unit]
  Description=Pinephone Keyboard Service Daemon

  [Service]
  Type=simple
  ExecStart=/home/mobian/pinephone-keyboard/build/ppkb-i2c-inputd

  [Install]
  WantedBy=multi-user.target

To save changes and close Nano, type CTRL-X, Y, and Enter.

Now we enable this service the next time we boot with ...

$ sudo systemctl enable ppkb-i2c-inputd.service

Reference https://wiki.mobian-project.org/doku.php...-case-ppkc regarding runningn this userland driver as a systemd service.

5. Reboot and test

You're done.

$ sudo reboot

When the system reboots, it will still load kb151, but that driver will be disabled. The systemd service ppkb-i2c-inputd will be loaded by systemd and be the driver for the new keyboard case.

Use the Pine key (pinecone symbol) with number keys to enter FN keys. Try it out by typing CTRL-ALT-PINE-2 to switch to tty2 and then CTRL-ALT-PINE-1 to switch back to tty1 which is the default tty.
  Reply
#2
Just a reminder that step 4 can be replaced with "install ppkb-tools package and then enable the systemd service".
Find me in the forest, when I'm at my lowest. I don't really think you should continue..

HOLD YOUR BREATH.
  Reply
#3
(02-25-2022, 01:54 AM)Danct12 Wrote: Just a reminder that step 4 can be replaced with "install ppkb-tools package and then enable the systemd service".

Thanks to both of you.  Unfortunately though, my keyboard doesn't work at all now!  Have I missed something?

I started with a fresh arch phosh, updated it (keyboard worked at this stage).  Installed ppkb-tools via pacman, enabled the service, rebooted.  But now nothing at all from the keyboard, except the charging.

Ideas appreciated Smile

(Pinephone OG, first CE after Braveheart)
  Reply
#4
Mind posting a photo of your shims? When I shimmed the keyboard, it stopped working on my Pro but started working on my PinePhone (though only the keyboard, no charging). So I would like to see what a successful shim looks like for reference.
  Reply
#5
(02-25-2022, 07:37 AM)vgnmnky Wrote:
(02-25-2022, 01:54 AM)Danct12 Wrote: Just a reminder that step 4 can be replaced with "install ppkb-tools package and then enable the systemd service".

Thanks to both of you.  Unfortunately though, my keyboard doesn't work at all now!  Have I missed something?

I started with a fresh arch phosh, updated it (keyboard worked at this stage).  Installed ppkb-tools via pacman, enabled the service, rebooted.  But now nothing at all from the keyboard, except the charging.

Ideas appreciated Smile

(Pinephone OG, first CE after Braveheart)

I'm not familiar with ppkb-tools. That sounds like if would have made things easier. But I know from experience that you can't have both the userland driver AND kb151 at the same time or the keyboard won't work. So perhaps you need to add "kb151.disable_input" to your boot.scr. Step 3 shows how to modify kernel parameters to do this.
  Reply
#6
(02-25-2022, 09:08 AM)ragreenburg Wrote: Mind posting a photo of your shims? When I shimmed the keyboard, it stopped working on my Pro but started working on my PinePhone (though only the keyboard, no charging). So I would like to see what a successful shim looks like for reference.

I think this comes down to raising the 6 pogo pins and I apologize for my reluctance to undo my shim and redo it, but I will describe what I did as best as I can.

First, carefully pry the circled area away from the case. It is secured with glue and will pry away. Do it slowly, being sure not to break the plastic. It only needs to be pried away enough to slide a piece of paper folded a couple of times so that the paper shim can be slid from the right side back beneath the pogo pads on the far left so that all pogo pads are raised.

   

I cut a strip of paper that was narrower than the blue lines, which it will need to slide between (from the right side of the pogo pads). I folded this small strip of paper twice, so it was 4x thickness and about the size of the pogo pads. Then I slid it under the pogo pads from the right side, sliding between the two raised plastic pieces that surround the pogo pad plastic and angling it 'north'.

Here's a pic from an angle that is supposed to show how the plastic holding the pogo pads is now warped by the shim beneath it, forcing the pogo pads away from the back of the case to make better contact with the pogo pins on the back of the phone.

   
  Reply
#7
(02-25-2022, 09:12 AM)Megamemnon Wrote:
(02-25-2022, 07:37 AM)vgnmnky Wrote:
(02-25-2022, 01:54 AM)Danct12 Wrote: Just a reminder that step 4 can be replaced with "install ppkb-tools package and then enable the systemd service".

Thanks to both of you.  Unfortunately though, my keyboard doesn't work at all now!  Have I missed something?

I started with a fresh arch phosh, updated it (keyboard worked at this stage).  Installed ppkb-tools via pacman, enabled the service, rebooted.  But now nothing at all from the keyboard, except the charging.

Ideas appreciated Smile

(Pinephone OG, first CE after Braveheart)

I'm not familiar with ppkb-tools. That sounds like if would have made things easier. But I know from experience that you can't have both the userland driver AND kb151 at the same time or the keyboard won't work. So perhaps you need to add "kb151.disable_input" to your boot.scr. Step 3 shows how to modify kernel parameters to do this.

Sorted!  In my haste, I missed those steps.

I've now edited the boot.txt filed, did sudo ./mkscr, rebooted, and it works.

The output of the number row with fn or shift is now correct (if I use US keyboard in settings), and Pine+F1-F10 seems to work fine too.  Hurrah! 

Just need to set it so my scaling and virtual keyboard settings aren't forgotten on reboot, and then I can properly start making use of this thing.

Thanks again.
  Reply
#8
(02-25-2022, 10:18 AM)Megamemnon Wrote:
(02-25-2022, 09:08 AM)ragreenburg Wrote: Mind posting a photo of your shims? When I shimmed the keyboard, it stopped working on my Pro but started working on my PinePhone (though only the keyboard, no charging). So I would like to see what a successful shim looks like for reference.

I think this comes down to raising the 6 pogo pins and I apologize for my reluctance to undo my shim and redo it, but I will describe what I did as best as I can.

First, carefully pry the circled area away from the case. It is secured with glue and will pry away. Do it slowly, being sure not to break the plastic. It only needs to be pried away enough to slide a piece of paper folded a couple of times so that the paper shim can be slid from the right side back beneath the pogo pads on the far left so that all pogo pads are raised.



I cut a strip of paper that was narrower than the blue lines, which it will need to slide between (from the right side of the pogo pads). I folded this small strip of paper twice, so it was 4x thickness and about the size of the pogo pads. Then I slid it under the pogo pads from the right side, sliding between the two raised plastic pieces that surround the pogo pad plastic and angling it 'north'.

Here's a pic from an angle that is supposed to show how the plastic holding the pogo pads is now warped by the shim beneath it, forcing the pogo pads away from the back of the case to make better contact with the pogo pins on the back of the phone.

Thank you for the pictures! When I tried pushing the paper underneath that pin pad I got a lot of resistance and didn't want to push any farther because I thought there was a ribbon cord there(?) and didn't want to brick the keyboard. Is there anything under the pin pad to keep an eye out for?
  Reply
#9
(02-25-2022, 12:05 PM)ragreenburg Wrote: Thank you for the pictures! When I tried pushing the paper underneath that pin pad I got a lot of resistance and didn't want to push any farther because I thought there was a ribbon cord there(?) and didn't want to brick the keyboard. Is there anything under the pin pad to keep an eye out for?

I believe the resistance you are encountering is the glue. I was able to raise the plastic tab holding the pogo pads enough to slide a piece of paper all the way under the left-most pogo pads. So I believe the ribbon extends from the left of the pogo pads, not from directly beneath them.
  Reply
#10
(02-24-2022, 08:51 PM)Megamemnon Wrote:
I recently installed Megi's userland keyboard driver on the PinePhone running Mobian. What I really wanted to do was get my pinephone and keyboard case running as a mini-computer with a CLI (no GUI). I discovered DanctNIX barebones Arch Linux image and finally got the userland driver running on that also. So this is a complete list of steps required to do so. You can find all of this information in various places, but I'm hoping it's handy to have it all in one location for someone...

1. Fix the keyboard case's pogo pads

First, the hardware of the keyboard needs to be hacked a bit. It won't work out-of-box. Locate the Pogo pin pads in the back cover of the new keyboard case where the phone's pogo pins are supposed to make contact. The pogo pads on the keyboard case will not make contact with the pogo pins on the back of the phone unless you do something to raise the pads. 

I carefully pried the plastic holding the pogo pads from the back of the case and slipped a small folded strip of paper beneath them. The plastic holding the pads is glued to the case (which will be the new back of the phone case) and can be pried away carefully. There were no screws in my keyboard case holding the pogo pads.

reference https://xnux.eu/pinephone-keyboard/faq.html#ts in the troubleshooting section at the bottom.

2. Install Arch Linux

Arch Linux ARM builds for pinephone (and PPPro and other devices) are located here: https://github.com/dreemurrs-embedded/Pi...h/releases The latest versions include kb151, the i2c keyboard driver needed by the pinephone's keyboard case. I installed the barebones version which merely boots to a tty and the rest of these instructions are specifically for CLI.

I used the Jumpdrive method which is documented here: https://wiki.pine64.org/wiki/PinePhone_I..._JumpDrive

Connect to your local WIFI...
$nmtui

Select Activate Connection, then select your WIFI and enter password. You can use the arrow keys to move around the TUI (FN+> is UP, FN+{ is DOWN, FN+" is LEFT, and FN+} is RIGHT).

Determine your pinephone's IP address...
$ip a

Look for the ip address for the WLAN0 network connection.

For simplicity, SSH into your pinephone from a linux PC (x.x.x.x is the ip address of your pinephone)...

$ssh alarm@x.x.x.x

Update and upgrade with the following:
$ sudo pacman -Syu

Install some stuff you'll need...
$ sudo pacman -S nano terminus-font git gcc php make

3. Rotate the screen and increase font size

Still SSH'ing into your pinephone...
$ cd /boot
$ sudo nano boot.txt

Locate the line starting with setenv bootargs... This is a list of kernel parameters. Append the following to the end of the list (include a single space to separate it from the prior parameter). The fbcon parameter will rotate your screen 90 degrees clockwise putting it in landscape mode and the kb151 parameter will effectively disable kb151 so we can use the userland driver, which we'll install later. (if you're entering all this from the pinephone keyboard case, don't do the kb151 parameter yet, or make sure you finish everything before rebooting).

fbcon=rotate:1 kb151.disable_input

(Megi added a second fbcon parameter to set the font, but I wasn't able to get this to work, so I added it to the system-wide bash script, which we'll get to in a second....)

To save changes and close Nano, type CTRL-X, Y, and Enter.

back on the command line, run the following to update the boot.scr file from boot.txt...

$ sudo ./mkscr

Reference https://xnux.eu/log/#058 regarding disabling kb151; I tried a couple other methods, but only this one worked.

Add a setfont step to the system wide bash login script /etc/bash.bashrc...

$ sudo nano /etc/bash.bashrc

Add the following line at the end of the file to change the tty font to Terminus c32n (or whatever you like)...

setfont ter-c32n

To save changes and close Nano, type CTRL-X, Y, and Enter.

4. Download, build, and install the userland driver

$ git clone https://mff.cz/git/pinephone-keyboard/
$ cd pinephone-keyboard
$ make

Now we write the systemd unit file...

$ sudo nano /etc/systemd/system/ppkb-i2c-inputd.service

Enter the following into this new .service file...

  [Unit]
  Description=Pinephone Keyboard Service Daemon

  [Service]
  Type=simple
  ExecStart=/home/mobian/pinephone-keyboard/build/ppkb-i2c-inputd

  [Install]
  WantedBy=multi-user.target

To save changes and close Nano, type CTRL-X, Y, and Enter.

Now we enable this service the next time we boot with ...

$ sudo systemctl enable ppkb-i2c-inputd.service

Reference https://wiki.mobian-project.org/doku.php...-case-ppkc regarding runningn this userland driver as a systemd service.

5. Reboot and test

You're done.

$ sudo reboot

When the system reboots, it will still load kb151, but that driver will be disabled. The systemd service ppkb-i2c-inputd will be loaded by systemd and be the driver for the new keyboard case.

Use the Pine key (pinecone symbol) with number keys to enter FN keys. Try it out by typing CTRL-ALT-PINE-2 to switch to tty2 and then CTRL-ALT-PINE-1 to switch back to tty1 which is the default tty.
I made good use of your post, thanks for putting it up. However, two things in
Step 3 didn't work for me:

3. Rotate the screen and increase font size.

  The cmd to update boot.scr...

  X $ sudo ./mkscr (didn't work)

    $ sudo pp-uboot-mkscr (did work)


  The cmd to change the font...

    Editing /etc/bash.basrc

  X $ sudo nano /etc/bash.bashrc (didn't work)

    The FONT variable in /etc/vconsole.conf is used to set the font at boot,
    persistent for all consoles.

      $ sudo nano /etc/vconsole.conf (did work)

        FONT=ter-c32n
        FONT_MAP=8859-2
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sales & shipping issues for PinePhone keyboard gsteenss 2 610 08-12-2022, 12:27 PM
Last Post: kat22
Bug PinePhone keyboard case renders itself brick failing to charge(?), help/input wanted e1337 1 149 08-12-2022, 09:12 AM
Last Post: e1337
  Case for Pinephone totilele 10 466 08-07-2022, 08:37 AM
Last Post: biketool
  Keyboard drawing only 0.1A from charger qwazix 5 1,390 08-01-2022, 03:25 PM
Last Post: magdesign
  Convert Pinephone Keyboard into Powerbank magdesign 4 543 07-31-2022, 03:56 AM
Last Post: magdesign
  PP Keyboard question drh 3 340 07-24-2022, 02:15 AM
Last Post: grump_fiddle_reinstall
  Update the PinePhone keyboard driver to support missing characters? Peter Gamma 3 473 07-13-2022, 10:40 AM
Last Post: Hook
  Should I just never use the PP keyboard? Subsentient 4 522 07-10-2022, 02:55 PM
Last Post: alienklown
  KB: Using bus powered USB peripherals with the pinephone keyboard mounted docsunset 5 435 06-30-2022, 10:46 AM
Last Post: docsunset
  Convergence docking bar and keyboard pifou 4 988 06-23-2022, 04:40 AM
Last Post: wibble

Forum Jump:


Users browsing this thread: 1 Guest(s)