Skip to content

Commit

Permalink
openpandora-scripts-wifi: converted from old firmware recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
aTc committed Aug 14, 2013
1 parent 0f0c495 commit 03ec400
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 0 deletions.
44 changes: 44 additions & 0 deletions recipes-openpandora/openpandora-system/openpandora-scripts-wifi.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
DESCRIPTION = "Scripts to support system options on the OpenPandora."
LICENSE = "GPLV2"
LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"

COMPATIBLE_MACHINE = "openpandora"

RDEPENDS = "openpandora-scripts"

PR = "r2"

SRC_URI = " \
file://LICENSE \
file://op_wifi.sh \
file://op_wifi.pnd \
file://nettool.pnd \
file://op_bluetooth.sh \
file://op_bluetooth_work.sh \
file://op_bluetooth-check.desktop \
file://op_bluetooth.desktop \
"

do_install() {
install -d ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_wifi.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_bluetooth.sh ${D}${prefix}/pandora/scripts/
install -m 0755 ${WORKDIR}/op_bluetooth_work.sh ${D}${prefix}/pandora/scripts/

install -d ${D}${prefix}/pandora/apps/
install -m 0755 ${WORKDIR}/op_wifi.pnd ${D}${prefix}/pandora/apps/

install -d ${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/

install -d ${D}${sysconfdir}/xdg/autostart/
install -m 0644 ${WORKDIR}/op_bluetooth-check.desktop ${D}${sysconfdir}/xdg/autostart/op_bluetooth-check.desktop

}

PACKAGE_ARCH = "${MACHINE_ARCH}"

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

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Check Bluetooth Status
Comment=Check the status of your Bluetooth device and enable if desired.
StartupNotify=false
Exec=/usr/pandora/scripts/op_bluetooth.sh startup
Icon=bluetooth
Terminal=false
Type=Application
Categories=System;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Toggle Bluetooth Status
Comment=Toggle the status of your Bluetooth device.
StartupNotify=false
Exec=/usr/pandora/scripts/op_bluetooth.sh
Icon=bluetooth
Terminal=false
Type=Application
Categories=System;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
#
# Released under the GPL

INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`"
LOCK=".op_btenabled"
cd "$HOME"

if [ "$1" = "startup" ]; then
if [ -f "$LOCK" ]; then
sudo /usr/pandora/scripts/op_bluetooth_work.sh 1
INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`"
sudo /usr/sbin/hciconfig "$INTERFACE" up pscan 1>/dev/null && sudo /usr/sbin/bluetoothd
else
echo "Bluetooth: User has not enabled Bluetooth."
fi
else
# Figure out if Bluetooth is running or not

if hciconfig "$INTERFACE" | grep UP &>/dev/null
then
notify-send -u normal "Bluetooth" "Bluetooth is being disabled..." -i blueman -t 5000
sudo /usr/sbin/hciconfig ${INTERFACE} down 1>/dev/null
sudo /usr/pandora/scripts/op_bluetooth_work.sh 0
rm -f "$LOCK"
else
if ! sudo /usr/pandora/scripts/op_bluetooth_work.sh 1; then
notify-send -u normal "Bluetooth" "Bluetooth error" -i blueman -t 3000
exit 1
fi

pgrep bluetoothd
echo $INTERFACE
if [ $? -ne 1 ]; then
notify-send -u normal "Bluetooth" "Bluetooth is being enabled..." -i blueman -t 5000
sudo /usr/sbin/hciconfig ${INTERFACE} down 1>/dev/null
sudo /usr/sbin/hciconfig ${INTERFACE} up pscan 1>/dev/null
sudo /usr/sbin/bluetoothd 1>/dev/null
touch "$LOCK"
fi
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh

kernel_major=`uname -r | cut -c 1`
if [ "$kernel_major" = "2" ]; then
# new kernel only (for now)
exit 0
fi

if [ "$1" = "1" ]; then
if [ ! -e /sys/class/gpio/gpio15/value ]; then
echo 15 > /sys/class/gpio/export
sleep 0.2
echo out > /sys/class/gpio/gpio15/direction
fi
echo 0 > /sys/devices/platform/omap_uart.0/sleep_timeout
echo 1 > /sys/class/gpio/gpio15/value
hciattach /dev/ttyO0 texasalt 3000000
INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`"
if [ -z "$INTERFACE" ]; then
killall hciattach
echo 0 > /sys/class/gpio/gpio15/value
exit 1
fi
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
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
echo "invalid argument"
exit 1
fi

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# Released under the GPL

# This script simply toggles internal WiFi on or off.
cd /
if [ "`lsmod | grep wl1251`" ]
then
notify-send -u normal "WLAN" "WLAN is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-no-connection.png
ifconfig wlan0 down
rmmod board_omap3pandora_wifi wl1251_sdio wl1251
else
notify-send -u normal "WLAN" "WLAN is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/nm-device-wired.png
/etc/init.d/wl1251-init start
fi

0 comments on commit 03ec400

Please sign in to comment.