summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2023-08-08 22:08:59 +0200
committerHiFiPhile <[email protected]>2023-08-08 22:08:59 +0200
commit992e17fb4833f102e23f8241ac1d7fea0985cb4e (patch)
treee24a5ed19d84239969e384d6f74024b2cdc03045
parentbffe321cd25681c5bab836098bde0f1aa215f5a7 (diff)
Add simple test for hid_boot_interface.
-rw-r--r--test/hitl/hitl_hfp.json8
-rw-r--r--test/hitl/hitl_test.py22
2 files changed, 26 insertions, 4 deletions
diff --git a/test/hitl/hitl_hfp.json b/test/hitl/hitl_hfp.json
index 426123288..866e5233f 100644
--- a/test/hitl/hitl_hfp.json
+++ b/test/hitl/hitl_hfp.json
@@ -23,6 +23,10 @@
"firmware": "examples/device/dfu_runtime/_build/stm32l412nucleo/dfu_runtime.elf"
},
{
+ "name": "hid_boot_interface",
+ "firmware": "examples/device/hid_boot_interface/_build/stm32l412nucleo/hid_boot_interface.elf"
+ },
+ {
"name": "board_test",
"firmware": "examples/device/board_test/_build/stm32l412nucleo/board_test.elf"
}
@@ -51,6 +55,10 @@
"firmware": "examples/device/dfu_runtime/_build/stm32f746disco/dfu_runtime.elf"
},
{
+ "name": "hid_boot_interface",
+ "firmware": "examples/device/hid_boot_interface/_build/stm32f746disco/hid_boot_interface.elf"
+ },
+ {
"name": "board_test",
"firmware": "examples/device/board_test/_build/stm32f746disco/board_test.elf"
}
diff --git a/test/hitl/hitl_test.py b/test/hitl/hitl_test.py
index dc6019470..695c6a28c 100644
--- a/test/hitl/hitl_test.py
+++ b/test/hitl/hitl_test.py
@@ -54,8 +54,7 @@ def test_cdc_dual_ports(id):
time.sleep(1)
timeout = timeout - 1
- assert os.path.exists(port1) and os.path.exists(port2), \
- 'Device not available'
+ assert timeout, 'Device not available'
# Echo test
ser1 = serial.Serial(port1)
@@ -89,8 +88,7 @@ def test_cdc_msc(id):
time.sleep(1)
timeout = timeout - 1
- assert os.path.exists(port) and os.path.isfile(file), \
- 'Device not available'
+ assert timeout, 'Device not available'
# Echo test
ser1 = serial.Serial(port)
@@ -170,6 +168,22 @@ def test_dfu_runtime(id):
print('dfu_runtime test done')
+def test_hid_boot_interface(id):
+ kbd = f'/dev/input/by-id/usb-TinyUSB_TinyUSB_Device_{id}-event-kbd'
+ mouse1 = f'/dev/input/by-id/usb-TinyUSB_TinyUSB_Device_{id}-if01-event-mouse'
+ mouse2 = f'/dev/input/by-id/usb-TinyUSB_TinyUSB_Device_{id}-if01-mouse'
+ # Wait device enum
+ timeout = 10
+ while timeout:
+ if os.path.exists(kbd) and os.path.exists(mouse1) and os.path.exists(mouse2):
+ break
+ time.sleep(1)
+ timeout = timeout - 1
+
+ assert timeout, 'Device not available'
+
+ print('hid_boot_interface test done')
+
def test_board_test(id):
# Dummy test
pass