pmaports/device/community/device-nokia-n900/acpi_handler.sh
Sicelo A. Mhlongo 730c56ed35
community/device-nokia-n900: x11: integrate screenshot utility (MR 5014)
Take screenshots in any x11 UI by depressing the camera key while keeping the
proximity sensor covered

This is a variation of [1] and [2] from postmarketOS/pmaports!4133.

[1] https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4133/diffs?commit_id=35007eaefd0e471634c74aad9294234ceed260ae
[2] https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4133/diffs?commit_id=0ef9ffe3928313b7afc5ce68ad0ec4487f1f2f11

Co-Authored-By: DvaMishkiLapa <thesame.personal@gmail.com>
Signed-off-By: Sicelo A. Mhlongo <absicsz@gmail.com>
2024-04-10 22:40:37 +09:00

67 lines
1.3 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
su $user -c 'DISPLAY=:0.0 /usr/bin/xset dpms force on'
su $user -c 'DISPLAY=:0.0 /usr/bin/xinput enable "TSC2005 touchscreen"'
;;
KP_SLIDE_CLOSE)
adjust_keypad_bl 0
;;
CAM_BTN_DWN)
USER_USER="$user" /usr/bin/proxishot.sh
;;
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