Skip to content

Commit

Permalink
openpandora-scripts: synced with git.openpandora
Browse files Browse the repository at this point in the history
  • Loading branch information
aTc committed Mar 16, 2013
1 parent 892efdc commit 5ddf10e
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 15 deletions.
33 changes: 23 additions & 10 deletions recipes-openpandora/openpandora-system/openpandora-scripts.bb
Expand Up @@ -4,9 +4,9 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a42

COMPATIBLE_MACHINE = "openpandora"

RDEPENDS_${PN} = "zenity dbus xwininfo"
RDEPENDS_${PN} = "zenity dbus xwininfo procps"

PR = "r132"
PR = "r135"
SRC_URI = " \
file://LICENSE \
file://op_paths.sh \
Expand All @@ -30,6 +30,7 @@ SRC_URI = " \
file://op_startupmanager.pnd \
file://op_switchgui.sh \
file://op_switchgui.pnd \
file://nettool.pnd \
file://startnetbooklauncher \
file://startmmenu \
file://startpmenu \
Expand All @@ -42,6 +43,8 @@ SRC_URI = " \
file://op_usermanager.pnd \
file://op_lcdsettings.sh \
file://op_lcdsettings.pnd \
file://op_ledsettings.sh \
file://op_ledsettings.pnd \
file://op_cpusettings.sh \
file://op_cpusettings.pnd \
file://op_lcdrate.sh \
Expand All @@ -57,10 +60,11 @@ SRC_URI = " \
file://op_tvout.sh \
file://op_tvout.pnd \
file://ConfigModel.py \
file://TVoutConfig.py \
file://TVoutConfig.py \
file://op_inputtest.pnd \
file://gui.conf \
file://cpu.conf \
file://led.conf \
file://gamma.conf \
file://service.conf \
file://nub_profiles.conf \
Expand Down Expand Up @@ -91,7 +95,6 @@ SRC_URI = " \
file://op_hugetlb.sh \
file://op_gamma.sh \
"

do_install() {
install -d ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_paths.sh ${D}${prefix}/pandora/scripts/
Expand All @@ -111,6 +114,7 @@ do_install() {
install -m 0755 ${WORKDIR}/op_datetime.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_usermanager.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_lcdsettings.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_ledsettings.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_lcdrate.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_videofir.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_nubmode.py ${D}${prefix}/pandora/scripts/
Expand Down Expand Up @@ -144,6 +148,7 @@ do_install() {
install -m 0755 ${WORKDIR}/op_cpuspeed.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_datetime.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_lcdsettings.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_ledsettings.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_cpusettings.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_nubmode.pnd ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_startupmanager.pnd ${D}${prefix}/pandora/apps/
Expand All @@ -166,6 +171,7 @@ do_install() {
install -m 0755 ${WORKDIR}/thunar.pnd ${D}${prefix}/pandora/mmenu/
install -m 0755 ${WORKDIR}/xchat.pnd ${D}${prefix}/pandora/mmenu/
install -m 0755 ${WORKDIR}/gcalctool.pnd ${D}${prefix}/pandora/mmenu/
install -m 0755 ${WORKDIR}/nettool.pnd ${D}${prefix}/pandora/mmenu/

install -d ${D}${datadir}/applications/
install -m 0644 ${WORKDIR}/op_bluetooth.desktop ${D}${datadir}/applications/
Expand All @@ -175,6 +181,7 @@ do_install() {

install -d ${D}${sysconfdir}/pandora/conf/
install -m 0644 ${WORKDIR}/gui.conf ${D}${sysconfdir}/pandora/conf/gui.conf
install -m 0644 ${WORKDIR}/led.conf ${D}${sysconfdir}/pandora/conf/led.conf
install -m 0644 ${WORKDIR}/cpu.conf ${D}${sysconfdir}/pandora/conf/cpu.conf
install -m 0644 ${WORKDIR}/gamma.conf ${D}${sysconfdir}/pandora/conf/gamma.conf
install -m 0644 ${WORKDIR}/service.conf ${D}${sysconfdir}/pandora/conf/service.conf
Expand All @@ -195,13 +202,19 @@ do_install() {
install -m 0755 ${WORKDIR}/stopmmenu ${D}${bindir}/
}



PACKAGE_ARCH = "${MACHINE_ARCH}"

FILES_${PN} += "${prefix} ${datadir}"

CONFFILES_${PN} += "${sysconfdir}/pandora/conf/gui.conf"
CONFFILES_${PN} += "${sysconfdir}/pandora/conf/cpu.conf"
CONFFILES_${PN} += "${sysconfdir}/pandora/conf/gamma.conf"
CONFFILES_${PN} += "${sysconfdir}/pandora/conf/service.conf"
CONFFILES_${PN} += "${sysconfdir}/pandora/conf/nub_profiles.conf"
CONFFILES_${PN} += "${sysconfdir}/pandora/conf/tvout-profiles.conf"
CONFFILES_${PN} += " ${sysconfdir}/pandora/conf/gui.conf \
${sysconfdir}/pandora/conf/cpu.conf \
${sysconfdir}/pandora/conf/led.conf \
${sysconfdir}/pandora/conf/gamma.conf \
${sysconfdir}/pandora/conf/service.conf \
${sysconfdir}/pandora/conf/nub_profiles.conf \
${sysconfdir}/pandora/conf/tvout-profiles.conf \
"


@@ -0,0 +1,2 @@
LowPowerLED:16
HighPowerLED:255
Binary file not shown.
21 changes: 19 additions & 2 deletions recipes-openpandora/openpandora-system/openpandora-scripts/op_bluetooth_work.sh 100755 → 100644
Expand Up @@ -21,12 +21,29 @@ if [ "$1" = "1" ]; then
echo 0 > /sys/class/gpio/gpio15/value
exit 1
fi
echo 255 > '/sys/class/leds/pandora::bluetooth/brightness'
if [ -e /sys/class/leds/ ] ; then
for led in /sys/class/leds/* ; do
trigger=$(grep "$(basename $led)" /etc/default/leds | grep bluetooth | \
awk '{print $2}' )
if [ "$trigger" = "bluetooth" ] ; then
echo default-on > "$led/trigger"
echo 255 > "$led/brightness"
fi
done
fi
exit 0
elif [ "$1" = "0" ]; then
killall hciattach
echo 0 > /sys/class/gpio/gpio15/value
echo 0 > '/sys/class/leds/pandora::bluetooth/brightness'
if [ -e /sys/class/leds/ ] ; then
for led in /sys/class/leds/* ; do
trigger=$(grep "$(basename $led)" /etc/default/leds | grep bluetooth | \
awk '{print $2}' )
if [ "$trigger" = "bluetooth" ] ; then
echo 0 > "$led/brightness"
fi
done
fi
echo 10 > /sys/devices/platform/omap_uart.0/sleep_timeout
exit 0
else
Expand Down
Binary file not shown.
@@ -0,0 +1,103 @@
#!/bin/bash
# Released under the GPL
# LED-Settings, v1.0, written by Michael Mrozek aka EvilDragon 2013.

. /usr/pandora/scripts/op_paths.sh

while mainsel=$(zenity --title="LED-Settings" --width="400" --height="370" --list --column "id" --column "Please select" --hide-column=1 --text="Welcome to the LED-Settings-Dialogue.\n\nWhat do you want to do?\n" "normal" "Set Power LED Brightness (normal mode)" "power" "Set Power LED Brightness (powersave)" "sd1" "Enable / Disable SD1 LED" "sd2" "Enable / Disable SD2 LED" "wifi" "Enable / Disable WiFi LED" "bt" "Enable / Disable Bluetooth LED" --ok-label="Change Setting" --cancel-label="Exit"); do

case $mainsel in

"normal")
curbright=$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')
while newbright=$(zenity --scale --text "Set brightness of Power LED (normal mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
curbright=$newbright
echo $curbright > /sys/class/leds/pandora\:\:power/brightness
done
sed -i "s/.*HighPowerLED.*/HighPowerLED:$curbright/g" /etc/pandora/conf/led.conf
zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting has been saved." --timeout 6
;;

"power")
normbright=$(cat /sys/class/leds/pandora\:\:power/brightness)
curbright=$(cat /etc/pandora/conf/led.conf | grep LowPowerLED: | awk -F\: '{print $2}')
echo $curbright > /sys/class/leds/pandora\:\:power/brightness
while newbright=$(zenity --scale --text "Set brightness of Power LED (Powersave mode)" --min-value=0 --max-value=255 --value=$curbright --step 1 --ok-label="Set new brightness" --cancel-label="Save and exit"); do
curbright=$newbright
echo $curbright > /sys/class/leds/pandora\:\:power/brightness
done
sed -i "s/.*LowPowerLED.*/LowPowerLED:$curbright/g" /etc/pandora/conf/led.conf
zenity --info --title="Power LED Brightness Set" --text "The new power LED Brightness setting (Powersave mode) has been saved." --timeout 6
echo $normbright > /sys/class/leds/pandora\:\:power/brightness
;;

"sd1")
if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the LED for SD Card 1?" --ok-label="Enable it" --cancel-label="Disable it"; then
echo mmc0 > /sys/class/leds/pandora\:\:sd1/trigger
sed -i "s/.*pandora::sd1.*/pandora::sd1 mmc0/g" /etc/default/leds
else
echo none > /sys/class/leds/pandora\:\:sd1/trigger
sed -i "s/.*pandora::sd1.*/pandora::sd1 none/g" /etc/default/leds
fi
;;

"sd2")
if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the LED for SD Card 2?" --ok-label="Enable it" --cancel-label="Disable it"; then
echo mmc1 > /sys/class/leds/pandora\:\:sd2/trigger
sed -i "s/.*pandora::sd2.*/pandora::sd2 mmc1/g" /etc/default/leds
else
echo none > /sys/class/leds/pandora\:\:sd2/trigger
sed -i "s/.*pandora::sd2.*/pandora::sd2 none/g" /etc/default/leds
fi
;;

"bt")
if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the LED for the Bluetooth LED?" --ok-label="Enable it" --cancel-label="Disable it"; then
echo bluetooth > /sys/class/leds/pandora\:\:bluetooth/trigger
sed -i "s/.*pandora::bluetooth.*/pandora::bluetooth bluetooth/g" /etc/default/leds
if hciconfig "$INTERFACE" | grep UP &>/dev/null
then
echo default-on > /sys/class/leds/pandora\:\:bluetooth/trigger
echo 255 > /sys/class/leds/pandora\:\:bluetooth/brightness
fi
else
echo none > /sys/class/leds/pandora\:\:bluetooth/trigger
sed -i "s/.*pandora::bluetooth.*/pandora::bluetooth none/g" /etc/default/leds
fi
;;

"wifi")
if zenity --question --title="Enable / Disable LED?" --text="Do you want to enable or disable the WiFi LED?" --ok-label="Enable it" --cancel-label="Disable it"; then
sed -i "s/.*pandora::wifi.*/pandora::wifi phy0radio/g" /etc/default/leds
if [ "`lsmod | grep wl1251`" ]
then
phy_idx=0
for a in `seq 20` ; do
if [ -e /sys/class/net/wlan0 ] ; then
phy_idx=$(cat /sys/class/net/wlan0/phy80211/index)
break
else
sleep 0.2
fi
done

# restore phy related LED triggers (they come from mac80211.ko)
if [ -e /sys/class/leds/ ] ; then
for led in /sys/class/leds/* ; do
trigger=$(grep "$(basename $led)" /etc/default/leds | grep phy | \
awk '{print $2}' | sed -e 's/.*phy[0-9]*\(.*\)/\1/')
if [ "x$trigger" != "x" ] ; then
echo "phy${phy_idx}$trigger" > "$led/trigger"
fi
done
fi
fi
zenity --info --title="WiFi LED Set" --text "The WiFi LED has been enabled.\nPlease note: You need to disable and re-enable WiFi before it switches on again." --timeout 6
else
echo none > /sys/class/leds/pandora\:\:wifi/trigger
sed -i "s/.*pandora::wifi.*/pandora::wifi none/g" /etc/default/leds
fi
;;
esac
done

Expand Up @@ -5,6 +5,8 @@
# XXX: better use lockfile (or something), but it's not in current firmware
test -e /tmp/op_power.lock && exit 2
touch /tmp/op_power.lock
highpow="$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')"
lowpow="$(cat /etc/pandora/conf/led.conf | grep LowPowerLED: | awk -F\: '{print $2}')"

debug(){
return 1 # 0 when debugging, 1 when not
Expand Down Expand Up @@ -119,7 +121,7 @@ lowPowerOff(){ # switch from lowpower to normal mode
do
kill -CONT $PID
done
echo 255 > /sys/class/leds/pandora\:\:power/brightness #power LED bright
echo $highpow > /sys/class/leds/pandora\:\:power/brightness #power LED bright
}

display_on_with_checks() {
Expand Down Expand Up @@ -217,7 +219,7 @@ Please do not remove SD cards while pandora is suspended, doing so will corrupt

display_on
resume_net
echo 255 > /sys/class/leds/pandora\:\:power/brightness
echo $highpow > /sys/class/leds/pandora\:\:power/brightness

# wait here a bit to prevent this script from running again (keep op_power.lock)
# in case user did resume using the power switch.
Expand All @@ -228,7 +230,7 @@ Please do not remove SD cards while pandora is suspended, doing so will corrupt

suspend_() {
# dim power LED
echo 16 > /sys/class/leds/pandora\:\:power/brightness
echo $lowpow > /sys/class/leds/pandora\:\:power/brightness

if suspend_real; then
# resumed already
Expand Down

0 comments on commit 5ddf10e

Please sign in to comment.