summaryrefslogtreecommitdiff
path: root/src/extras/keymap/keyboard-force-release.sh.in
blob: 154be3d73356b9670c86da922b25a3db8b7b9c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!@rootprefix@/bin/sh -e
# read list of scancodes, convert hex to decimal and
# append to the atkbd force_release sysfs attribute
# $1 sysfs devpath for serioX
# $2 file with scancode list (hex or dec)

case "$2" in
	/*) scf="$2" ;;
	*)  scf="@pkglibexecdir@/keymaps/force-release/$2" ;;
esac

read attr <"/sys/$1/force_release"
while read scancode dummy; do
	case "$scancode" in
		\#*) ;;
		*)
			scancode=$(($scancode))
			attr="$attr${attr:+,}$scancode"
			;;
	esac
done <"$scf"
echo "$attr" >"/sys/$1/force_release"