Skip to content

Commit c24f10e

Browse files
committed
Mount block device in test_cdc_msc.
1 parent 87150b7 commit c24f10e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/hitl/hitl_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
# THE SOFTWARE.
2323

2424
# udev rules :
25-
# SUBSYSTEM=="block", SUBSYSTEMS=="usb", MODE="0666", PROGRAM="/bin/sh -c 'echo $$ID_SERIAL_SHORT | rev | cut -c -8 | rev'", SYMLINK+="blkUSB_%c.%s{bInterfaceNumber}"
26-
# SUBSYSTEM=="tty", SUBSYSTEMS=="usb", MODE="0666", PROGRAM="/bin/sh -c 'echo $$ID_SERIAL_SHORT | rev | cut -c -8 | rev'", SYMLINK+="ttyUSB_%c.%s{bInterfaceNumber}"
25+
# ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", MODE="0666", PROGRAM="/bin/sh -c 'echo $$ID_SERIAL_SHORT | rev | cut -c -8 | rev'", SYMLINK+="ttyUSB_%c.%s{bInterfaceNumber}"
26+
# ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb", ENV{ID_FS_USAGE}=="filesystem", MODE="0666", PROGRAM="/bin/sh -c 'echo $$ID_SERIAL_SHORT | rev | cut -c -8 | rev'", RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode /media/blkUSB_%c.%s{bInterfaceNumber}"
2727

2828
import os
2929
import sys
@@ -80,16 +80,16 @@ def test_cdc_dual_ports(id):
8080

8181
def test_cdc_msc(id):
8282
port = f'/dev/ttyUSB_{id[-8:]}.00'
83-
block = f'/dev/blkUSB_{id[-8:]}.02'
83+
file = f'/media/blkUSB_{id[-8:]}.02/README.TXT'
8484
# Wait device enum
8585
timeout = 10
8686
while timeout:
87-
if os.path.exists(port) and os.path.exists(block):
87+
if os.path.exists(port) and os.path.isfile(file):
8888
break
8989
time.sleep(1)
9090
timeout = timeout - 1
9191

92-
assert os.path.exists(port) and os.path.exists(block), \
92+
assert os.path.exists(port) and os.path.isfile(file), \
9393
'Device not available'
9494

9595
# Echo test
@@ -100,18 +100,18 @@ def test_cdc_msc(id):
100100
str = b"test_str"
101101
ser1.write(str)
102102
ser1.flush()
103-
assert ser1.read(100) == str, 'Port wrong data'
103+
assert ser1.read(100) == str, 'CDC wrong data'
104104

105105
# Block test
106-
f = open(block, 'rb')
106+
f = open(file, 'rb')
107107
data = f.read()
108108

109109
readme = \
110110
b"This is tinyusb's MassStorage Class demo.\r\n\r\n\
111111
If you find any bugs or get any questions, feel free to file an\r\n\
112112
issue at github.com/hathach/tinyusb"
113113

114-
assert data[0x600:0x600 + len(readme)] == readme, 'Block wrong data'
114+
assert data == readme, 'MSC wrong data'
115115
print('cdc_msc test done')
116116

117117
def test_dfu(id):

0 commit comments

Comments
 (0)