mobile-nixos icon indicating copy to clipboard operation
mobile-nixos copied to clipboard

PinePhone functionality

Open Luflosi opened this issue 2 years ago • 20 comments

Since I am now using my PinePhone as my daily driver, I thought it would be a good idea to document what functionality works and what does not. Not everything here is specific to Mobile NixOS, there is also some hardware-specific stuff.

If you see that something is not working for me but you got it working, please tell me in the comments. Conversely, if something is not working for you but it is for me, don't hesitate to ask.

I will edit this issue as I learn more things and get things working.

The date in brackets indicates when I last tested this.

Working:

  • Display (May 2025)
  • Touch screen (May 2025)
  • RGB LED (May 2025)
  • Flashlight (May 2025)
  • Volume buttons (May 2025)
  • Front camera photos (May 2025)
  • Rear camera photos (2022)
  • Modem (May 2025)
  • WiFi [^wifi] (May 2025)
  • iwd (mostly) (Jan 2024)
  • ~~Phone calls~~ (no longer working)
  • Firefox ~~with mobile optimizations~~ [^firefox]
  • Btrfs as root FS (May 2025)
  • LUKS encrypted root FS (May 2025)
  • Audio via PulseAudio (Mar 2025)
  • Audio via PipeWire (May 2025)
  • Audio to Bluetooth headphones (May 2025) [^bluetooth_headphones]
  • Audio to loud speaker (May 2025)
  • Audio to ear piece (May 2025)
  • Audio via 3.5mm audio jack (2024)
  • System takes the correct time from RTC on boot (May 2025)
  • Receiving SMS (May 2025)
  • Phosh (May 2025)
  • WayDroid (May 2025) [^waydroid]
  • GPS (sort of) (May 2025) [^gps]
  • Screen autorotation (May 2025)
  • NTP with timesyncd (May 2025)
  • Video playback with livi (May 2025)
  • Video playback with Clapper (May 2025)

Not working:

  • Phone calls
  • Bluetooth microphone (May 2025)
  • Silent boot (May 2025) [^silent_boot]
  • Sending SMS (2023)
  • Video recording with the cameras (May 2025)

Problems:

  • Everything is Sloooooow [^slow]
  • Many USB-C plugs don't stay in the port securely because of bad hardware design [^usb-c]
  • Terrible battery life
  • Have to enter decryption key two times on boot [^decryption_two_times]
  • Frequent application crashes
  • WLAN 802.11n (2.4GHz) only
  • Phone calls are too quiet
  • WLAN sometimes thinks it's still connected when it is not
  • Screen does not automatically turn off while calling and putting the phone against the ear
  • iwd deletes eduroam config on service restart
  • Screen delaminated for me after less than one year and the touch functionality broke, requiring a screen replacement
  • When connecting bluetooth headphones, the audio output does not automatically switch over
  • If the screen turns on (and the phone is locked) it will stay on for multiple minutes or however long is set in posh as the normal screen-on time
  • If you touch the screen while trying to lock the phone, the phone will become locked but the screen will turn on again
  • Listening to music while the WLAN is connected is not a good experience [^bluetooth_wlan]
  • Sometimes pressing the power button does not turn on the screen. After waiting a few minutes, it works again
  • After unlocking the phone for the first time after booting, I have to enter the PIN again to unlock the keyring
  • The WiFi password of the hotspot functionality keeps changing
  • Sometimes pressing the volume up button actually increases the volume. I think this is a hardware problem where the volume rocker is not designed well
  • The Phone doesn't charge if you plug it in while it's suspended
  • Depending on the charger, there can be a long delay (several seconds) between plugging in the charging cable to the phone realizing that it's being charged
  • Sometimes when waking from suspend, the screen repeatedly flashes on for a brief moment and then turns off again. If the phone is connected via WiFi, SSH works but I don't know how to get out of this broken state without rebooting the phone
  • Using kexec (the default) breaks the following:
    • Camera no longer works
    • Video playback (with livi or Clapper) no longer works

[^wifi] When walking around the house, the signal strength can of course be very poor if I'm far away from an access point. When the phone tries to authenticate to the WiFi network and fails because some packets got lost because of the poor signal, it thinks that the WiFi password is incorrect and prompt for a new password. Since the phone is locked, the prompt is not visible. Then phone then never reconnects to the network until I unlock it, dismiss the password prompt and manually reconnect to the correct network. [^firefox]: Mobile optimizations are no longer working and I didn't find the time to fix it yet. [^bluetooth_headphones]: The audio does not automatically switch over to the Bluetooth headphones when connecting them. [^gps]: I finally got GPS working. The GPS antenna seems to have very poor performance though. Even in the winter with no leaves on the trees, location accuracy in a forest is poor. The spec sheet of the manufacturer claims that the modem supports GNSS constellations other than GPS but I don't know how to check that they are being used. Maybe the userspace software does not yet support this but I don't know how to check. Also there are two software problems preventing GPS from working properly. There is a bug in eg25-manager which prevents it from uploading the assistance data to the modem. It tries to talk to the modem over serial while modem-manager is also talking to the modem over serial. This is inherently racey as the serial protocol does not support multiplexing. Manually downloading the assistance data from the internet and uploading it to the modem using modem-manager works though. A second problem is that no geoclue agent is enabled. This can be worked around with services.geoclue2.enableDemoAgent = lib.mkForce true;. This should probably be upstreamed to the phosh module in Nixpkgs. [^silent_boot]: This used to work at some point in the past. [^decryption_two_times]: Two times because of kexec. There is hope that this can be fixed in the future. [^slow]: And I mean everything. From the CPU to the internal storage (MMC), to the WiFi. Applications take a long time to open, Pictures take a long time to process after capturing, Scrolling is sluggish. [^usb-c]: Even the included USB-C dock has this problem. [^waydroid]: Some Android apps (e.g. OsmAnd~) just crash while trying to start. It's also not possible to use and Bluetooth or GPS functionality. [^bluetooth_wlan]: When lots of data is transmitted over WLAN, the bluetooth audio stutters. The same thing happens if you walk around the house, the WLAN signal gets lost and the WLAN chip frantically searches for the signal until giving up.

Luflosi avatar Oct 17 '23 12:10 Luflosi

On the pinephone pro, and acer-lazor*, I got waydroid working just well, so I assume it should also work on the pinephone (a64), assuming there's nothing allwinner-specific that would prevent it from working

(Unrelated, most likely, but on lazor the rendering was kinda broken for half of the display, but I did not investigate as I did not need it on the device, it was only a convenient AArch64 system to test with...)


You might need to define what "silent boot" is, but AFAIK it probably works now? I think there were a few details I got wrong that broke it at some point in the past. Normalizing configs across all devices should have helped. Though note that it might require you to configure some part of it? You might want to expand on that in another issue with your requirements, since I personally think having a scrolly-text-free boot is important.


samueldr avatar Oct 17 '23 17:10 samueldr

Yeah, I'm pretty sure WayDroid will work, I just haven't updated mobile-nixos on my device yet.

Luflosi avatar Oct 17 '23 17:10 Luflosi

You might need to define what "silent boot" is, but AFAIK it probably works now? I think there were a few details I got wrong that broke it at some point in the past. Normalizing configs across all devices should have helped.

Okay, then I'll test that by updating mobile-nixos when I find some time. I just need to first fix my config to use the correct version of home-manager for nixos-unstable.

Luflosi avatar Oct 17 '23 17:10 Luflosi

Have to enter decryption key four times on boot

Two thoughts:

  • stage-0 boot method will be soft-deprecated and removed from defaults, it basically works nowhere else properly, and has that annoying issue... Solving the issue of using the generation's own stage-1+kernel should instead be handled via the platform firmware (in other word: have the display working in U-Boot/Tow-Boot)
  • We might want to do like the scripted NixOS stage-1 and make the passphrase "loiter" around until all luks devices have been attempted to be unlocked with it? That would solve your remaining one entry.

samueldr avatar Oct 17 '23 17:10 samueldr

RAID-1 [...] Slow

If the SD card is involved in that RAID, it would be expected.

Though yes, everything is kinda slow with the eMMC running at the speed it is.

  • https://hackaday.com/2021/11/19/pinephone-speed-up-takes-soldering/

samueldr avatar Oct 17 '23 17:10 samueldr

Well, it actually felt faster with RAID1 than with just eMMC. The eMMC is super slow. I don't think the wear-levelling controller handles the write patterns of Btrfs very well. I could probably manage to solder that resistor to increase the speed but I'm not comfortable with changing device trees especially since I couldn't find any information on what happens if you use the wrong one for the situation, so for example the device tree for the high speed mode when you still have not modified the hardware or vice-versa.

Luflosi avatar Oct 17 '23 18:10 Luflosi

The speed hack wasn't really a recommendation, but only breadcrumbs.

samueldr avatar Oct 17 '23 18:10 samueldr

@Luflosi you rule, thanks! I'm thinking of slowly migrating to daily driver level after I get more comfortable. I'm having trouble with the very basics, though this https://github.com/NixOS/mobile-nixos/pull/658#issuecomment-1765911265 happened after both the released tag of tow-boot and the main/develop branch (on the most recent download of installer image from hydra). (one thing I didn't try yet was rolling back to a pre https://github.com/NixOS/mobile-nixos/pull/622 version on hydra, samueldr implied in a comment that this might help. I'm uncertain.

In general I'd be an avid consumer of any blogs or documentation you write about this. So thanks!

quinn-dougherty avatar Oct 18 '23 20:10 quinn-dougherty

I finally updated my phone to the latest version of both NixOS and Mobile NixOS. WayDroid works now, yay! But while booting I still see the console messages with systemd services starting and other stuff.

Luflosi avatar Jan 11 '24 08:01 Luflosi

I added a footnote explaining why screen autorotation is not working.

Luflosi avatar Jan 11 '24 14:01 Luflosi

I finally got GPS working with some quirks 🎉.

Luflosi avatar Apr 09 '24 09:04 Luflosi

Things I got working:

  • Sending SMS
  • Video recording with the rear camera
  • Hardware accelerated video playback with Livi

Things not working:

  • Bluetooth
kernel: bluetooth hci0: Direct firmware load for rtl_bt/rtl8723cs_xx_fw.bin failed with error -2
kernel: Bluetooth: hci0: RTL: firmware file rtl_bt/rtl8723cs_xx_fw not found

Notes:

  • Phone calls are loud enough with this patch, however making it louder will cause echoing issues
  • Hotspot will use the same password with nmcli device wifi hotspot ifname wlan0 con-name <connection_name> ssid <your_ssid> password <your_password> (possible to configure declaratively with Nix)

donovanglover avatar Sep 03 '24 17:09 donovanglover

Bluetooth works for me. Can you try my mobile-nixos fork and see if that changes anything? In the diff you can see that I updated the firmware. I did this a long time ago for no particular reason other than there was a newer commit available but I didn't upstream this change because I didn't have a good justification. I didn't think this actually touched any files for the PinePhone but I might be wrong on that. If it makes Bluetooth work for you, I'll make a PR updating it to the latest commit.

Luflosi avatar Sep 04 '24 10:09 Luflosi

I've actually been using the latest commit. Not a priority though since audio switching is broken for me and phone call ringing is very loud when listening to audio.

donovanglover avatar Sep 04 '24 16:09 donovanglover

Waydroid has gotten better but it runs like ass (the gpu is so old that Waydroid is rendering through the CPU. Look at the CPU usage by just playing the boot animation)

hustlerone avatar Oct 29 '24 18:10 hustlerone

I finally got GPS working with some quirks 🎉.

On Waydroid or the entire OS? I would like to also have GPS working

hustlerone avatar Oct 29 '24 18:10 hustlerone

The entire OS. I would love to also have GPS working in Waydroid without loosing it for Linux but I don't know of any way to do that. I have read that some people managed to pass the serial device of the modem into the Waydroid container but by doing so, you remove it from Linux. Unfortunately I still haven't upstreamed my fix to make GPS work in phosh but maybe I'll find the time and motivation now that I seem to not be the only one who wants this. I think the key was to add services.geoclue2.enableDemoAgent = lib.mkForce true. There is also a race-condition with eg25-manager and modem-manager both talking to the modem at the same time, which fails because serial connections do not support multiplexing. This prevents the GNSS assistance file to be uploaded to the modem, which makes it take much longer for the modem to get a location fix. It's possible to manually download the file and upload it to the modem but to be honest, I'm not sure if it really helps, since it still takes an eternity to get a lock. Use the satellite app, which I packaged in Nixpkgs, to see how the modem slowly locks onto multiple satellites and finally gets a location fix.

Luflosi avatar Oct 30 '24 11:10 Luflosi

If you see that something is not working for me but you got it working, please tell me in the comments.

I'm running Pipewire just "fine" here. It's still using the ALSA UCM backend from mobile-nixos, but I just shoved that envvar down the throat of pipewire's systemd unit (not everything configured in that repo works atm, but some stuff does). Since I'm not currently running callaudiod it does not automatically switch inputs and all that, but it is functional for listening to music on the go via headphones (wired, bluetooth doesn't work for me at all), listening via the speaker to fall asleep to, and I can switch to the small speaker that you'd use for calls, it's just not very useful as I haven't really done that part of the deal.

No idea about the microphone though. And before that when switching levels in alsamixer and unmuting certain inputs/outputs you will get at least two pieces that create either very loud and/or painfully high frequency sine waves.

benaryorg avatar May 30 '25 14:05 benaryorg

Phone calls are loud enough with this patch, however making it louder will cause echoing issues

I've been wondering, but I don't have the capacity to really go about doing that right now (this is becoming a theme.…), shoving RNNoise into Pipewire (as I usually do) would probably solve those issues rather well, the only caveat I see is performance and battery life (also temperature) and that's a rather big caveat (though auto-suspend for devices would work I guess).

benaryorg avatar May 30 '25 14:05 benaryorg

Even then callaudiod doesn't work on my x230t. It doesn't redirect the audio from the modem to the speaker.

Maybe I shouldn't have sent the AT command that exposes the audio lines as ALSA devices? I dunno

hustlerone avatar May 31 '25 13:05 hustlerone