Max1220's PinePhone Scripts and tweaks

So, I’ve had my PinePhone for a couple of days now.
It’s awesome to be running mainline Linux with a “normal” userland on a phone.
It allows my desktop-Linux knowledge to be applied to my phone.

I’ve written some scripts and utils. They are of course open-source, and I
thought I might share them, as some of them might be useful to others.

Pinemouse

This is implements a toggle-able touchpad mode that works well under any
desktop environment.
While technically not PinePhone specific, it’s written for using more
desktop-like applications that require a proper “relative” input
device(application that capture the mouse, e.g. FPS games)

A trackpoint(“Thinkpad nipple”) mode is currently in the works.

In the future this script(or an ancestor of it) might also emulate keyboard
events, and provide basic universal onscreen touch-controls.

This could be extended to a full virtual keyboard when I figure out how to
draw an overlay over all desktop environments.

You currently need to install
Lua(most versions will do, Lua5.1 is easiest),
and two of my libraries:
lua-input and
lua-time.

For usage, see the README.md on github.

Demo video of running an application that captures the mouse(AssaultCude):

This also combines great with docked mode, as you don’t need a mouse anymore
to make effective use of another monitor, a keyboard suffices.

MyThumb

If you’re familiar with DriveDroid on Android, this is basically that implemented in bash.
if you’re not, Linux supports running as a USB device(presumably attached to another computer), and allows emulating a USB Mass Storage device(like a thumbdrive).
You can provide a filesystem image and use the PinePhone as a USB stick, e.g. to boot a computer. Allows for CDROM emulation.

The functionality was adapted from https://git.sr.ht/~martijnbraam/thumbdrives, and you should use that version if you’re comfortable compiling it or your distro includes it.

You need kernel support for this. Make sure to enable: CONFIG_CONFIGFS_FS , CONFIG_USB_F_MASS_STORAGE , CONFIG_USB_CONFIGFS and CONFIG_USB_CONFIGFS_MASS_STORAGE

Tweaks

Some things that I found useful on my pinephone.

  • I just figured out that you can make the phone/docked mode toggle always available if you set your machine type to something other than handset(the default):
    sudo hostnamectl set-chassis convertible
    
  • I’ve had issues with the ondemand CPU governor and really bad USB ethernet performance.
  • If you have a 3.5mm “headphone”/“aux” cable you can use the PinePhone hardware serial console. Combines well with a USB serial adapter to debug boot messages. You can also use this as a 3.3v serial port for talking to uC, I guess…

Use at your own risk!

Any questions, suggestions etc. welcome!

4 Likes

So, today I’ve implemented Multitouch proxy support.

What does that mean, and why did we need it?
Multitouch proxy means that events that aren’t handled by a screen region belonging to the program(not a button or touchpad) are forwarded to another device(to a new virtual touchscreen).

This is done in a special way:
Only if the first finger position(where the user touched initially) belongs to our region, send all further events(regarding this finger) to out region.
If the initial finger position was not in out region, always send the input events to the proxy device.

This has the advantage that I can create small controls, that only react if they are actually touched, not just have a finger move into them.

This is required for the “virtual trackpoint mode” where only a small region is initially sensitive to touch, but if you move out of this region it should still get events and not proxy them(even though the finger position is now on the proxy area).

I hope people get what I mean. I might create a video later…

As a bonus: I’ve implemented force-feedback support, so button presses/releases now should create a small vibration.

4 Likes

I would like to suggest some performance changes. Mostly basic Linux stuff users change on a normal install.

vm.swappiness, check the value with

cat /proc/sys/vm/ find the vm.swappiness with tab completion and cat the path.

You can change the value with echo, to the proc sys vm blah blah path, and set it in etc/sysctl.conf

Downclocking the arm processor in the cellular modem

downclocking the gpu side of the soc

downclocking ram

Temporarily toggling file access times, modifying how frequently writes are written, and even turning off hournaling.

On that note, using F2FS. Flash-friendly filesystem

Changing the display refresh rate to 24hz or lower to reduce gpu processing

I’ve been using Linux for a long time, but haven’t learned a significant amount about the more advanced areas, so I’m sure yhere are more changes that could make a big difference.