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("{} CDC control".format(args.interface_name)),
    subdescriptors=[
        cdc.Header(description="CDC comm", bcdCDC=0x0110), cdc_call_management,
        cdc.AbstractControlManagement(description="CDC comm",
                                      bmCapabilities=0x02), cdc_union,
        standard.EndpointDescriptor(
            description="CDC comm in",
            bEndpointAddress=args.cdc_ep_num_notification
            | standard.EndpointDescriptor.DIRECTION_IN,
            bmAttributes=standard.EndpointDescriptor.TYPE_INTERRUPT,
            wMaxPacketSize=0x0040,
            bInterval=0x10)
    ])

cdc_data_interface = standard.InterfaceDescriptor(
    description="CDC data",
    bInterfaceClass=cdc.CDC_CLASS_DATA,
    iInterface=StringIndex.index("{} CDC data".format(args.interface_name)),
Exemplo n.º 2
0
    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",
            bmCapabilities=0x02),
        cdc_union,
        standard.EndpointDescriptor(
            description="CDC comm in",
            bEndpointAddress=0x0 | standard.EndpointDescriptor.DIRECTION_IN,
            bmAttributes=standard.EndpointDescriptor.TYPE_INTERRUPT,
            wMaxPacketSize=0x0040,
            bInterval=0x10)
    ])

cdc_data_interface = standard.InterfaceDescriptor(
# 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