File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818from serial .win32 import FILE_FLAG_OVERLAPPED , INVALID_HANDLE_VALUE , CreateFile
1919import winKernel
2020from logHandler import log
21- from .base import IoBase , _isDebug
21+ from .base import IoBase , _isDebug
2222import hidpi
2323
2424
@@ -180,6 +180,7 @@ def __init__(
180180 self ._writeSize = caps .OutputReportByteLength
181181 self ._readSize = caps .InputReportByteLength
182182 # Reading any less than caps.InputReportByteLength is an error.
183+ self ._isClosed = False
183184 super ().__init__ (
184185 handle ,
185186 onReceive ,
@@ -318,7 +319,10 @@ def setOutputReport(self, report: bytes) -> None:
318319 raise ctypes .WinError ()
319320
320321 def close (self ):
322+ if self ._isClosed :
323+ pass
321324 super (Hid , self ).close ()
322325 winKernel .closeHandle (self ._file )
323326 self ._file = None
324327 hidDll .HidD_FreePreparsedData (self ._pd )
328+ self ._isClosed = True
You can’t perform that action at this time.
0 commit comments