@@ -28,6 +28,9 @@ def __init__(self, **args):
2828 if self ._dev .idVendor == 0x16C0 :
2929 self .set_output = self .set_output_dcttech
3030 self .get_output = self .get_output_dcttech
31+ elif self ._dev .idVendor == 0x5131 :
32+ self .set_output = self .set_output_lcus
33+ self .get_output = self .get_output_lcus
3134 else :
3235 raise ValueError (f"Unknown vendor/protocol for VID { self ._dev .idVendor :x} " )
3336
@@ -56,6 +59,20 @@ def get_output_dcttech(self, number):
5659 )
5760 return bool (resp [7 ] & (1 << (number - 1 )))
5861
62+ def set_output_lcus (self , number , status ):
63+ assert 1 <= number <= 8
64+ ep_in = self ._dev [0 ][(0 , 0 )][0 ]
65+ ep_out = self ._dev [0 ][(0 , 0 )][1 ]
66+ req = [0xA0 , number , 0x01 if status else 0x00 , 0x00 ]
67+ req [3 ] = sum (req ) & 0xFF
68+ ep_out .write (req )
69+ ep_in .read (64 )
70+
71+ def get_output_lcus (self , number ):
72+ assert 1 <= number <= 8
73+ # we have no information on how to read the current value
74+ return False
75+
5976 def __del__ (self ):
6077 usb .util .release_interface (self ._dev , 0 )
6178
0 commit comments