summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKevin Banks <kevin@firia.com>2021-02-03 18:51:48 -0600
committerKevin Banks <kevin@firia.com>2021-02-03 18:51:48 -0600
commitf2067730cb1986d0b325cd22545da1a0d48920aa (patch)
treeb3290a59d080ed791e2af09263267db452139cba /tools
parent215a56c920b64d522e505d20e1480859fd0ea333 (diff)
Code cleanup and added a WEBUSB_README file
Diffstat (limited to 'tools')
-rw-r--r--tools/gen_usb_descriptor.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index 05d35ffc4..ad68d0ea9 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -2,21 +2,6 @@
#
# SPDX-License-Identifier: MIT
-def fix_note(note):
- index = note.rfind(" object at")
- if index >= 0:
- note = note[:index] + ">"
- return note
-
-def fix_notes(notes):
- count = len(notes)
- index = 0
- while index < count:
- notes[index] = fix_note(notes[index])
- index += 1
-
- return notes
-
import argparse
import os
@@ -389,8 +374,7 @@ audio_control_interface = standard.InterfaceDescriptor(
# Audio streaming interfaces must occur before MIDI ones.
audio_interfaces = [audio_control_interface] + cs_ac_interface.audio_streaming_interfaces + cs_ac_interface.midi_streaming_interfaces
-# TODO New code goes here to create vendor objects
-# Starting out with a clone-and-modify of the HID descriptors
+# Vendor-specific interface, for example WebUSB
vendor_endpoint_in_descriptor = standard.EndpointDescriptor(
description="VENDOR in",
bEndpointAddress=args.vendor_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
@@ -407,9 +391,9 @@ vendor_endpoint_out_descriptor = standard.EndpointDescriptor(
if 'VENDOR' in args.devices:
vendor_interface = standard.InterfaceDescriptor(
description="VENDOR",
- bInterfaceClass=0xff, # vendor.VENDOR_CLASS,
- bInterfaceSubClass=0x00, #vendor.VENDOR_SUBCLASS_???,,
- bInterfaceProtocol=0x00, #vendor.VENDOR_PROTOCOL_NONE,
+ bInterfaceClass=0xff, # Vendor-specific
+ bInterfaceSubClass=0x00,
+ bInterfaceProtocol=0x00,
iInterface=StringIndex.index("{} VENDOR".format(args.interface_name)),
subdescriptors=[
vendor_endpoint_in_descriptor,
@@ -546,7 +530,6 @@ for descriptor in descriptor_list:
b = bytes(descriptor)
notes = descriptor.notes()
- notes = fix_notes(notes) # for comparision of files beteen runs
i = 0
# This prints each subdescriptor on a separate line.