42 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4# Kselftest framework requirement - SKIP code is 4.5ksft_skip=46ret=$ksft_skip7 8msg="skip all tests:"9if [ $UID != 0 ]; then10 echo $msg please run this as root >&211 exit $ksft_skip12fi13 14GREEN='\033[0;92m'15RED='\033[0;31m'16NC='\033[0m' # No Color17 18modprobe rc-loopback19 20for i in /sys/class/rc/rc*21do22 if grep -q DRV_NAME=rc-loopback $i/uevent23 then24 LIRCDEV=$(grep DEVNAME= $i/lirc*/uevent | sed sQDEVNAME=Q/dev/Q)25 INPUTDEV=$(grep DEVNAME= $i/input*/event*/uevent | sed sQDEVNAME=Q/dev/Q)26 fi27done28 29if [ -n "$LIRCDEV" ];30then31 TYPE=lirc_mode232 ./test_lirc_mode2_user $LIRCDEV $INPUTDEV33 ret=$?34 if [ $ret -ne 0 ]; then35 echo -e ${RED}"FAIL: $TYPE"${NC}36 else37 echo -e ${GREEN}"PASS: $TYPE"${NC}38 fi39fi40 41exit $ret42