From fb7445b54583281a531ff8025aa4205fe61e907a Mon Sep 17 00:00:00 2001 From: brindosch Date: Tue, 22 Mar 2016 01:01:54 +0100 Subject: [PATCH] Update Former-commit-id: 3c6ac5d2f618cd7499c16bca950ff3d41f855318 --- CompileHowto.txt | 2 +- ISSUE_TEMPLATE | 2 +- bin/install_hyperion.sh | 62 +++++++++++++++++++++++---- bin/remove_hyperion.sh | 1 + libsrc/leddevice/LedDeviceFactory.cpp | 2 +- 5 files changed, 58 insertions(+), 11 deletions(-) diff --git a/CompileHowto.txt b/CompileHowto.txt index da8f38c9..0aa3f059 100644 --- a/CompileHowto.txt +++ b/CompileHowto.txt @@ -27,7 +27,7 @@ cd "$HYPERION_DIR/build" cmake -DCMAKE_BUILD_TYPE=Release -Wno-dev .. # run cmake to generate make files on the raspberry pi WITH PWM SUPPORT cmake -DENABLE_WS2812BPWM=ON -DENABLE_WS281XPWM=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev .. -# or if you are not compiling on the raspberry pi and need to disable the Dispmanx grabber and support for spi devices +# or if you are not compiling on the raspberry pi (e.g. OrangePi) and need to disable the Dispmanx grabber and support for spi devices cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=OFF -DENABLE_X11=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev .. # as an alternative for the dispmanx grabber on non-rpi devices (e.g. cubox-i) you could try the framebuffer grabber cmake -DENABLE_DISPMANX=OFF -DENABLE_SPIDEV=OFF -DENABLE_FB=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev .. diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE index 7b2f9f22..e8f12f0a 100644 --- a/ISSUE_TEMPLATE +++ b/ISSUE_TEMPLATE @@ -4,5 +4,5 @@ Please check the wiki in case your problem is already known/feature requested.** **1.** Used hardware and sofware (Wetek,RPi1,Rpi2,... Ubuntu 14.04(64bit),OSX,OpenELEC,OSMC,XBian,...) **2.** Your LED device and additional hardware (if used) (WS2801,APA102,WS2812B,... connected through (direct,arduino uno,...)) **3.** Please upload your Hyperion log to pastebin.com and insert the link. Have a look at the wiki how you get one. -**4.** Please upload your "Hyperion Configuration File" to www.jsoneditoronline.org and insert the link. +**4.** Please upload your "Hyperion Configuration File" to pastebin.com and insert the link. diff --git a/bin/install_hyperion.sh b/bin/install_hyperion.sh index 5bdc5c2a..40ae503a 100755 --- a/bin/install_hyperion.sh +++ b/bin/install_hyperion.sh @@ -4,8 +4,18 @@ # Make sure /sbin is on the path (for service to find sub scripts) PATH="/sbin:$PATH" +#Check which arguments are used +if [ "$1" = "HyperConInstall" ] || [ "$2" = "HyperConInstall" ]; then + HCInstall=1 +else HCInstall=0 +fi +if [ "$1" = "WS281X" ] || [ "$2" = "WS281X" ]; then + PWM=1 +else PWM=0 +fi + #Check if HyperCon is logged in as root -if [ $(id -u) != 0 ] && [ "$1" = "HyperConInstall" ]; then +if [ $(id -u) != 0 ] && [ $HCInstall -eq 1 ]; then echo '---> Critical Error: Please connect as user "root" through HyperCon' echo '---> We need admin privileges to install/update your Hyperion! -> abort' exit 1 @@ -78,7 +88,7 @@ if [ $OS_OPENELEC -ne 1 ]; then fi #Check, if dtparam=spi=on is in place (not for OPENELEC) -if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then +if [ $PWM -ne 1 ] && [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then SPIOK=`grep '^\dtparam=spi=on' /boot/config.txt | wc -l` if [ $SPIOK -ne 1 ]; then echo '---> Raspberry Pi found, but SPI is not ready, we write "dtparam=spi=on" to /boot/config.txt' @@ -88,7 +98,7 @@ if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then fi #Check, if dtparam=spi=on is in place (just for OPENELEC) -if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then +if [ $PWM -ne 1 ] && [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then SPIOK=`grep '^\dtparam=spi=on' /flash/config.txt | wc -l` if [ $SPIOK -ne 1 ]; then mount -o remount,rw /flash @@ -98,6 +108,28 @@ if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then REBOOTMESSAGE="echo Please reboot your OpenELEC, we inserted dtparam=spi=on to /flash/config.txt" fi fi + +#Check, if dtoverlay=pwm is in place (not for OPENELEC) +#if [ $PWM -eq 1 ] && [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then +# PWMOK=`grep '^\dtoverlay=pwm' /boot/config.txt | wc -l` +# if [ $PWMOK -ne 1 ]; then +# echo '---> Raspberry Pi found, but PWM is not ready, we write "dtoverlay=pwm" to /boot/config.txt' +# sed -i '$a dtoverlay=pwm' /boot/config.txt +# PWMREBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtoverlay=pwm to /boot/config.txt" +# fi +#fi + +#Check, if dtoverlay=pwm is in place (just for OPENELEC) +if [ $PWM -eq 1 ] && [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then + PWMOK=`grep '^\dtoverlay=pwm' /flash/config.txt | wc -l` + if [ $PWMOK -ne 1 ]; then + mount -o remount,rw /flash + echo '---> Raspberry Pi with OpenELEC found, but PWM is not ready, we write "dtoverlay=pwm" to /flash/config.txt' + sed -i '$a dtoverlay=pwm' /flash/config.txt + mount -o remount,ro /flash + PWMREBOOTMESSAGE="echo Please reboot your OpenELEC, we inserted dtoverlay=pwm to /flash/config.txt" + fi +fi #Backup the .conf files, if present echo '---> Backup Hyperion configuration(s), if present' rm -f /tmp/*.json 2>/dev/null @@ -177,16 +209,29 @@ elif [ $OS_OPENELEC -eq 1 ]; then echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /dev/null 2>&1 &" >> /storage/.config/autostart.sh chmod +x /storage/.config/autostart.sh fi + # only add hyperion-x11 to startup, if not found and x32x64 detected + if [ $CPU_X32X64 -eq 1 ] && [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperion-x11 | wc -l` -eq 0 ]; then + echo '---> Adding Hyperion-x11 to OpenELEC autostart.sh' + echo "DISPLAY=:0.0 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-x11 /dev/null 2>&1 &" >> /storage/.config/autostart.sh + fi elif [ $USE_SYSTEMD -eq 1 ]; then echo '---> Installing systemd script' #place startup script for systemd and activate #Problem with systemd to enable symlinks - Bug? Workaround cp -n (overwrite never) - #Bad workaround for Jessie users that used the official script for install + #Bad workaround for Jessie (systemd) users that used the official script for install update-rc.d -f hyperion remove 2>/dev/null rm /etc/init.d/hyperion 2>/dev/null cp -n /opt/hyperion/init.d/hyperion.systemd.sh /etc/systemd/system/hyperion.service systemctl -q enable hyperion.service - if [ $OS_OSMC -eq 1 ]; then + if [ $PWM -eq 1 ] && [ $OS_OSMC -eq 1 ]; then + echo '---> Modify systemd script for OSMC usage (PWM Support)' + # Wait until kodi is sarted (for xbmc checker) and FIX user in case it is wrong (need root for access to pwm!)! + sed -i '/After = mediacenter.service/d' /etc/systemd/system/hyperion.service + sed -i '/Unit/a After = mediacenter.service' /etc/systemd/system/hyperion.service + sed -i 's/User=osmc/User=root/g' /etc/systemd/system/hyperion.service + sed -i 's/Group=osmc/Group=root/g' /etc/systemd/system/hyperion.service + systemctl -q daemon-reload + elif [ $OS_OSMC -eq 1 ]; then echo '---> Modify systemd script for OSMC usage' # Wait until kodi is sarted (for xbmc checker) and replace user (for remote control through osmc) sed -i '/After = mediacenter.service/d' /etc/systemd/system/hyperion.service @@ -226,15 +271,16 @@ echo 'Please get a new HyperCon version to benefit from the latest features!' echo 'Create a new config file, if you encounter problems!' $HINTMESSAGE $REBOOTMESSAGE +$PWMREBOOTMESSAGE echo '*******************************************************************************' ## Force reboot and prevent prompt if spi is added during a HyperCon Install -if [ "$1" = "HyperConInstall" ] && [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then - echo "Rebooting now, we added dtparam=spi=on to config.txt" +if ( [ "$HCInstall" = "1" ] && [ "$CPU_RPI" = "1" ] ) && ( [ "$SPIOK" = "0" ] || [ "$PWMOK" = "0" ] ); then + echo "Rebooting now, we added dtparam=spi=on and/or dtoverlay=pwm to config.txt" reboot exit 0 fi #Prompt for reboot, if spi added to config.txt -if [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ];then +if ( [ "$CPU_RPI" = "1" ] ) && ( [ "$SPIOK" = "0" ] || [ "$PWMOK" = "0" ] ); then while true do echo -n "---> Do you want to reboot your Raspberry Pi now? (y or n) :" diff --git a/bin/remove_hyperion.sh b/bin/remove_hyperion.sh index 1b56b84c..8ce5fd38 100644 --- a/bin/remove_hyperion.sh +++ b/bin/remove_hyperion.sh @@ -70,6 +70,7 @@ elif [ $OS_OPENELEC -eq 1 ]; then # Remove Hyperion from OpenELEC autostart.sh echo "---> Remove Hyperion from OpenELEC autostart.sh" sed -i "/hyperiond/d" /storage/.config/autostart.sh 2>/dev/null + sed -i "/hyperion-x11/d" /storage/.config/autostart.sh 2>/dev/null elif [ $USE_SYSTEMD -eq 1 ]; then # Delete and disable Hyperion systemd script echo '---> Delete and disable Hyperion systemd script' diff --git a/libsrc/leddevice/LedDeviceFactory.cpp b/libsrc/leddevice/LedDeviceFactory.cpp index e693ae7c..3c925e8d 100755 --- a/libsrc/leddevice/LedDeviceFactory.cpp +++ b/libsrc/leddevice/LedDeviceFactory.cpp @@ -180,7 +180,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig) device = deviceLightpack; } - else if (type == "multi-lightpack" || type == "multi_lightpack") + else if (type == "multi-lightpack") { LedDeviceMultiLightpack* deviceLightpack = new LedDeviceMultiLightpack(); deviceLightpack->open();