]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #606 from Neradoc/usb-hid-open-binary 8.2.1
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Tue, 6 Sep 2022 15:17:33 +0000 (08:17 -0700)
committerGitHub <noreply@github.com>
Tue, 6 Sep 2022 15:17:33 +0000 (08:17 -0700)
usb_hid: open in binary does not take an encoding

src/usb_hid.py

index 113ac83a2fbebe05d836b8925749b67ebf3acfb7..38e19b190528c8092248f07287f561c3b677c9f5 100644 (file)
@@ -60,7 +60,7 @@ class Device:
         """
         report_id = report_id or self.report_ids[0]
         device_path = self.get_device_path(report_id)
-        with open(device_path, "rb+", encoding="utf-8") as fd:
+        with open(device_path, "rb+") as fd:
             if report_id > 0:
                 report = bytearray(report_id.to_bytes(1, "big")) + report
             fd.write(report)
@@ -82,7 +82,7 @@ class Device:
         Return `None` if nothing received.
         """
         device_path = self.get_device_path(report_id or self.report_ids[0])
-        with open(device_path, "rb+", encoding="utf-8") as fd:
+        with open(device_path, "rb+") as fd:
             os.set_blocking(fd.fileno(), False)
             report = fd.read(self.out_report_lengths[0])
             if report is not None: