for module in ["dwc2", "libcomposite"]:
if Path("/proc/modules").read_text(encoding="utf-8").find(module) == -1:
- raise Exception(
+ raise Exception( # pylint: disable=broad-exception-raised
"%s module not present in your kernel. did you insmod it?" % module
)
this = sys.modules[__name__]
"""
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)
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: