aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/ir/ir_loopback.sh
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-10-16 15:09:31 +0100
committerShuah Khan <shuah@kernel.org>2018-11-06 09:27:17 -0700
commite55c884ea5c66a29a713d41ed0819fee8038762b (patch)
tree4be86e1cfc950aba03dade75746c4cc00c56a91c /tools/testing/selftests/ir/ir_loopback.sh
parentLinux 4.20-rc1 (diff)
downloadwireguard-linux-e55c884ea5c66a29a713d41ed0819fee8038762b.tar.xz
wireguard-linux-e55c884ea5c66a29a713d41ed0819fee8038762b.zip
media: rc: self test for IR encoders and decoders
ir-loopback can transmit IR on one rc device and check the correct scancode and protocol is decoded on a different rc device. This can be used to check IR transmission between two rc devices. Using rc-loopback, we use it to check the IR encoders and decoders themselves. No hardware is required for this test. Signed-off-by: Sean Young <sean@mess.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to '')
-rwxr-xr-xtools/testing/selftests/ir/ir_loopback.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/ir/ir_loopback.sh b/tools/testing/selftests/ir/ir_loopback.sh
new file mode 100755
index 000000000000..0a0b8dfa39be
--- /dev/null
+++ b/tools/testing/selftests/ir/ir_loopback.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+if ! /sbin/modprobe -q -n rc-loopback; then
+ echo "ir_loopback: module rc-loopback is not found [SKIP]"
+ exit $ksft_skip
+fi
+
+/sbin/modprobe rc-loopback
+if [ $? -ne 0 ]; then
+ exit
+fi
+
+RCDEV=$(grep -l DRV_NAME=rc-loopback /sys/class/rc/rc*/uevent | grep -o 'rc[0-9]\+')
+
+./ir_loopback $RCDEV $RCDEV
+exit