Pinephone Adventures

There are some things I need to get working on my pinephone now that I've got a brand new OS on it.

I'll need to SSH into the phone from another computer to be able to fix the keyboard config - I can't press all the keys I need to be able to!

References:

Step 1: connect pinephone to the wifi with nmtui (i can do this without special characters so I needn't worry about the USB network interface whatsit

Step 2: ssh in. Pinephone's IP is . . . 192.168.0.216 and i log in as root with password root

uh. No route to host. wwhy not.

after i tried pinging it for a little it started working on icmp_seq=4

permission denied. ok i'll log in as alarm

Step 3: update packages

Step 4: Rotate screen and disable kernel keyboard driver

this is done by editing /boot/boot.txt. there's a line that starts with setenv bootargs and u append a couple things to the end of that line:

run the mkscr script in that directory and it updates ur boot thingy. then i rebooted.

screen is rotated :) but keyboard still works? is that? a problem? i was. under the impression it would stop working. i tried the dmesg | grep kb151 from this page and the only message is echoing the bootargs from earlier. i'll try removing the disable command.

ok i still don't see any of the messages from that post. and keyboard still works of course. hm.

Do I? actually need to disable the kernel driver? I just tried to do it because Using Pinephone Keyboard Case with Arch said to. If I look at HazardChem's guide (the thing i used to get the keys working previously), and go into the folder for tty, it says Good news! the keymap for this has been included in the kbd > 2.5.0 package. So um. idk shouldn't it work then? do i have kbd. I try to install it, and yes, i have version 2.6.4-1

what do lol

ok new resource. arch wiki, linux console keyboard configuration. it says run localectl status to view the currnet keyboard configuration. and it says:

System Locale: LANG=en_US.UTF-8
VC Keymap: (unset)
X11 Layout: (unset)

ok so things are unset. good. i can set them then, right? I'm. tired from this, so I'll look at this in a moment.

Several hours later

Step 5: get the keymap working with the kernel driver

I have succeeded in getting the keyboard working properly. The special characters are available like before, by holding the AltG key. I set it by... umm...

The relevant keymap is stored in /usr/share/kbd/keymaps/pine/en.map.gz. In the list of available keymaps which you can see by running localectl list-keymaps, it's just listed as en, which uh. ok. So I've set it temporarily by running sudo loadkeys en.

The function keys work too! Despite megi's blog saying otherwise. There must've been an update. Anyway. No need to go through trying to figure out how to disable the kernel driver, or install the userspace driver.

To set the keymap permenantly, you use the same config file as for the console font, /etc/vconsole.conf, so I'll set both at the same time, once I get this font I want to use.

Step 6: set a nice console font

The default console font is all well and good, but it'ss kinda. I won't say ugly, not while it's looking at me. For one thing, it's small, which can be fixed by running setfont -d or setfont -d default8x16 (-d for double size, doesn't work on all fonts, idk why and the man pages don't wanna say) but um, idk how to set double size in /etc/vconsole.conf and anyway, I want something that looks nicer.

The arch wiki recommends Terminus - which is the font I'm using on my laptop right now, on arch - but I'm going to install a different one. Linux Console Fonts from The ZAP Group Australia. The light version looks nice. I'll have to wait until it's installed to see if I really want it... well, let's get on with it then.

After downloading the archive from that website (version 2.4) I guess I just... copy the *.psf and *.psftx files into the /usr/share/kbd/consolefonts directory?

The download contains a couple utilities. psf2psftx which to Convert binary PSF font to text representation, and psftx2psf to Convert PSFTX text representation to binary format, so I guess that answers what these files are. Yeah I'll just copy them all.

Yep, nice, and if I run setfont zap-light32 on the pinephone...

Hmm. Well, it works! So that's great. Unfortunately it. changes a bunch of characters around. Do I need to configure a "character map" somewhere? Bother. I'll just install terminus for now---

oh fuck, oh shit, terminus changes a bunch of characters as well. this is. i do not like this.

I took photos! With default8x16 and zap-light32 fonts. Different. Why??

You know what, i'm just gonna set zap-light32 as my font and deal with any problems as they occur. That's the non-anxiety way. right

OK so we pop into /etc/vconsole.conf with vim and we enter:

KEYMAP=en #for pinephone keyboard
FONT=zap-light32 #for nice console font

punch sudo reboot and . . . uh, no, the changes didn't take effect. ok.

lol ok the problem was the #comments on the lines, that's not how comments work in this file apparently. go without those and it works fine :)

Step 6: How to check the batteries? To be continued...

The next day

I've found a way to check the batteries. But it's awkward (checking the contents of specific files) so I'll need to write myself a script or something to do that...

...and I realised I wanted to create a kagi user to replace the default alarm user, so I did that.

sudo useradd -m kagi # to create the user
sudo usermod -aG wheel kagi # to be able to use sudo
sudo passwd kagi # to set a password so i can log in
# then finally, logged in as kagi...
sudo userdel -r alarm # to delete the alarm user

I also added kagi to the other groups alarm was in: network, rfkill, video and audio, idk if that's necessary tho.

Right, now for this simple battery checking script.

#!/bin/sh

PINEPHONE_PATH="/sys/class/power_supply/axp20x-battery"
KEYBOARD_PATH="/sys/class/power_supply/ip5xxx-battery"

echo "Pinephone battery:"
cat "$PINEPHONE_PATH/status"
cat "$PINEPHONE_PATH/capacity"

echo "Keyboard battery:"
cat "$KEYBOARD_PATH/status"
cat "$KEYBOARD_PATH/capacity"

Yeah so this works. It gives me an output like this:

Pinephone battery:
Charging
24
Keyboard battery:
Charging
53

And now I can see that the pinephone battery is discharging faster than it's charging! So I'd better turn it off for a bit. :)

Having a command to check the batteries is all well and good, but it would be nice to use the LED as an indicator, I think. It seems as though megi is coming in clutch again with a way to do exactly that, but we'll see won't we. :)

Now if I can find a way to turn the screen off we'll be sorted!

Oh, I put that script I just wrote in $HOME/.bin and made a .profile file with the contents export PATH="$HOME/.bin:$PATH" but, it's not being added to the path. I guess I've missed something.

Update 2024-04-16: It turns out bash wasn't loading my .profile because it already had a .bashprofile. I wasn't using it, so I just deleted it. And now .profile works :)