Rpi 4 android hdmi cec

LineageOS 18.1 Android TV (Android 11)

for Raspberry Pi 4

Here’s my build of LineageOS 18.1 Android TV for Raspberry Pi 4 Model B, Pi 400, and Compute Module 4. It is unofficial and unsupported by the LineageOS team. It’s for advanced users only. Pi 4 model with at least 2GB of RAM is required to run this build.

Important! This image includes parts that are licensed under non-commercial license (Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International). You may use this build freely in personal/educational/etc use. Commercial use is not allowed with this build!

Do not mirror my builds! Please post a link to this page instead.

lineage-18.1-20211123-UNOFFICIAL-KonstaKANG-rpi4-atv.zip
https://www.androidfilehost.com/?fid=7161016148664844938
md5:38d6684bd6d73344856178ed179e4be4

Working:

  • Audio (HDMI, 3.5mm jack, USB microphones, bluetooth speakers/headphones, etc)
  • Audio DAC (using GPIO DACs e.g. Hifiberry DAC+)
  • Bluetooth (and bluetooth tethering)
  • Camera (using official Pi camera modules & UVC USB webcams)
  • GPIO
  • GPS (using external USB modules e.g. U-Blox 7)
  • Ethernet
  • Hardware accelerated graphics (V3D, OpenGL & Vulkan)
  • HDMI display (and HDMI-CEC)
  • I2C
  • IR remotes (using external GPIO IR modules e.g. TSOP4838)
  • RTC (using external GPIO I2C modules e.g. DS3231)
  • Sensors (using external GPIO I2C modules e.g. MPU6050, LSM6DS3, LSM303DLHC & BME280/BMP280 accelerometer/gyroscope/magnetometer/temperature/pressure/humidity)
  • Serial console (using external GPIO serial console adapters e.g. PL2303)
  • SPI
  • Touchscreen/multi-touch (USB touchscreens, Waveshare SPI touchscreens)
  • USB (mouse, keyboard, storage, etc)
  • USB-C (ADB, MTP, PTP, USB tethering)
  • Wifi (and wifi tethering)

Not working:

  • Hardware video decoding & encoding (software decoding & encoding works)

Issues:

  • Chromecast functionality is not supported on uncertified Android TV devices
  • SELinux is in permissive mode
  • and more…

Sources:

Thanks:

  • Peter Yoon and android-rpi project
  • Roman Stratiienko and GloDroid project
  • AOSP reference board developers (dragonboard, hikey, yukawa)
  • E. Anholt for V3D graphics driver
  • Maxime Ripard for Pi 4 KMS driver
  • Android-x86 project
  • LineageOS team and everyone who has contributed to LineageOS 18.1

How to install:

  1. Follow the official Raspberry Pi instructions for writing the image to the SD card.

FAQ:

Q: How to enable developer options?
A: Settings -> System -> About -> Click ‘Build number’ several times.

Q: How to enable root access?
A: LineageOS no longer has built-in root management for applications. You can have root access via ADB after enabling Settings -> System -> Developer options -> Rooted debugging, SSH (see FAQ below), or serial console. It is also possible to install Magisk following instructions later in the FAQ.

Q: How to enable advanced reboot options?
A: Settings -> System -> Buttons -> Advanced reboot

Q: How to find several Raspberry Pi specific settings options?
A: Settings -> System -> Raspberry Pi settings

Most options in this menu require you to reboot your device for the setting to take effect.

Q: My display is not working. I can only see the rainbow screen but no Android boot animation. What should I do?
A: This build only supports HDMI displays that report supported resolutions using EDID. 1920×1080 resolution is used by default with this build. You can change value in /boot/resolution.txt to use a different resolution that your display supports. Removing /boot/resolution.txt will use the preferred resolution of your display.

Q: Settings -> Storage shows total system size of 7 GB. There’s unallocated space on my sdcard. What should I do?
A: This is a 7 GB image, remaining space on your sdcard will remain unallocated. Easiest way to extend /data partition is to simply flash my resize zip in TWRP.

Alternative option is to use e.g. GParted and extend /data partition (/dev/block/mmcblk0p4) to cover the unallocated space. Resizing the partition manually will break support for encrypting /data. Format /data in TWRP recovery (Wipe -> Format data) after resizing to leave required space for crypto footer.

Q: Raspberry Pi doesn’t have a power button. How to power off/reboot device?
A: Following keyboard keys work as Android buttons: F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, F5 = Power, F11 = Volume down, and F12 = Volume up. You can also use one of many third party reboot applications.

Q: How to create a DIY hardware power button?
A: You can send power button events by connecting GPIO21 to ground.

You can enable the feature by using a settings option found in Settings -> System -> Raspberry Pi settings -> Power button.

You can also use the DIY power button to boot the device to TWRP recovery. Press and hold the button while powering on the device until you see the TWRP screen.

Q: How to enable audio through 3.5mm jack?
A: You can enable the feature by using a settings option found in Settings -> System -> Raspberry Pi settings -> Audio device.

Q: How to use IR remote?
A: You can enable the feature by using a settings option found in Settings -> System -> Raspberry Pi settings -> Infrared remote.

You can place a keymap for your remote as /boot/rc_keymap.txt to be automatically loaded on boot (see available keymaps for reference).

Q: How to use RTC?
A: You can enable the feature by using a settings option found in Settings -> System -> Raspberry Pi settings -> Real time clock.

System time is automatically read and set from the RTC on boot once you’ve enabled the feature. You need to write the system time you want to use to the RTC in rooted shell:

Q: How to use SSH?
A: You can start/stop the built-in SSH server by using a settings option found in Settings -> System -> Raspberry Pi settings -> SSH.

Android doesn’t have user accounts with passwords so key based authentication is used with SSH instead. Necessary keys are generated on the first boot and you need to pull the private key to your computer (or alternatively you can push your own previously generated keys to the device). See Settings -> System -> About -> Status -> IP address for your device’s IP address (192.168.0.100 is assumed here). Enable Android debugging & Rooted debugging under Settings -> System -> Developer options.

It’s recommended to disable adb after this.

Q: How to boot from USB device?
A: Warning , this is still an experimental feature. Especially TWRP seems to have some issues with USB boot.

  1. Install EEPROM that supports booting from USB
  2. Write image to your USB device as above
  3. Mount the USB device on your computer and make following changes to /boot/config.txt under ‘Boot device’ section:

Q: How to boot to TWRP recovery?
A: You can boot to TWRP by selecting Settings -> System -> Reboot -> Recovery after enabling advanced restart options.

If mouse cursor doesn’t appear, try replugging your mouse.

Q: How to boot out of TWRP recovery?
A: You can boot out of recovery by simply selecting reboot to system option in TWRP.

Q: How to update from previous LineageOS 18.1 build without losing data?
A:

  1. Boot to TWRP recovery with the build you want to keep the data (see FAQ)
  2. Plug in an external USB storage device and select ‘Backup’
  3. Use ‘Select Storage’ to choose the USB device and ‘Swipe to backup’ (it’s only necessary to backup the data partition so you can uncheck other partitions to speed up the process)
  4. Write new LineageOS 18.1 image to the sdcard following installation instructions
  5. Boot to TWRP recovery with the new build (see FAQ)
  6. Select ‘Restore’ and find the backup you created from the USB device (‘Select Storage’)
  7. Make sure you only have data selected as partitions to restore (uncheck other partitions if available) and select ‘Swipe to Restore’
  8. (Flash Google apps package/other add-ons you had previously installed)
  9. Boot out of recovery (see FAQ)

Q: How to install Magisk?
A:

  1. Download lineage-18.1-rpi-magisk.zip and save it to your device’s internal storage or use an external USB drive
  2. Download Magisk-v23.0.apk
  3. Boot to TWRP recovery (see FAQ)
  4. Install lineage-18.1-rpi-magisk.zip from your selected storage
  5. Boot out of recovery (see FAQ)
  6. Install Magisk-v23.0.apk using Android’s built-in file manager/’adb install’/etc.

Q: How to install Google apps?
A:

  1. Download open_gapps-arm64-11.0-tvstock-xxxxxxxx.zip and save it to your device’s internal storage or use an external USB drive
  2. Boot to TWRP recovery (see FAQ)
  3. Install open_gapps-arm64-11.0-tvstock-xxxxxxxx.zip from your selected storage
  4. Wipe -> Factory reset!
  5. Boot out of recovery (see FAQ)

Merged commits not mentioned in the changelog.

23.11. changelog:

  • add support for BME280/BMP280 temperature/pressure/humidity sensors
  • add option to select HDMI-CEC device
  • show IP address and port for SSH/VNC options
  • setup wizard improvements for TV devices (merged)
  • fix resizing data partition that broke with previous build
  • update to TWRP 3.6.0_11-0-KonstaKANG
  • update to Mesa 21.3.0
  • update to Linux 5.4.161 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
  • Android security patch level: 5 November 2021 (merged)

26.10. changelog:

  • switch to 64-bit kernel & userspace
  • switch to minigbm gbm_mesa and gralloc@4 API (thanks to Roman Stratiienko)
  • update to Mesa 21.2.4
  • update to Linux 5.4.155 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)

11.10. changelog:

  • add support for Vulkan
  • rework bluetooth (thanks to android-rpi)
  • switch to new two-panel settings UI (merged)
  • update to Mesa 21.1.8
  • update to Linux 5.4.152 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
  • Android security patch level: 1 October 2021 (merged)

20.7. changelog:

  • add support for HDMI-CEC
  • add built-in VNC server
  • update to Mesa 21.1.5
  • update to Linux 5.4.132 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
  • Android security patch level: 5 July 2021 (merged)

6.3. changelog:

  • initial Android TV build
  • update to Linux 5.4.102 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
  • Android security patch level: 5 March 2021 (merged)

Previous builds:

Donate to support my projects:

Источник

Raspberry Pi: Power On / Off A TV Connected Via HDMI-CEC

With the help of cec-client (part of libcec), your Raspberry Pi can control a device that supports CEC, like a TV, connected via HDMI. You could power the TV on or off, switch the active source, and more.

This should work with any Raspberry Pi version or model, including the original Raspberry Pi, as well as the latest Raspberry Pi 4.

A possible use case for this would be to connect to a Raspberry Pi via SSH and send a command to power on or off a TV connected to it via HDMI-CEC. Or you can use the commands to power on TV and make the CEC adapter the active source in a script, so that when you open some application on your Raspberry Pi, the TV that’s connected to it via HDMI-CEC powers on and switches to your Raspberry Pi HDMI source. I’m sure you can think of various other use-cases.

CEC, or Consumer Electronics Control, is a feature of HDMI which allows controlling devices connected through HDMI using a remote control. For example, CEC is used to get the play/pause buttons on a remote control to control playback on a device connected via HDMI. Or when you play a video on a Chromecast with the TV off, and the TV automatically powers on and switches to the Chromecast source.

Most modern TVs and AV receivers should support HDMI-CEC. However, it’s worth noting that you may need to enable CEC in the TV settings on some models. CEC may have a different name, depending on the device brand. For example, it’s called Anynet+ for Samsung TVs, EasyLink or Fun-Link for Philips, SimpLink for LG, and so on.

To be able to power on (and off) a TV connected via HDMI to a Raspberry Pi, the first step is to install cec-client. On Raspbian, or some other Debian or Ubuntu based Linux distribution for Raspberry Pi, install the cec-utils package ( cec-client is part of this package):

On other Linux distributions you’ll have to search for cec-client or cec-utils in the repositories, or build libcec from source.

Now that cec-utils is installed, let’s scan the CEC bus for available devices:

In this command echo ‘scan’ sends the scan command to cec-client, -s is used so cec-client executes a single command and exists, and -d 1 sets the log level to 1 (errors only), so it’s doesn’t pollute your terminal with useless info.

Remember the TV (or other device connected via HDMI-CEC to your Raspberry Pi) device # and address, as we’ll use that later on.

This is an example running this command on my Raspberry Pi that’s connected to a Samsung TV via HDMI (with CEC support):

In this example, device number 0 with the 0.0.0.0 address is my Samsung TV, and device number 1 with the 1.0.0.0 address is my Raspberry Pi device.

Now that we know the device number and address, you can use the command that follows to power on a TV connected via HDMI-CEC to the Raspberry Pi:

Both the device number ( 0 is the Samsung TV in the example above) and device address ( 0.0.0.0 is the Samsung TV device address from my example) should work.

-d 1 is to limit the log level to errors only, and you can use the command without it, but you’ll see a long, probably useless log.

You’ll also want to run the as command, which makes the CEC adapter the active source (so the TV switches to the Raspberry Pi HDMI source after the TV is powered on):

Want to turn the TV off (enter standby)? Use:

Depending on how you use this, you may also need to check the current TV status (is it on or in standby?). This can be done using:

To view all the commands that cec-client can send to a HDMI-CEC connected device, use echo h | cec-client -s -d 1 :

Источник

Читайте также:  Топ репозиториев для android
Оцените статью