Add simple test for hid_boot_interface.

This commit is contained in:
HiFiPhile 2023-08-08 22:08:59 +02:00
parent bffe321cd2
commit 992e17fb48
2 changed files with 26 additions and 4 deletions

View File

@ -22,6 +22,10 @@
"name": "dfu_runtime",
"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"
@ -50,6 +54,10 @@
"name": "dfu_runtime",
"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"

View File

@ -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