yashsingh1/xdaforums huggingface dataset:
[Raspberry Pi Original Development] mouragio1:
Hi,

I have a question about the battery status. My setup:

- RPi4 with 4GB

- PIJuice hat (UPS) with a battery on top

- on top of that one a Hifiberry.

Using a waveshare 10.1 touchscreen

Flashed LineageOS 19 latest build; everything works fine; also carplay etc>

My situation: I want to use the setup in my car (for mostly Carplay)

When the PI is in the state powered off; and the ignition key is turned; it gets power -> startup... great.

When the PI is running on its battery (ignition off) and the battery is low; PIJuice will safely shutdown the PI.. so far so good.

I would like to get a trigger that when the ignition key is turned off; the PI sees that there is no external power and then dims the screen and stops the music. I dont mind if it stays running while still on battery power..

And ofcourse in that case also a trigger when the power is back on so that the screen is turned on (and music can be resumed)

I had the same setup with a tablet (lenovo) and that worked... problem was overheating (RPI will also; but easier to use a fan) and the tablet crashed occasionally with carplay.

So; someone has an idea how I could get that trigger? the battery status cannot be determined in lineageOS op the RPI...

edit: Usually you can set triggers op a raspbian/ubuntu distro with the PIJuice tools; but on this its not possible to install...

Thanx in advance :).
[Raspberry Pi Original Development] KonstaT:
https://twitter.com/i/web/status/1559634752944177152
[Raspberry Pi Original Development] KonstaT:
You would need to dig into the PIJuice driver how it gets data from the hardware. My builds include i2c-tools that you can use to interact with I2C devices.

You can write a script and place it in /vendor/etc/init.d/ to do various things. E.g. I've provided a script that powers down the device when you connect GPIO pin to ground that you can use as a base (https://xdaforums.com/t/dev-rom-uno...raspberry-pi-4-b.4139059/page-6#post-83822011).
[Raspberry Pi Original Development] mouragio1:
thanx! Appreciated.

I will research this..
[Raspberry Pi Original Development] mouragio1:
I get an error "Unable to expand Lineage-17.1-rpi-gpio-shutdown.zip"... is this expected? look like the zip isnt unzippable

Do you have it somewhere else where I can download please? thanx.

edit: never mind. sorted it. thanx again.
[Raspberry Pi Original Development] Aravindh Senthikumar:
Hello @KonstaT

I am trying to build lineage 19.1 [Android 12] for rpi4.

Can you please share the local brcm_lineage19.1 manifest file?

Requesting to share the build instructions as well

Regards,

Aravindh S
[Raspberry Pi Original Development] Ajtaji:
Nice build, good job. Only thing i find broken is gps.default.so in /vendor partition which is easily replaced with one that works on ubloxx 7 and or 9.
[Raspberry Pi Original Development] KonstaT:
Which GPS HAL is that?

U-Blox 7 works with the GPS HAL that is included in my builds. I don't have any other GPS hardware to test.
[Raspberry Pi Original Development] Ajtaji:
GitHub - zxcwhale/android7_gnss_hal_driver: A GNSS hal driver for Android 7.x

A GNSS hal driver for Android 7.x. Contribute to zxcwhale/android7_gnss_hal_driver development by creating an account on GitHub.

github.com

Change line 61 to a value of 5 and you get satellites with ubloxx 9. But you still get what that ubloxx 7 supports.
[Raspberry Pi Original Development] PlasmaFlow:
I have this Car Switch

4amp Car Supply / Switch

4amp peak car supply with one USB-C and one USB-A port (will update photos, no longer making these with a second USB-A). Voltage output is set to 5.2V. Works with all versions of the Pi including the latest Pi 4. The circuit senses your ignition and safely shuts down the Pi when your car turns...

www.mausberrycircuits.com

This is a link to what normally is used on the rPi for shutdown using this switch.

http://files.mausberrycircuits.com/carsetup.sh

How can this be incorporated into the 19 Version of the OS to make it work to shut down when the car is turned off?

Thanks!
[Raspberry Pi Original Development] KonstaT:
I have provided a very similar script that you can use as a base for your own modifications (https://xdaforums.com/t/dev-rom-uno...raspberry-pi-4-b.4139059/page-6#post-83822011).

That flashable zip won't work with the new TWRP version that is included in the latest builds. Also I've moved init.d scripts from system partition to vendor (/vendor/etc/init.d/) in LineageOS 19.

You need to mount the vendor partition writable and set permission on the script executable.

e.g.

adb root
adb remount
adb push 30gpioshutdown /vendor/etc/init.d/

or

su
mount -o rw,remount /vendor
cp path/to/30gpioshutdown /vendor/etc/init.d/
chmod 755 /vendor/etc/init.d/30gpioshutdown
chown root:shell /vendor/etc/init.d/30gpioshutdown
[Raspberry Pi Original Development] PlasmaFlow:
Many thanks!
[Raspberry Pi Original Development] PlasmaFlow:
I am using this AMOLED display.

5.5inch HDMI AMOLED - Waveshare Wiki

www.waveshare.com

Works well but when it boots into TWRP the video is not viewable all though you can see there is video.

Any special lines I may need to add to the config.txt?

v/r,
[Raspberry Pi Original Development] KonstaT:
Not sure if TWRP has issues due to the fact it's 1080x1920 portrait display.

You can try the hdmi_* options listed in the document you linked. hdmi_* options in config.txt have no effect with KMS driver that is used with hw accelerated graphics on Android. TWRP doesn't use hw accelerated graphics so these still work there. Or maybe try something like display_rotate=1 in config.txt.
[Raspberry Pi Original Development] PlasmaFlow:
These options make it work perfectly on boot to TWRP:

display_rotate=3

max_framebuffer_height=1920

config_hdmi_boost=10

hdmi_group=2

hdmi_force_hotplug=1

hdmi_mode=87

hdmi_timings=1080 1 26 4 50 1920 1 8 2 6 0 0 0 60 0 135580000 3

And I can confirm they don't break the regular boot when the GPIO21 is not shorted to ground

Thanks!

v/r,
[Raspberry Pi Original Development] PlasmaFlow:
All I had to do was add another GPIO Pin in the Out Direction and the Pi shuts down.

#!/system/bin/sh

#This pin tells the Pi to run when grounded by the CarSwitch when the ignition is removed the switch removes the ground

GPIO=5

#This pin tells the Car switch that the Pi is running, when the ignition is removed the pi will shut this pin off to signal is down to the switch

GPIOOUT=6

echo $GPIOOUT > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio$GPIOOUT/direction

echo 1 > /sys/class/gpio/gpio$GPIOOUT/value

echo $GPIO > /sys/class/gpio/export

echo in > /sys/class/gpio/gpio$GPIO/direction

echo 0 > /sys/class/gpio/gpio$GPIO/value

while [ 0 ]

do

if [ $(cat /sys/class/gpio/gpio$GPIO/value) == 1 ]; then

sleep 3

echo $GPIOOUT > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio$GPIOOUT/direction

echo 0 > /sys/class/gpio/gpio$GPIOOUT/value

echo $GPIO > /sys/class/gpio/export

echo in > /sys/class/gpio/gpio$GPIO/direction

echo 0 > /sys/class/gpio/gpio$GPIO/value

reboot -p

fi

sleep 1

done

#

Thanks Again KonstaT!

Note: Changed the Pins from 2/3 to 5/6 because the Argon Fan hat needs those for I2C.

Note2: Script shuts down the Pi using the car switch and signals the switch the Pi is down. the Switch seems to provide Ground to both its pins and removes ground from pin 5 when the ignition is turned off, so the logic had to be to look for the pin to be 0 when running normally i/e ignition is on. If you need to work on a bench and need the Pi to boot and stay up short GPIO 5 to Ground. Otherwise, the Pi will always shut down on boot.
[Raspberry Pi Original Development] PlasmaFlow:
Got a new Script I am working on to get the Argon 40 hat working at least for the fan speed.

But I keep getting these errors when I run it manually and the script does not seem to be running automatically.

Error: elif[ $cputemp -gt 55000 && $cputemp -lt 60000 ]: inaccessible or not found

Here is the script:

#!/system/bin/sh

#Fan Control Script for Lineage OS 19.1

sleeptime=120

echo Sleep Time $sleeptime

while[ 1 ]

do

if[$cputemp < 55000]; then

fanspeed=0x00

elif[ $cputemp -gt 55000 && $cputemp -lt 60000 ]; then

fanspeed=0x10

elif[ $cputemp -gt 60000 && $cputemp -lt 65000 ]; then

fanspeed=0x32

elif[ $cputemp -gt 65000 ]; then

fanspeed=0x64

fi

i2cget -yf 1 0x01a $fanspeed

if[ $cputemp -gt 60000 ]; then

[[ -f /sdcard/Fancontrol/fanlog.txt ]] && echo $(date +"%d-%m-%y %H:%M:%S") $cputemp $fanspeed >> /sdcard/Fancontrol/fanlog.txt

fi

sleep $sleeptime

done

---------

The original script was comparing the CPU temp using -lt (l;ess than) and -ge (greater than) but I can find on the web that -ge should be -gt.

However, trying to see where the problems are I used also the < > normal comparison symbols.

So working out a script that runs on Android is a bit hard since there is very little on the subject for android.

Lots of references for linux and shell script but to say the least I'm a bit confused. I may be looking in the wrong places.

This is the last item on my build for a car head unit.

Any suggestions will be greatly appreciated.
[Raspberry Pi Original Development] KonstaT:
You're not reading cputemp variable from anywhere which is why it's "inaccessible or not found". There's a script for Argon cases that should work (http://disq.us/p/2guifm1).

Some command line tools are missing from Android but there isn't anything out of the ordinary with Android shell scripts otherwise. LineageOS also has Bash if you need to use some bash specific stuff in your script ('#!/system_ext/bin/bash' shebang in LineageOS 19).
[Raspberry Pi Original Development] PlasmaFlow:
DOH!

I deleted that line when I pasted it in and removed my comments.

This line would be inside the do loop

cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)

when that line runs I see the temp value.

CPU Temp: 38459

v/r,
[Raspberry Pi Original Development] KonstaT:
Well, still compare it to the script I linked.

IIRC you can't do AND operation in single brackets. Both '[ $cputemp -gt 55000 ] && [ $cputemp -lt 60000 ]' and '[[ $cputemp -gt 55000 && $cputemp -lt 60000 ]]' should work.
[Raspberry Pi Original Development] PlasmaFlow:
That is the same script I used as the base for this one.

I get errors like unexpected elif or unexpected done.

ill keep banging at it.

thanks!
[Raspberry Pi Original Development] HaHaPPA:
Even if I delete the resolution.txt file and boot it the same thing.
[Raspberry Pi Original Development] denkd:
Hi @KonstaT, first, thank you very much for your builds!!

I have one question: Do you see any chance to help me with a possible workaround for the issue, that with recent builds some displays are not switched off when pressing the power key? I found out, that the command 'vcgencmd display_power 0' works and totally switches off the display including backlight. I wanted to do it with MacroDroid but, then I need a rooted system, I think - at least I couldn't get it to work, as the command fails with 'VCHI initialization failed' - maybe due to insufficient permissions. Do you see any other way of running that command when the screen is switched off?
[Raspberry Pi Original Development] fajabird:
I have installed the 20220811 on a SD-Card and while its booting and running quiet fine on a Pi-400, I experienced reoccuring lagging while playing back youtube videos or running stadia games. Its weird becuase its actually the first OS where stadia would run fine on an RPI, but every 5 seconds or so its lagging, resolution drops and than after a few seconds it agains runs super fine. Any idea how to troubleshoot this? I already tried the experimantal hardware decoder support but it doesn't change that behaviour. BR
[Raspberry Pi Original Development] KonstaT:
This is a topic to discuss LineageOS 19 on Pi 4. Topic for LineageOS 16 on Pi 4 is here (https://xdaforums.com/t/dev-rom-unofficial-lineageos-16-0-android-9-for-raspberry-pi-4-b.4030739/).

You of course shouldn't be using version that is seriously outdated and has been discontinued for over two years. Use the latest LineageOS 18/LineageOS 19/AOSP 13 builds instead.

No, that's not how this should be addressed in any case.

As discussed before (e.g. http://disq.us/p/2pvgjc0 ) issue with display blanking is due to upstream drm_hwcomposer changes. You can replace /vendor/lib(64)/hw/hwcomposer.drm.so from a previous build if this is too much of an issue for you.

As software video decoders are used it's very CPU intensive and it can generate quite a bit of heat so your CPU might throttle because of this. Don't overclock the CPU. Make sure to take care of cooling or at least don't use a case that keeps the heat in.
[Raspberry Pi Original Development] Ajtaji:
How do you disable the Android headphone volume safety feature from invoking with a USB audio DAC.
[Raspberry Pi Original Development] KonstaT:
Adding 'audio.safemedia.bypass=true' to build.prop should work.
[Raspberry Pi Original Development] Ajtaji:
Thanks, I'll give that a shot.
[Raspberry Pi Original Development] Dudelectric:
Hi, @KonstaT Thank you for this build. I have successfully installed this to my Rpi4 2GB. Is there any chance I can use QUECTEL 4G module with this (using vendor RIL binary)?
[Raspberry Pi Original Development] KonstaT:
No, you can't use any LTE modem out-of-the-box. My builds are configured as wifi only tablet so they don't even have Android telephony framework or drivers to support any modem hardware.

I have builds (of older Android versions) that have support for Sixfab modem HAT and Quectel EC25. LTE data and SMS works fine. It's also possible to make/receive calls but in-call audio is not working. It's not something that I plan to include in public releases as practically no one has the hardware.
[Raspberry Pi Original Development] Dudelectric:
Thanks..Ok, I see. you don't include a telephony framework, even if this is included in your build it won't be able to support many modules per release. because the module comes with its own vendor RIL. Although I think EC25 should be pretty common to developers.
[Raspberry Pi Original Development] KonstaT:
Yes, exactly. You can consider Android as an OS for embedded devices and it only needs to support some specific hardware at a time. It also poses some problems if I include the telephony stack in the build but one doesn't have any hardware connected to use it.
[Raspberry Pi Original Development] bhargava414:
My setup: RPi 4 4GB vesion + 7inch universal Portable touch monitor from Waveshare (HDMI Inteface + USB for Touch Screen).

Issue: Getting only BLACK screen.

Steps already Taken: 1) deleted resolution.txt file

2) added the following code at the end of config.txt

max_framebuffer_height=1920

hdmi_group=2

hdmi_mode=87

hdmi_timings=1080 0 112 16 160 1920 0 4 10 10 0 0 0 60 0 140000000 3

extra_transpose_buffer=2

gpu_mem=512#Please change to gpu_mem=256 for Pi Zero series

But only getting BLACK Screen, Please advise.
[Raspberry Pi Original Development] KonstaT:
Already discussing this on my site (http://disq.us/p/2qvhgf6). Lets not have this same discussion in various places.
[Raspberry Pi Original Development] Dudelectric:
Hi @KonstaT , I'm wondering if there is any repository containing a local manifest for building this (Lineage OS 19)?

the latest only 17 from this branch https://github.com/lineage-rpi/android_local_manifest

Thanks
[Raspberry Pi Original Development] KonstaT:
https://xdaforums.com/t/dev-rom-uno...2l-for-raspberry-pi-4-b.4356891/post-86079553
[Raspberry Pi Original Development] KonstaT:
New builds.

LineageOS 19 (Android 12L)

for Raspberry Pi 4

konstakang.com

switch to clang kernel build

allow VNC input to wake the device

add /boot/config_user.txt for user specific options to backup/restore during OTAs

update to Mesa 22.1.7

update to Linux 5.10.144 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)

Android security patch level: 5 September 2022 (merged)

LineageOS 19 Android TV (Android 12L)

for Raspberry Pi 4

konstakang.com

add option to restrict new USB connections

add option for left-handed mouse

include Raspberry Pi userland tools (vcgencmd, etc) and libdrm modetest

switch to clang kernel build

allow VNC input to wake the device

add /boot/config_user.txt for user specific options to backup/restore during OTAs

update to Mesa 22.1.7

update to Linux 5.10.144 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)

Android security patch level: 5 September 2022 (merged)
[Raspberry Pi Original Development] Dudelectric:
@KonstaT Thax that explains much..
[Raspberry Pi Original Development] LPCA:
here's my results so far with LOS 19.1 Android TV on Raspberry Pi 4 2GB, on Flirc case...

Boots via PINN LOS 19.0 2021-12-16 without modified startelf files (https://github.com/procount/pinn , https://github.com/procount/pinn-os/blob/master/os/os_lineage.json)

Boots with latest lineage-19.1-20220923-UNOFFICIAL-KonstaKANG-rpi4-atv.zip (

https://konstakang.com/devices/rpi4/LineageOS19-ATV/)

Can not install Magisk zip in TWRP recovery when installed with PINN.

But can install Magisk zip in TWRP recovery when installed without PINN and Magisk works.

Also can't reflash LOS image via TWRP recovery when installed with PINN.

Suspect issues with backup/restore with PINN but need to test more.

OTA updates fail with PINN, both via LOS UI and TWRP recovery.

Did not try OTA updates without PINN.

Google Apps from MindTheGapps-12.1.0-arm64-ATV-xxxxxxxx_xxxxxx.zip worked as per instructions. But Android TV Home launcher is hiding apps like Google ATV Home launcher. Is this the Google ATV Home launcher? Would prefer to have stock AOSP ATV launcher and keep everything visible and give us a way to hide apps if we want.

Did not try work-in-progress Gapps for Android 12/12L (https://www.xda-developers.com/download-google-apps-gapps/)

4K resolution did not work for my TV in any of the 2 options (it scales 80% of the screen out of boundaries).

Overclock to 2000 MHz ondemand worked.

Has issues with left-clicking on certain buttons on certain apps.

Back button on Minix Remote does not work always.

Back button on right mouse works almost always.

Interface generally slow, probably due to Google app and Google crap, or maybe just my old card.

HDMI audio has cutoffs all the time.

LOS/RPI OS Hardware accelerated video worked for HBO Max.

Stream results with LOS/RPI OS Hardware accelerated video:

NewPipe (YouTube) worked, but cuts image in half, with top half normal, bottom half purple overlayed. Cuts / cubiculizes video output often.

HBO Max worked, and fast/good.

Disney+ worked, but cuts image in half, with top half normal, bottom half purple overlayed. Cuts / cubiculizes video output often.

Amazon Prime Video did not work.

Plex stream for Euronews/TED did not work.

ARTE worked, but cuts image in half, with top half normal, bottom half purple overlayed. Cuts / cubiculizes video output often.

TED did not work.

Euronews did not work.

RTP Play did not work.

Stream results without LOS/RPI OS Hardware accelerated video:

NewPipe (YouTube) worked, super fast.

HBO Max worked, but too slow.

Disney+ worked, but drags a bit.

Amazon Prime Video does not work.

Plex stream for Euronews/TED worked, and fast/good.

ARTE worked, and fast/good.

TED worked, and medium-fast speed.

Euronews worked, and fast/good.

RTP Play worked, but too slow.

Can't install Netflix app. If forcing it into the system apps, complains does not have required components.

Can't launch directly videos into the right apps via Streamio, always tries to open with browser or reports can't find an app.

Can't install zips in Magisk, reports "unzip error" (just as in https://github.com/stylemessiah/SQLite3UniversalBinaries/issues/1)
[Raspberry Pi Original Development] darkdude18:
After a few failed attempts to execute a script which issue a shutdown command when a GPIO is pulled up or down (I can't get it to be executed as root) I found lineage-17.1-rpi-gpio-shutdown.zip posted by @KonstaT that is executed via init.d

Is it possible to make it work with this build?
[Raspberry Pi Original Development] KonstaT:
Yes, you can use the script that is inside the zip. I've moved init.d scripts to vendor partition (/vendor/etc/init.d/) in Android 12 so you would need to copy it over manually. You would need to mount the vendor partition writable, copy the script, and set executable permissions on the script.
[Raspberry Pi Original Development] floatingjoy:
Hi! This is my kernel patch for full natively support the docker. PI4 LOS 19.1 Android. Tested in 4G , 8G worked fine.

based on

LineageOS 19 (Android 12L)​

for Raspberry Pi 4​

September 23, 2022

common-android12-5.10-lts

----------------

usage:

1.unzip and replace the files in your sdcard /boot/...

2.reboot and install termux

3.in termux run pkg install root-repo && pkg install docker

4.give the --net=host --dns=8.8.8.8 flags when running a container.

5.enjoy it!

----------------

thx: https://gist.github.com/FreddieOliveira/efe850df7ff3951cb62d74bd770dce27

thx: https://konstakang.com/devices/rpi4/LineageOS19/

Also in: https://github.com/FlotingDream/Raspberry-Pi-4-LOS-19.1-Docker/blob/main/README.md
[Raspberry Pi Original Development] sorrowtorn:
Does anyone has issues casting their android device to Android TV? It seems to always complain about 'Casting screen to Raspberry Pi 4 has ended'
[Raspberry Pi Original Development] beletruz:
Hi, I got this display from waveshare https://www.waveshare.com/7.9inch-dsi-lcd.htm and I can't get it to work (i've turned 7" dsi on but nothing), Any idea how i can get this to work, i really need the form factor of this display and the dsi.
[Raspberry Pi Original Development] uukelele:
Hi, I'm just asking, are you planning to build LOS 20 for the raspberry pi as I've seen your AOSP 13 builds and there are some developers doing unofficial builds for LOS 20?
[Raspberry Pi Original Development] nithin936:
What if I am using a 5inch display with 800x480 display, Will that work fine?
[Raspberry Pi Original Development] KonstaT:
Like it's mentioned under 'Issues' on the Android TV page, Chromecast functionality is not supported on unofficial/uncertified Android TV devices.

This was just discussed in http://disq.us/p/2rhio29

That's a definite maybe at this point. :)

Which 5" 800x480 is that exactly? They're not all alike.
[Raspberry Pi Original Development] nithin936:
5inch LCD Touch Screen HDMI Display

800x480 pixel

XPT2046 Touch Controller
[Raspberry Pi Original Development] KonstaT:
The display part should work just as any other HDMI display.

To make the touchscreen work you would need to uncomment 'dtoverlay=ads7846...' line in /boot/config.txt.
[Raspberry Pi Original Development] nithin936:
Already uncommented those and touch is enabled but need to calibrate I think. How can we easily calibrate touch?
[Raspberry Pi Original Development] KonstaT:
There's no built-in calibration in Android. AFAICT you should be able to calibrate it by adjusting the xmin/xmax/ymin/ymax parameters but I don't have any hardware to test. config.txt also has line lenght limit so you might need to split that line over several lines.

If you need to rotate the input see https://github.com/lineage-rpi/andr...mmit/88e50a3480f06090179f36b4e56eeed9049e5c08 for reference.
[Raspberry Pi Original Development] nithin936:
Thank you, this was very beneficial. My touch has now been calibrated.
[Raspberry Pi Original Development] KonstaT:
That's good to know. :) Maybe you could share what you did exactly if it will help other people as well?
[Raspberry Pi Original Development] 7thedevil7:
I think I found a bug. Setting the IP to static in the android tv settings puts the device in a bootloop.

Build:

lineage-19.1-20220923-UNOFFICIAL-KonstaKANG-rpi4-atv.zip

Steps to reproduce:

1. Set a static IP via android tv settings.

2. Restart.
[Raspberry Pi Original Development] KonstaT:
Could be, I haven't tested. Logcat?

Could also be something to do with your network setup otherwise.