@@ -8,3 +8,35 @@ def test_dispatch(basic_device):
8
8
basic_device .protocol_dispatch ([0x21 ]) # invalid length long
9
9
10
10
basic_device .hid_send .assert_not_called ()
11
+
12
+
13
+ def test_fw_info_vendor (basic_device ):
14
+ basic_device .protocol_dispatch ([0x20 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ])
15
+
16
+ basic_device .hid_send .assert_called_with (
17
+ [0x21 , 0x00 , 0x01 ] + list (b'openinput-git' ) + [0x00 ] * 16
18
+ )
19
+
20
+
21
+ def test_fw_info_version (basic_device , fw_version ):
22
+ basic_device .protocol_dispatch ([0x20 , 0x00 , 0x01 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 ])
23
+
24
+ basic_device .hid_send .assert_called_with (
25
+ [0x21 , 0x00 , 0x01 ] + list (fw_version .encode ('ascii' )) + [0x00 ] * (29 - len (fw_version ))
26
+ )
27
+
28
+
29
+ def test_fw_info_device_name (basic_device ):
30
+ basic_device .protocol_dispatch ([0x20 , 0x00 , 0x01 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 ])
31
+
32
+ basic_device .hid_send .assert_called_with (
33
+ [0x21 , 0x00 , 0x01 ] + list (b'basic test device' ) + [0x00 ] * 12
34
+ )
35
+
36
+
37
+ def test_fw_info_unsupported (basic_device ):
38
+ basic_device .protocol_dispatch ([0x20 , 0x00 , 0x01 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 ])
39
+
40
+ basic_device .hid_send .assert_called_with (
41
+ [0x21 , 0xFF , 0x01 , 0x00 , 0x01 ] + [0x00 ] * 27
42
+ )
0 commit comments