Skip to content

Commit 06715c3

Browse files
Merge 929f290 into 233d81a
2 parents 233d81a + 929f290 commit 06715c3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

source/hwIo/hid.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from serial.win32 import FILE_FLAG_OVERLAPPED, INVALID_HANDLE_VALUE, CreateFile
1919
import winKernel
2020
from logHandler import log
21-
from .base import IoBase, _isDebug
21+
from .base import IoBase, _isDebug
2222
import 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

0 commit comments

Comments
 (0)