Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5e9b065 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "adb: enable superspeed support"

parents 51248395 d6ee9f26
Loading
Loading
Loading
Loading
+56 −7
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@

#define MAX_PACKET_SIZE_FS	64
#define MAX_PACKET_SIZE_HS	512
#define MAX_PACKET_SIZE_SS	1024

#define cpu_to_le16(x)  htole16(x)
#define cpu_to_le32(x)  htole32(x)
@@ -56,19 +57,33 @@ struct usb_handle
};

static const struct {
    struct usb_functionfs_descs_head header;
    __le32 magic;
    __le32 length;
    __le32 flags;
    __le32 fs_count;
    __le32 hs_count;
    __le32 ss_count;
    struct {
        struct usb_interface_descriptor intf;
        struct usb_endpoint_descriptor_no_audio source;
        struct usb_endpoint_descriptor_no_audio sink;
    } __attribute__((packed)) fs_descs, hs_descs;
    struct {
        struct usb_interface_descriptor intf;
        struct usb_endpoint_descriptor_no_audio source;
        struct usb_ss_ep_comp_descriptor source_comp;
        struct usb_endpoint_descriptor_no_audio sink;
        struct usb_ss_ep_comp_descriptor sink_comp;
    } __attribute__((packed)) ss_descs;
} __attribute__((packed)) descriptors = {
    .header = {
        .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
    .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
    .length = cpu_to_le32(sizeof(descriptors)),
    .flags = cpu_to_le32(FUNCTIONFS_HAS_FS_DESC |
                         FUNCTIONFS_HAS_HS_DESC |
                         FUNCTIONFS_HAS_SS_DESC),
    .fs_count = 3,
    .hs_count = 3,
    },
    .ss_count = 5,
    .fs_descs = {
        .intf = {
            .bLength = sizeof(descriptors.fs_descs.intf),
@@ -121,6 +136,40 @@ static const struct {
            .wMaxPacketSize = MAX_PACKET_SIZE_HS,
        },
    },
    .ss_descs = {
        .intf = {
            .bLength = sizeof(descriptors.ss_descs.intf),
            .bDescriptorType = USB_DT_INTERFACE,
            .bInterfaceNumber = 0,
            .bNumEndpoints = 2,
            .bInterfaceClass = ADB_CLASS,
            .bInterfaceSubClass = ADB_SUBCLASS,
            .bInterfaceProtocol = ADB_PROTOCOL,
            .iInterface = 1, /* first string from the provided table */
        },
        .source = {
            .bLength = sizeof(descriptors.ss_descs.source),
            .bDescriptorType = USB_DT_ENDPOINT,
            .bEndpointAddress = 1 | USB_DIR_OUT,
            .bmAttributes = USB_ENDPOINT_XFER_BULK,
            .wMaxPacketSize = MAX_PACKET_SIZE_SS,
        },
        .source_comp = {
            .bLength = sizeof(descriptors.ss_descs.source_comp),
            .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
        },
        .sink = {
            .bLength = sizeof(descriptors.ss_descs.sink),
            .bDescriptorType = USB_DT_ENDPOINT,
            .bEndpointAddress = 2 | USB_DIR_IN,
            .bmAttributes = USB_ENDPOINT_XFER_BULK,
            .wMaxPacketSize = MAX_PACKET_SIZE_SS,
        },
        .sink_comp = {
            .bLength = sizeof(descriptors.ss_descs.sink_comp),
            .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
        },
    },
};

#define STR_INTERFACE_ "ADB Interface"