Example #1
0
    idVendor=args.vid,
    idProduct=args.pid,
    iManufacturer=StringIndex.index(args.manufacturer),
    iProduct=StringIndex.index(args.product),
    iSerialNumber=SERIAL_NUMBER_INDEX)

# Interface numbers are interface-set local and endpoints are interface local
# until util.join_interfaces renumbers them.

cdc_union = cdc.Union(
    description="CDC comm",
    bMasterInterface=0x00,       # Adjust this after interfaces are renumbered.
    bSlaveInterface_list=[0x01]) # Adjust this after interfaces are renumbered.

cdc_call_management = cdc.CallManagement(
    description="CDC comm",
    bmCapabilities=0x01,
    bDataInterface=0x01)         # Adjust this after interfaces are renumbered.

cdc_comm_interface = standard.InterfaceDescriptor(
    description="CDC comm",
    bInterfaceClass=cdc.CDC_CLASS_COMM,  # Communications Device Class
    bInterfaceSubClass=cdc.CDC_SUBCLASS_ACM,  # Abstract control model
    bInterfaceProtocol=cdc.CDC_PROTOCOL_NONE,
    iInterface=StringIndex.index("CircuitPython CDC control"),
    subdescriptors=[
        cdc.Header(
            description="CDC comm",
            bcdCDC=0x0110),
        cdc_call_management,
        cdc.AbstractControlManagement(
            description="CDC comm",
# Interface numbers are interface set local and endpoints are interface local
# until core.join_interfaces renumbers them.
cdc_interfaces = [
    standard.InterfaceDescriptor(
        bInterfaceClass=0x2,  # Communications Device Class
        bInterfaceSubClass=0x02,  # Abstract control model
        bInterfaceProtocol=0x01,  # Common AT Commands
        subdescriptors=[
            # Working 2.x
            # radix: hexadecimal
            # 05 24 00 10 01 header
            # 05 24 01 03 01 call manage
            # 04 24 02 06 acm
            # 05 24 06 00 01 union
            cdc.Header(bcdCDC=0x0110),
            cdc.CallManagement(bmCapabilities=0x03, bDataInterface=0x01),
            cdc.AbstractControlManagement(bmCapabilities=0x02),
            cdc.Union(bMasterInterface=0x00, bSlaveInterface=[0x01]),
            standard.EndpointDescriptor(
                bEndpointAddress=0x0
                | standard.EndpointDescriptor.DIRECTION_IN,
                bmAttributes=standard.EndpointDescriptor.TYPE_INTERRUPT,
                wMaxPacketSize=0x8,
                bInterval=10)
        ]),
    standard.InterfaceDescriptor(
        bInterfaceClass=0x0a,
        subdescriptors=[
            standard.EndpointDescriptor(
                bEndpointAddress=0x0
                | standard.EndpointDescriptor.DIRECTION_IN,