# 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 Template, Container, OneOf, TakeFrom
from kitty.model import MutableField
from kitty.model import UInt8, LE16, BitField, Static
from kitty.model import ENC_INT_LE
from kitty.core import KittyException
from random import Random
from generic import DynamicInt, Descriptor
                    UInt8(opcode, name='opcode'),
                    BitField(value, 8 * len(args), encoder=ENC_INT_LE, name='value')
                ]
            ))
        index += num_args
    return OneOf(
        name=name,
        fields=[
            Container(
                name='generation',
                fields=fields
            ),
            MutableField(
                name='mutation',
                value=report_str
            ),
            RandomHidReport(
                name='random_sequences'
            ),
        ])

# ############### Templates ############### #

hid_descriptor = Descriptor(
    name='hid_descriptor',
    descriptor_type=DescriptorType.hid,
    fields=[
        DynamicInt('bcdHID', LE16(value=0x0110)),
        DynamicInt('bCountryCode', UInt8(value=0x00)),
        DynamicInt('bNumDescriptors', UInt8(value=0x01)),

# 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/hid.py
from umap2.core.usb import DescriptorType
from kitty.model import Template, Container, OneOf, TakeFrom
from kitty.model import MutableField
from kitty.model import UInt8, LE16, BitField, Static
from kitty.model import ENC_INT_LE
from kitty.core import KittyException
from random import Random
from generic import DynamicInt, Descriptor

                    UInt8(opcode, name='opcode'),
                    BitField(value, 8 * len(args), encoder=ENC_INT_LE, name='value')
                ]
            ))
        index += num_args
    return OneOf(
        name=name,
        fields=[
            Container(
                name='generation',
                fields=fields
            ),
            MutableField(
                name='mutation',
                value=report_str
            ),
            RandomHidReport(
                name='random_sequences'
            ),
        ])

# ############### Templates ############### #

hid_descriptor = Descriptor(
    name='hid_descriptor',
    descriptor_type=DescriptorType.hid,
    fields=[
        DynamicInt('bcdHID', LE16(value=0x0110)),
        DynamicInt('bCountryCode', UInt8(value=0x00)),
        DynamicInt('bNumDescriptors', UInt8(value=0x01)),

        DynamicInt('bDescriptorType2', UInt8(value=DescriptorType.hid)),