summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-08-27 15:10:52 -0500
committerJeff Epler <jepler@gmail.com>2020-08-27 15:10:52 -0500
commita03b6a99e60c8c428d95bc78b1ee6948607f69c6 (patch)
treea992d1475fa9856c706fea7ac3f4a2efa357e93e /tools
parent49a22b0c551b60861853ab78a15387fa6637c96e (diff)
gen_usb_descriptor: Fix off-by-1 error in endpoint counting
Diffstat (limited to 'tools')
-rw-r--r--tools/gen_usb_descriptor.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index baee8cad7..adf0d8270 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -382,8 +382,9 @@ if args.max_ep != 0:
for interface in interfaces:
for subdescriptor in interface.subdescriptors:
endpoint_address = getattr(subdescriptor, 'bEndpointAddress', 0) & 0x7f
- if endpoint_address > args.max_ep:
- raise ValueError("Endpoint address %d of %s may not exceed %d" % (endpoint_address & 0x7f, interface.description, args.max_ep))
+ print("Endpoint %d - vs max_ep %d" % (endpoint_address, args.max_ep))
+ if endpoint_address >= args.max_ep:
+ raise ValueError("Endpoint address %d of %s must be less than %d" % (endpoint_address & 0x7f, interface.description, args.max_ep))
else:
print("Unable to check whether maximum number of endpoints is respected", file=sys.stderr)