From 7e6adcab3280f458172d6d6a5653276c16f80107 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 1 Jun 2019 21:49:41 +0200 Subject: [PATCH] cec_scan: Refactor of add-on, added README (#587) * cec_scan: Refactor of add-on, added README * cec_scan: Set shell to bash --- cec_scan/CHANGELOG.md | 5 +++++ cec_scan/Dockerfile | 39 +++++++++++++++++++------------- cec_scan/README.md | 52 +++++++++++++++++++++++++++++++++++++++++++ cec_scan/config.json | 14 ++++++++---- cec_scan/run.sh | 3 ++- 5 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 cec_scan/README.md diff --git a/cec_scan/CHANGELOG.md b/cec_scan/CHANGELOG.md index 794b06a..8970937 100644 --- a/cec_scan/CHANGELOG.md +++ b/cec_scan/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2.1 +- Added README into the add-on repository +- Reduced size of add-on image for armhf & aarch64 +- Improved support for armv7 + ## 2.0 - Use new native Alpine RPi library for 64bit diff --git a/cec_scan/Dockerfile b/cec_scan/Dockerfile index 44e9ccd..f649b37 100644 --- a/cec_scan/Dockerfile +++ b/cec_scan/Dockerfile @@ -5,34 +5,43 @@ WORKDIR /usr/src ARG BUILD_ARCH # Set shell -SHELL ["/bin/ash", "-o", "pipefail", "-c"] +SHELL ["/bin/bash", "-o", "pipefail", "-c"] -## -# RPi support for HDMI-CEC on armhf/aarch64 -RUN if [ "$BUILD_ARCH" = "armhf" ] || [ "$BUILD_ARCH" = "aarch64" ]; then \ - apk add --no-cache raspberrypi-dev raspberrypi-libs; \ - fi - -## # Build libcec for HDMI-CEC ARG LIBCEC_VERSION -RUN apk add --no-cache eudev-libs p8-platform \ +RUN \ + if [[ "armhf armv7 aarch64" = *"$BUILD_ARCH"* ]]; then \ + apk add --no-cache raspberrypi-dev raspberrypi-libs; \ + fi \ + && apk add --no-cache \ + eudev-libs\ + p8-platform \ && apk add --no-cache --virtual .build-dependencies \ - build-base cmake eudev-dev git swig p8-platform-dev \ - && git clone --depth 1 -b libcec-${LIBCEC_VERSION} https://github.com/Pulse-Eight/libcec /usr/src/libcec \ + build-base \ + cmake \ + eudev-dev \ + git \ + p8-platform-dev \ + swig \ + && git clone --depth 1 -b libcec-${LIBCEC_VERSION} \ + "https://github.com/Pulse-Eight/libcec" /usr/src/libcec \ && mkdir -p /usr/src/libcec/build \ && cd /usr/src/libcec/build \ - && if [ "$BUILD_ARCH" != "armhf" ] && [ "$BUILD_ARCH" != "aarch64" ]; then \ + && if [[ "armhf armv7 aarch64" = *"$BUILD_ARCH"* ]]; then \ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..; \ else \ - cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ + cmake \ + -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ -DRPI_INCLUDE_DIR=/opt/vc/include \ -DRPI_LIB_DIR=/opt/vc/lib ..; \ fi \ && make -j$(nproc) \ && make install \ - && apk del .build-dependencies \ - && rm -rf /usr/src/libcec + && apk del --no-cache .build-dependencies \ + && if [[ "armhf armv7 aarch64" = *"$BUILD_ARCH"* ]]; then \ + apk del --no-cache raspberrypi-dev; \ + fi + ENV LD_LIBRARY_PATH=/opt/vc/lib:${LD_LIBRARY_PATH} # Copy data diff --git a/cec_scan/README.md b/cec_scan/README.md new file mode 100644 index 0000000..eb03ce6 --- /dev/null +++ b/cec_scan/README.md @@ -0,0 +1,52 @@ +# Hass.io Core Add-on: CEC Scanner + +Scan & discover HDMI CEC devices and their addresses. + +![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield] + +## About + +This add-on allows for scanning for CEC devices. It is useful for finding +the CEC address of your devices. + +## Installation + +The installation of this add-on is straightforward and easy to do. + +1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**. +2. Find the "CEC Scanner" add-on and click it. +3. Click on the "INSTALL" button. + +## How to use + +This add-on has no configuration and just runs out of the box. + +1. Start the add-on. +2. Check the add-on log output to see the result. + +## Known issues and limitations + +- This add-on can only be used on devices that support the Video Core (vc). + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Home Assistant Discord Chat Server][discord]. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +In case you've found an bug, please [open an issue on our GitHub][issue]. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg +[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg +[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg +[discord]: https://discord.gg/c5DvZ4e +[forum]: https://community.home-assistant.io +[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg +[issue]: https://github.com/home-assistant/hassio-addons/issues +[reddit]: https://reddit.com/r/homeassistant +[repository]: https://github.com/hassio-addons/repository diff --git a/cec_scan/config.json b/cec_scan/config.json index 98b7d68..f1585f8 100644 --- a/cec_scan/config.json +++ b/cec_scan/config.json @@ -1,10 +1,16 @@ { "name": "CEC Scanner", - "version": "2", + "version": "2.1", "slug": "cec_scan", - "description": "Scan HDMI CEC devices", - "url": "https://home-assistant.io/addons/cec_scan/", - "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], + "description": "Scan for HDMI CEC devices", + "url": "https://github.com/home-assistant/hassio-addons/tree/master/cec_scan", + "arch": [ + "armhf", + "armv7", + "aarch64", + "amd64", + "i386" + ], "startup": "once", "boot": "manual", "devices": [ diff --git a/cec_scan/run.sh b/cec_scan/run.sh index ffe1429..4b898e7 100755 --- a/cec_scan/run.sh +++ b/cec_scan/run.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bashio set -e +bashio::log.info "Starting CEC client scan..." echo scan | cec-client -s -d 1