test_lirc_mode2.sh 650 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. # Kselftest framework requirement - SKIP code is 4.
  4. ksft_skip=4
  5. msg="skip all tests:"
  6. if [ $UID != 0 ]; then
  7. echo $msg please run this as root >&2
  8. exit $ksft_skip
  9. fi
  10. GREEN='\033[0;92m'
  11. RED='\033[0;31m'
  12. NC='\033[0m' # No Color
  13. modprobe rc-loopback
  14. for i in /sys/class/rc/rc*
  15. do
  16. if grep -q DRV_NAME=rc-loopback $i/uevent
  17. then
  18. LIRCDEV=$(grep DEVNAME= $i/lirc*/uevent | sed sQDEVNAME=Q/dev/Q)
  19. fi
  20. done
  21. if [ -n $LIRCDEV ];
  22. then
  23. TYPE=lirc_mode2
  24. ./test_lirc_mode2_user $LIRCDEV
  25. ret=$?
  26. if [ $ret -ne 0 ]; then
  27. echo -e ${RED}"FAIL: $TYPE"${NC}
  28. else
  29. echo -e ${GREEN}"PASS: $TYPE"${NC}
  30. fi
  31. fi