home home about about blog blog music music tech tech photos photos art art photoshop photoshop
blog post
back to blog main

my pocketchip experience in 2024

2024-03-30 @ 23:31 UTC
filed under: tech

pocket chip with neofetch

i got a next thing co pocketchip sometime around 2017 second-hand from a friend who had ordered and (luckily, seeing as the company went under before fulfilling all orders) received his but ended up no longer wanting it. i've played with it on and off quite fondly since, and i've recently unearthed it and done a bunch of upgrades to it, so i figured i would write a post about it. a lot of it is from all over since 2017 to today so it's not really chronologically coherent

things i've done with it

for most of its life, i've actually had the pocketchip plugged in and running 24/7 as a desktop ornament. i had a portal set up in my LAN (open to the internet for others to play with, even) for a period of time which allowed you to write, save and compile processing sketches to run on the pocketchip. the sketches would compile to java on my home server not to put the load on the pocketchip (which would take a lot longer and slow down a sketch already in progress) and the whole thing ran on a NFS mount so the NAND wouldn't be constantly written to. the sketches would then continuously run on my pocketchip on my desk as a sort of a "demo screen" or a "permanent screen saver"

at one point doing this the pocketchip had achieved an uptime of over a year. wow!

beyond that the usual putting games and emulators on it was standard practice. did you know zep still updates pico8 for the pocket chip to this day?

pocket chip running dos game hocus pocus

hardware mods

the easiest one of them is improving the keyboard. i've lusted over the 3d printed "mechanical" keyboard cover since the first time i saw it, but at the time i didn't have access to a 3d printer large enough to print the whole cover. i tried printing some of the keys with the 3d printer i did have access to at the time, but they came out poorly and i gave up on the idea of trying to print the rest in smaller parts to fit. instead, following an idea i saw somewhere else (probably on the now-defunct next thing co BBS, and i don't remember who came up with it first), i instead took the lo-fi approach of just taping rubber furniture bumpers on each key. the added height gives more tactility and leverage to pushing the buttons, and it's a surprisingly simple way to make it easier to type on it. also you can choose colors!

pocket chip with bumper keys

next i wanted to add a built-in speaker to the pocket chip. this is a rather simple mod that next thing co themselves featured in a blog post. i really like this because this really pushed the pocketchip as a hacker's toy. everything was easily accessible and encouraged to be modified. anyway, my mod isn't any different from the way it's laid out in that post, only when i first did this i used a spare headphone driver which was too big to fit inside the shell so for years my pocketchip had an unwieldy speaker hanging off wires on the back until this week i finally dug out a dead laptop and liberated one of its smaller speakers to properly build it into the pocketchip's case. it sounds better, too!

pocketchip with sound mod pocketchip with laptop speaker

about a month ago, when i went to dig out the pocketchip after it had sat unused for a number of months, i unfortunately found the screen to have suffered some kind of electrical damage. (interestingly enough, even with a dead battery, i never got the dead NAND issues other people have reported. my system booted up just as i left it months prior. and after charging, my battery still holds charge for several hours of play! yay!). i wasn't sure if this was actually an issue with the panel itself or the driving circuit in the chip (which uses a direct RGB connection from the chip to the panel, so if it was in the chip i would have to source a whole replacement for a discontinued part, which sucks).

pocketchip with distorted colors

on a whim, i decided to bite the bullet and replace the LCD panel, upgrading it in the process. thankfully, this proved it was indeed the panel! and once i set up the necessary changes in xorg.conf for the higher resolution, the new IPS panel looked brilliant. the color reproduction and the resolution really make the pocketchip shine. i wish they had used this panel in the first place all those years ago, but the cost would've probably been prohibitive.

pocketchip with new screen

software stuff

this is the big one. the main reason i wanted to write this post was to more or less document my findings since upgrading to mainline kernel 5.14. the chip was originally stuck on 4.4 as this was the kernel compiled by next thing co before going bankrupt, however in recent years many of the patches necessary to run the chip hardware, including the dips and pocketchip, have been merged into the mainline kernel, meaning that little to no customization needs to be done to compile newer kernels for the pocketchip.

so you've flashed your pocketchip with debian 11 on kernel 5.14. now what? if you have an upgraded screen like mine, first you'll need to update the xorg.conf. the screen will still be in the wrong resolution outside X and running it at the wrong resolution for long periods of time can cause a slight burn-in around the vertical sync that shouldn't be normally displayed, but when i experienced this it went away after leaving the panel off for a while [update: if you can edit the device-tree for the pocketchip "dip", swap the compatible line of the panel from "olimex,lcd-olinuxino-43-ts" to "innolux,at070tn92"]. once X was properly set up, the length of the boot until destkop was not enough to cause this burn-in anymore. to calibrate the touchscreen on this new kernel i had to compile xlibinput_calibrator. the old xinput-calibrator no longer generated the correct xorg lines for this version

as for a desktop interface, on 4.4 i was using jwm with this custom jwmrc specific for pocketchip. the same person also made a new service for the battery to replace the stock one, but on 5.14 this is no longer necessary as the battery gets recognized as a /sys/class device rather than raw i2c. i've forked a version of the jwmrc with a new pocketchip-xbatt to read the /sys/class device instead. you will need to furnish your own way to warn on low battery however, and since the axp20x reports raw state of charge of the battery, i've found that the pocketchip will brown out at around 30%, since 0% is relative to the battery and not the operating voltage of the chip. [update: to improve this, you can set the minimum voltage for example to 3.2v instead: echo "3200000" | sudo tee /sys/class/power_supply/axp20x-battery/voltage_min_design]

the new kernel sets the built-in keyboard via xkb, but for some reason i couldn't get this to work. to set my keyboard, i copied this .Xmodmap to my home and added the line xmodmap .Xmodmap to ~/.xsessionrc. i also use that file to set the internal speaker to enable (with amixer sset commands), since ALSA doesn't automatically save settings and otherwise the audio would start muted

to enable the new lima mesa drivers, you just need to install mesa. you need to make sure xorg is initializing the display on card1 in order to get DRI support (this threw me for a loop for a while as on 4.4 xorg would default to card0 instead). to enable sound, you just need to install ALSA. i haven't tried the headphone jack yet [update: it uses the same output as the internal speaker, so if you plan on using headphones you will need a hardware switch to turn the speaker off while still being able to use the headphone jack.] but for the internal speaker on 5.14 you need to unmute 'Power Amplifier DAC' and 'Power Amplifier Mute', then you can set the speaker volume with 'Power Amplifier'. this differs a little from how it is in the 4.4 version

for the backlight, you need to chown /sys/class/backlight/backlight/brightness to the group video and add your user to that group

the wifi seems to be a little temperamental to connect, taking long and randomly failing sometimes. this seems to be mostly because on the current build of kernel 5.14 the included rtl8723bs driver is an unstable staging one. i've found this NetworkManager setting and this workaround which replaces wpa_supplicant with iwd to help.

to replace vala-terminal, pcmanfm and leafpad with newer and readily available packages on debian 11, i'm using lxterminal, spacefm and mousepad which seem to work brilliantly. surf is still actively maintained.

in terms of games, currently i've tried pico8 as mentioned before on the new kernel, and mednafen seems to be the emulator that performs the best on the pocketchip as well as being conveninent in emulating multiple systems. to make mednafen work better, i've made a few changes to increase audio buffer size, set the sample rate to 22050 and force unfiltered integer scaling on the video

in closing

every now and then i see people asking if the pocketchip is still useful in 2024. i think it's as useful as it was when it launched, if not more with updated software. the usefulness really depends on what you want to do with it and to me it was never more than a linux toy. in that regard, even older linux SBCs can still be useful today, it really is just a matter of perspective. personally i'm very glad to have gotten mine to a working and upgraded state after this whole time and i'd like to see more of these devices, the ones still surviving in the wild, continue being used

<- solving a base64 mystery nobody asked for