Skip to content

Commit a03b6a9

Browse files
committed
gen_usb_descriptor: Fix off-by-1 error in endpoint counting
1 parent 49a22b0 commit a03b6a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/gen_usb_descriptor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,9 @@ def strings_in_order(cls):
382382
for interface in interfaces:
383383
for subdescriptor in interface.subdescriptors:
384384
endpoint_address = getattr(subdescriptor, 'bEndpointAddress', 0) & 0x7f
385-
if endpoint_address > args.max_ep:
386-
raise ValueError("Endpoint address %d of %s may not exceed %d" % (endpoint_address & 0x7f, interface.description, args.max_ep))
385+
print("Endpoint %d - vs max_ep %d" % (endpoint_address, args.max_ep))
386+
if endpoint_address >= args.max_ep:
387+
raise ValueError("Endpoint address %d of %s must be less than %d" % (endpoint_address & 0x7f, interface.description, args.max_ep))
387388
else:
388389
print("Unable to check whether maximum number of endpoints is respected", file=sys.stderr)
389390

0 commit comments

Comments
 (0)