From 15f85d8b73aab1c173cc5d075129ca4954c9d937 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Sat, 22 Mar 2025 09:51:57 +1100 Subject: Add set_rotation.sh to scripts --- scripts/set_rotation.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/set_rotation.sh (limited to 'scripts') 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" -- cgit v1.2.3