Last active
June 5, 2020 16:21
-
-
Save ACamposPT/4b85789d8c6db6c9beacbd27a29826ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Auto read accelerometer data stream | |
# OEM install shutdown iio-sensor-proxy service | |
# Avoid need restart system after OEM Install | |
STATUS="$(systemctl is-active iio-sensor-proxy.service)" | |
if [ "${STATUS}" = "active" ]; then | |
echo "iio-sensor-proxy.service is active" | |
else | |
echo "iio-sensor-proxy.service is not active" | |
sudo systemctl start iio-sensor-proxy.service | |
fi | |
# Clear acceldata.log so it doesn't get too long over time | |
> /tmp/acceldata.log | |
# Get accelerometer input device info | |
source input-device-info.sh | |
MY_DEVICE_PATH=$(inputDeviceEventHandlerPath "cmpc_accel_v4") | |
echo 'MY_DEVICE_PATH:' ${MY_DEVICE_PATH} | |
# Read accelerometer data stream | |
cat ${MY_DEVICE_PATH} >> /tmp/acceldata.log 2>&1 & | |
while true; do | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment