Skip to content

Commit

Permalink
hid: fix usage
Browse files Browse the repository at this point in the history
  • Loading branch information
daringer committed Jun 26, 2024
1 parent 004021a commit 300ee7d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def open(self) -> None:
# This would get HID_DEVICE into broken state
raise SPSDKError("Can't open already opened device")
try:
self._device = hid.device.open_path(self.path)
self._device = hid.Device(path=self.path)
except Exception as error:
raise SPSDKConnectionError(
f"Unable to open device '{str(self)}'"
Expand Down Expand Up @@ -109,7 +109,7 @@ def read(self, length: int, timeout: Optional[int] = None) -> bytes:
if not self._device:
raise SPSDKConnectionError("Device is not opened for reading")
try:
data = self._device.read(length, timeout_ms=timeout)
data = self._device.read(length, timeout=timeout)
except Exception as e:
raise SPSDKConnectionError(str(e)) from e
if not data:
Expand All @@ -128,7 +128,7 @@ def write(self, data: bytes, timeout: Optional[int] = None) -> None:
if not self._device:
raise SPSDKConnectionError("Device is not opened for writing")
try:
bytes_written = self._device.write(data, timeout_ms=timeout)
bytes_written = self._device.write(data)
except Exception as e:
raise SPSDKConnectionError(str(e)) from e
if bytes_written < 0 or bytes_written < len(data):
Expand Down

0 comments on commit 300ee7d

Please sign in to comment.