test_gsensor.sh 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # test_gsensor.sh
  3. echo "=== Gsensor API Test ==="
  4. echo ""
  5. echo "1. Enable sensor:"
  6. echo 1 > /sys/kernel/vfiec/gsensor/enable
  7. echo " enable = $(cat /sys/kernel/vfiec/gsensor/enable)"
  8. echo ""
  9. echo "2. Screen orientation (string):"
  10. echo " $(cat /sys/kernel/vfiec/gsensor/screen_orientation)"
  11. echo ""
  12. echo "3. Instantaneous orientation (hex):"
  13. echo " $(cat /sys/kernel/vfiec/gsensor/instantaneous_orientation)"
  14. echo ""
  15. echo "4. Mode:"
  16. echo " $(cat /sys/kernel/vfiec/gsensor/mode)"
  17. echo ""
  18. echo "5. State:"
  19. echo " $(cat /sys/kernel/vfiec/gsensor/state)"
  20. echo ""
  21. echo "6. Raw data (X Y Z mg):"
  22. echo " $(cat /sys/kernel/vfiec/gsensor/raw_data)"
  23. echo ""
  24. echo "7. Test orientation change (rotate device now):"
  25. for i in {1..10}; do
  26. echo -n " [$i] "
  27. cat /sys/kernel/vfiec/gsensor/screen_orientation
  28. sleep 1
  29. done
  30. echo ""
  31. echo "8. Disable sensor:"
  32. echo 0 > /sys/kernel/vfiec/gsensor/enable
  33. echo " enable = $(cat /sys/kernel/vfiec/gsensor/enable)"
  34. echo ""
  35. echo "=== Test completed ==="