Skip to content

Commit 7c6c18f

Browse files
authored
Merge pull request #205 from ktnyt/hid-multiple-reports
Modify to allow multiple reports in an Application collection
2 parents 6afb85a + 04c74d4 commit 7c6c18f

File tree

1 file changed

+21
-18
lines changed
  • adafruit_ble/services/standard

1 file changed

+21
-18
lines changed

adafruit_ble/services/standard/hid.py

+21-18
Original file line numberDiff line numberDiff line change
@@ -442,24 +442,27 @@ def get_report_info(collection: Dict, reports: Dict) -> None:
442442
usage = collection["locals"][0][0]
443443
reports = {}
444444
get_report_info(collection, reports)
445-
if len(reports) > 1:
446-
raise NotImplementedError(
447-
"Only one report id per Application collection supported"
448-
)
449-
450-
report_id, report = list(reports.items())[0]
451-
output_size = report["output_size"]
452-
if output_size > 0:
453-
self.devices.append(
454-
ReportOut(
455-
self, report_id, usage_page, usage, max_length=output_size // 8
445+
for report_id, report in reports:
446+
output_size = report["output_size"]
447+
if output_size > 0:
448+
self.devices.append(
449+
ReportOut(
450+
self,
451+
report_id,
452+
usage_page,
453+
usage,
454+
max_length=output_size // 8,
455+
)
456456
)
457-
)
458457

459-
input_size = reports[report_id]["input_size"]
460-
if input_size > 0:
461-
self.devices.append(
462-
ReportIn(
463-
self, report_id, usage_page, usage, max_length=input_size // 8
458+
input_size = reports[report_id]["input_size"]
459+
if input_size > 0:
460+
self.devices.append(
461+
ReportIn(
462+
self,
463+
report_id,
464+
usage_page,
465+
usage,
466+
max_length=input_size // 8,
467+
)
464468
)
465-
)

0 commit comments

Comments
 (0)