cec_scan: Refactor of add-on, added README (#587)

* cec_scan: Refactor of add-on, added README

* cec_scan: Set shell to bash
This commit is contained in:
Franck Nijhof
2019-06-01 21:49:41 +02:00
committed by Pascal Vizeli
parent f09bf73865
commit 7e6adcab32
5 changed files with 93 additions and 20 deletions

View File

@@ -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

View File

@@ -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

52
cec_scan/README.md Normal file
View File

@@ -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

View File

@@ -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": [

View File

@@ -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