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

(Updated) Init: xiaomi-beryllium / POCO F1

Open schrmh opened this issue 2 years ago • 1 comments

#560 with a few additional changes. (Might add more commits if I notice something while daily-driving.) Most notably removal of boot-control.service which would fail since this is not an A/B device:

warning: the following units failed: boot-control.service

× boot-control.service - Mark boot as successful
     Loaded: loaded (/etc/systemd/system/boot-control.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Thu 2023-12-28 11:44:19 UTC; 531ms ago
    Process: 92385 ExecStart=/nix/store/ng1gkkgllfgk5izwbq89g035c9qydgyf-unit-script-boot-control-start/bin/boot-control-start (code=exited, status=1/FAILURE)
   Main PID: 92385 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 150ms

Dec 28 11:44:19 nixos boot-control-start[92386]:     File.read("/proc/cmdline").split(/\\s+/).grep(/^androidboot.slot_suffix=/).first.split("=").last
Dec 28 11:44:19 nixos boot-control-start[92386]:                                                                                    ^^^^^^
Dec 28 11:44:19 nixos boot-control-start[92386]:         from /nix/store/jww9749gsrfwj1xw26g878flr74lwwpl-boot-control-2022-10-18/bin/boot-control:177:in `part'
Dec 28 11:44:19 nixos boot-control-start[92386]:         from /nix/store/jww9749gsrfwj1xw26g878flr74lwwpl-boot-control-2022-10-18/bin/boot-control:181:in `private_bits'
Dec 28 11:44:19 nixos boot-control-start[92386]:         from /nix/store/jww9749gsrfwj1xw26g878flr74lwwpl-boot-control-2022-10-18/bin/boot-control:201:in `tries_remaining'
Dec 28 11:44:19 nixos boot-control-start[92386]:         from /nix/store/jww9749gsrfwj1xw26g878flr74lwwpl-boot-control-2022-10-18/bin/boot-control:211:in `report'
Dec 28 11:44:19 nixos boot-control-start[92386]:         from /nix/store/jww9749gsrfwj1xw26g878flr74lwwpl-boot-control-2022-10-18/bin/boot-control:218:in `<main>'
Dec 28 11:44:19 nixos systemd[1]: boot-control.service: Main process exited, code=exited, status=1/FAILURE
Dec 28 11:44:19 nixos systemd[1]: boot-control.service: Failed with result 'exit-code'.
Dec 28 11:44:19 nixos systemd[1]: Failed to start Mark boot as successful.
warning: error(s) occurred while switching to the new configuration

Despite the other PR saying sound is working, I never really heard it on my device. However I saw how the bars moved in pavucontrol so maybe it is working but not loud enough. (I recall having a problem in pmOS where it was pretty silent until I messed with alsa). What I also noticed is that unlocking SIM doesn't seem to work ootb.

plasma seems to be the more stable experience. phosh and gnome-mobile work not so great. (Years ago on pmOS phosh was better than plasma and plasma was the interface where most apps crashed, heh).

So yeah and for lurkers wanting to get this on their beryllium and since the documentation on mobile.nixos.org is a bit confusing: https://gist.github.com/schrmh/01c0271bed160033489d7389f1101025

schrmh avatar Dec 28 '23 17:12 schrmh

Sound starts to work when using a more recent commit from sdm845-alsa-ucm repo: mobile-nixos/devices/families/sdm845-mainline/sound.nix:

14,15c14,15
<             rev = "621c71fd5f5742c60d38766ebb2d1bd3b863a2a4"; # master
<             sha256 = "sha256-CgAPg0UUAJUE1gD59l2GNDx3h9crAato6O/dDJpRwiY=";
---
>             rev = "c5a680c08b39d4a665479c9bd30481a137b60cc4"; # sdm845-phones
>             sha256 = "sha256-s4S4ULVkxGPAm0+0xzbvxWDX695XpiKWOp06/oMyU9s=";

Internal Audio Earpiece Output + Speakers Stero Output should then be selectable via the overlay volume control thing that appears when volume buttons are pressed. Per default it will use the top speaker (Earpiece Output) to play sound; it can be switched to play both top and bottom (Speakers Stereo Output). But wired headphones and internal Mic doesn't seem to work. However, it is detected when a 3.5 audio cable is connected:

[ 1274.380520] wcd934x-codec wcd934x-codec.1.auto: wcd934x_mbhc_get_result_params: d1=5, c1=3, x1=0xc91, z_val=268435454(milliOhm)
[ 1274.395501] wcd934x-codec wcd934x-codec.1.auto: wcd934x_mbhc_get_result_params: Impedance detect ramp error, c1=2, x1=0x0
[ 1274.395669] wcd934x-codec wcd934x-codec.1.auto: wcd934x_wcd_mbhc_calc_impedance: impedance on HPH_L = 0(ohms)
[ 1274.396731] wcd934x-codec wcd934x-codec.1.auto: wcd934x_mbhc_get_result_params: Impedance detect ramp error, c1=2, x1=0x0
[ 1274.396883] wcd934x-codec wcd934x-codec.1.auto: wcd934x_wcd_mbhc_calc_impedance: impedance on HPH_R = 0(ohms)
[ 1274.407453] wcd934x-codec wcd934x-codec.1.auto: wcd934x_mbhc_get_result_params: d1=30, c1=2, x1=0x62, z_val=268435454(milliOhm)
[ 1274.417389] wcd934x-codec wcd934x-codec.1.auto: wcd934x_wcd_mbhc_calc_impedance: MONO plug type detected

Also what I did not notice before: the mobile SIM card can indeed be used (or well, at least the PIN is accepted and phone calls can be accepted but call audio doesn't appear. SMS receiving seems to work at least partially? Did not receive a SMS sent by a messenger I installed but while I was sleeping and phone screen was off I received a SMS by the provider I use) when it is in the left slot (shared one where officially either microSD card or nano SIM can be put in). I had it in the other slot and there the PIN was never accepted.

Edit 16. Jan 2024: Was able to get the SIM card unlocked by using qmicli when it is in the other slot. There is no /dev/modem (not even on pmOS but for some reason the wiki says that) and apparently additionally to the steps from the wiki, msm-modem-uim-selection.service needs to be restarted (else something like "connection is not available on device qrtr0 because device is not available" might appear after trying to set APN settings). So this is what I put in a small script (replaced aid and pin with example data):

qmicli -d qrtr://0 --uim-switch-slot=2
sleep 5
qmicli -d qrtr://0 --uim-change-provisioning-session="slot=1,activate=yes,session-type=primary-gw-provisioning,aid=AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99"
qmicli -d qrtr://0 --uim-verify-pin=PIN1,0000
sleep 2
systemctl restart msm-modem-uim-selection.service

(qmicli -d qrtr://0 --uim-get-card-status to get the usim Application ID/aid)

schrmh avatar Jan 13 '24 03:01 schrmh