diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-03-22 09:51:57 +1100 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-03-22 09:51:57 +1100 |
| commit | 15f85d8b73aab1c173cc5d075129ca4954c9d937 (patch) | |
| tree | 68db571bf6f8e7d78d14f65fb2cdf746d74a34a7 /scripts/set_rotation.sh | |
| parent | 3da8bb99114f41e914033d23cf7f48a5726a5384 (diff) | |
Add set_rotation.sh to scripts
Diffstat (limited to 'scripts/set_rotation.sh')
| -rwxr-xr-x | scripts/set_rotation.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/set_rotation.sh b/scripts/set_rotation.sh new file mode 100755 index 0000000..f3eb011 --- /dev/null +++ b/scripts/set_rotation.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +rotation="${1}" + +if [ "$#" -ne 1 ]; then + printf "Usage: $0 [angle]\n" + exit 1 +fi + +rise=$(awk -v ang=$1 'BEGIN { print int( sin(ang*2*atan2(1,0)/180.0) * 2^31-1 + 0.5) }') +run=$(awk -v ang=$1 'BEGIN { print int( cos(ang*2*atan2(1,0)/180.0) * 2^31-1 + 0.5) }') + +sudo su -c "echo ${rise} > /sys/module/hid/parameters/rise" +sudo su -c "echo ${run} > /sys/module/hid/parameters/run" |
