Skip to content

Commit

Permalink
Merge pull request #205 from ktnyt/hid-multiple-reports
Browse files Browse the repository at this point in the history
Modify to allow multiple reports in an Application collection
  • Loading branch information
dhalbert authored Nov 13, 2024
2 parents 6afb85a + 04c74d4 commit 7c6c18f
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions adafruit_ble/services/standard/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,24 +442,27 @@ 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 7c6c18f

Please sign in to comment.