From 7a3797b097ce0c446730e690c207e88e6f12d0b1 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Mon, 5 Sep 2022 12:15:37 +0200 Subject: [PATCH] open in binary does not take an encoding --- src/usb_hid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usb_hid.py b/src/usb_hid.py index 113ac83..38e19b1 100644 --- a/src/usb_hid.py +++ b/src/usb_hid.py @@ -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: -- 2.49.0