Skip to contentSkip to conversation

media: rc: self test for IR encoders and decoders

PATCH New sean at mess.org (Sean Young) 1 participant 3 messages Oct 16, 2018 – Nov 1, 2018

Subsystems (2)
lore
Share & tools
lore

sean at mess.org (Sean Young)

#0 lore raw

PATCH 1/1 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 at mess.org>
Cc Shuah Khan <shuah at kernel.org>
---
 tools/testing/selftests/Makefile          |   1 +
 tools/testing/selftests/ir/.gitignore     |   1 +
 tools/testing/selftests/ir/Makefile       |   5 +
 tools/testing/selftests/ir/ir_loopback.c  | 199 ++++++++++++++++++++++
 tools/testing/selftests/ir/ir_loopback.sh |  20 +++
 5 files changed, 226 insertions(+)
 create mode 100644 tools/testing/selftests/ir/.gitignore
 create mode 100644 tools/testing/selftests/ir/Makefile
 create mode 100644 tools/testing/selftests/ir/ir_loopback.c
 create mode 100755 tools/testing/selftests/ir/ir_loopback.sh
tools/testing/selftests/Makefile +1 -0
index f1fe492c8e17..995034ea5546 100644
@@ -15,6 +15,7 @@ TARGETS += futex
 TARGETS += gpio
 TARGETS += intel_pstate
 TARGETS += ipc
+TARGETS += ir
 TARGETS += kcmp
 TARGETS += kvm
 TARGETS += lib
tools/testing/selftests/ir/.gitignore new file +1 -0
new file mode 100644
index 000000000000..070ea0c75fb8
@@ -0,0 +1 @@
+ir_loopback
tools/testing/selftests/ir/Makefile new file +5 -0
new file mode 100644
index 000000000000..f4ba8eb84b95
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+TEST_PROGS := ir_loopback.sh
+TEST_GEN_PROGS_EXTENDED := ir_loopback
+
+include ../lib.mk
tools/testing/selftests/ir/ir_loopback.c new file +199 -0

199 lines not on this page · raw message

tools/testing/selftests/ir/ir_loopback.sh new file +20 -0
new file mode 100755
index 000000000000..0a0b8dfa39be
@@ -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
Signature · 1 line
2.17.2
#1 lore raw

PATCH 1/1 media: rc: self test for IR encoders and decoders

Quoted 9 lines · Sean Young

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 at mess.org>
Cc Shuah Khan <shuah at kernel.org>

Hi Sean,

This looks good. I will get this into the next release. It will show up in linux-kselftest next after 4.20-rc1 comes out.

thanks,
-- Shuah

#2 lore raw

PATCH 1/1 media: rc: self test for IR encoders and decoders

Hi Shuah,

Quoted 8 lines · Shuah Khan
Quoted 7 lines · Sean Young

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.

Quoted 7 lines
Quoted 2 lines
Signed-off-by Sean Young <sean at mess.org>
Cc Shuah Khan <shuah at kernel.org>

Hi Sean,

This looks good. I will get this into the next release. It will show up in linux-kselftest next after 4.20-rc1 comes out.

Great, thank you very much.

Regards,

Sean