From a3a71da03f023e47daf45e9035930761748e1b1e Mon Sep 17 00:00:00 2001 From: ktnyt Date: Sat, 19 Oct 2024 20:03:53 +0900 Subject: [PATCH] Modify to allow multiple reports in an Application collection --- adafruit_ble/services/standard/hid.py | 31 +++++++++++---------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/adafruit_ble/services/standard/hid.py b/adafruit_ble/services/standard/hid.py index 6409f21..b0834c1 100755 --- a/adafruit_ble/services/standard/hid.py +++ b/adafruit_ble/services/standard/hid.py @@ -442,24 +442,19 @@ def get_report_info(collection: Dict, reports: Dict) -> None: usage = collection["locals"][0][0] reports = {} get_report_info(collection, reports) - if len(reports) > 1: - raise NotImplementedError( - "Only one report id per Application collection supported" - ) - - report_id, report = list(reports.items())[0] - output_size = report["output_size"] - if output_size > 0: - self.devices.append( - ReportOut( - self, report_id, usage_page, usage, max_length=output_size // 8 + for report_id, report in reports: + output_size = report["output_size"] + if output_size > 0: + self.devices.append( + ReportOut( + self, report_id, usage_page, usage, max_length=output_size // 8 + ) ) - ) - input_size = reports[report_id]["input_size"] - if input_size > 0: - self.devices.append( - ReportIn( - self, report_id, usage_page, usage, max_length=input_size // 8 + input_size = reports[report_id]["input_size"] + if input_size > 0: + self.devices.append( + ReportIn( + self, report_id, usage_page, usage, max_length=input_size // 8 + ) ) - )