pmaports/device/community/device-nokia-n900/acpi_handler.sh
Sicelo A. Mhlongo d5ee14fc28
device-nokia-n900: improve handling of slidey key (MR 4988)
The handling for the lock key is currently unreliable (racy?). In many cases,
you have to toggle it twice to turn display off. Fix this by handling it via
acpid. Since the scripts currently depend on X11 tools, move them to the x11
subpackage. They can be moved back to the main device package in future when
Wayland support has been implemented.

Block i3 from handling the lock key to avoid additional races.
2024-04-03 07:57:51 +02:00

65 lines
1.2 KiB
Bash

#!/bin/ash
user=$( getent passwd 10000 | cut -d: -f1 )
cmd=$( echo $0 | awk '{i=split($0,a,"/"); print a[i]}' )
function adjust_keypad_bl {
for i in $(seq 1 6); do
echo $1 > /sys/class/leds/lp5523\:kb$i/brightness
done
}
case $cmd in
KP_SLIDE_OPEN)
adjust_keypad_bl 63
;;
KP_SLIDE_CLOSE)
adjust_keypad_bl 0
;;
CAM_BTN_DWN)
echo "Not implemented yet"
;;
CAM_BTN_UP)
echo "Not implemented yet"
;;
CAM_FOCUS_DWN)
echo "Not implemented yet"
;;
CAM_FOCUS_UP)
echo "Not implemented yet"
;;
CAM_LID_CLOSE)
echo "Not implemented yet"
;;
CAM_LID_OPEN)
echo "Not implemented yet"
;;
SCRNLCK_DWN)
su $user -c "DISPLAY=:0 /usr/bin/lock.sh"
;;
SCRNLCK_UP)
echo "Not implemented yet"
;;
HEADPHONE_INSERT)
alsactl restore -f /var/lib/alsa/asound.state.headset
;;
HEADPHONE_REMOVE)
alsactl restore -f /var/lib/alsa/asound.state.speakers
;;
MICROPHONE_INSERT)
echo "Not implemented yet"
;;
MICROPHONE_REMOVE)
echo "Not implemented yet"
;;
VIDEOOUT_INSERT)
echo "Not implemented yet"
;;
VIDEOOUT_REMOVE)
echo "Not implemented yet"
;;
*)
echo "Unknown event"
exit 1
;;
esac