- descriptor generator updated
This commit is contained in:
parent
c7b69000e7
commit
25dc4a9aa8
@ -27,9 +27,10 @@ class USB_DescriptorSize(Enum):
|
||||
|
||||
# base class for descriptor generator
|
||||
class Descriptor(StructGenerator.StructRecord):
|
||||
QUALIFIERS = "const"
|
||||
def __init__(self, name, ctype, content, comment=None):
|
||||
super().__init__(name, ctype, content, comment)
|
||||
self.qualifiers = "const"
|
||||
self.qualifiers = Descriptor.QUALIFIERS
|
||||
self.typedef = ctype[8:]
|
||||
self.attribute = "packed"
|
||||
|
||||
|
11
desc/main.py
11
desc/main.py
@ -10,10 +10,21 @@ from ConfigGenerator import ConfigGenerator
|
||||
|
||||
# fetch USB settings
|
||||
usb_config_file_name = argv[1]
|
||||
#usb_config_file_name = "/home/epagris/VCSDEV/usbt1/stws/USB-T1/Modules/flatUSB/desc/usb_config_cdc.json"
|
||||
with open(usb_config_file_name, 'r') as usb_config_file:
|
||||
usb_config_data = usb_config_file.read()
|
||||
usb_config = json.loads(usb_config_data)
|
||||
|
||||
# process "misc"
|
||||
if "misc" in usb_config:
|
||||
misc = usb_config["misc"]
|
||||
|
||||
# mutable descriptors
|
||||
if "mutable_descriptors" in misc:
|
||||
if misc["mutable_descriptors"]:
|
||||
desc.Descriptor.QUALIFIERS = ""
|
||||
|
||||
# generate config
|
||||
cfggen = ConfigGenerator(usb_config)
|
||||
cfggen.generate()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user