Skip to content

Commit

Permalink
Modify to allow multiple reports in an Application collection
Browse files Browse the repository at this point in the history
  • Loading branch information
ktnyt committed Oct 19, 2024
1 parent d179868 commit a3a71da
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions adafruit_ble/services/standard/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
)

0 comments on commit a3a71da

Please sign in to comment.