# Path: umap2/core/usb.py
# class DescriptorType(object):
#     device = 0x01
#     configuration = 0x02
#     string = 0x03
#     interface = 0x04
#     endpoint = 0x05
#     device_qualifier = 0x06
#     other_speed_configuration = 0x07
#     interface_power = 0x08
#     bos = 0x0f
#     device_capability = 0x10
#     hid = 0x21
#     report = 0x22
#     cs_interface = 0x24
#     cs_endpoint = 0x25
#     hub = 0x29


from umap2.core.usb import DescriptorType
from kitty.model import UInt8, LE16, RandomBytes
from kitty.model import Size
from generic import Descriptor
'''
Hub templates
'''


# hub_descriptor

'''
 d = struct.pack(
            '<BBHBB',
            DescriptorType.hub,
            self.num_ports,
            self.hub_chars,
            self.pwr_on_2_pwr_good,
            self.hub_contr_current,
        )
        num_bytes = self.num_ports // 7
        if self.num_ports % 7 != 0:
            num_bytes += 1
        d += '\x00' * num_bytes
        d += '\xff' * num_bytes
        d = struct.pack('B', len(d) + 1) + d
        return d
'''

hub_descriptor = Descriptor(
    name='hub_descriptor',

# Path: umap2/core/usb.py
# class DescriptorType(object):
#     device = 0x01
#     configuration = 0x02
#     string = 0x03
#     interface = 0x04
#     endpoint = 0x05
#     device_qualifier = 0x06
#     other_speed_configuration = 0x07
#     interface_power = 0x08
#     bos = 0x0f
#     device_capability = 0x10
#     hid = 0x21
#     report = 0x22
#     cs_interface = 0x24
#     cs_endpoint = 0x25
#     hub = 0x29


# Path: umap2/fuzz/templates/hub.py
from umap2.core.usb import DescriptorType
from kitty.model import UInt8, LE16, RandomBytes
from kitty.model import Size
from generic import Descriptor

'''
Hub templates
'''


# hub_descriptor

'''
 d = struct.pack(
            '<BBHBB',
            DescriptorType.hub,
            self.num_ports,
            self.hub_chars,
            self.pwr_on_2_pwr_good,
            self.hub_contr_current,
        )
        num_bytes = self.num_ports // 7
        if self.num_ports % 7 != 0:
            num_bytes += 1
        d += '\x00' * num_bytes
        d += '\xff' * num_bytes
        d = struct.pack('B', len(d) + 1) + d
        return d
'''

hub_descriptor = Descriptor(
    name='hub_descriptor',

    descriptor_type=DescriptorType.hub,