View difference between Paste ID: E9HqeTDK and k3aEXWM8
SHOW: | | - or go back to the newest paste.
1
static const U8 abReportDesc[] = {
2
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
3
    0x09, 0x06,                    // USAGE (Keyboard)
4
    0xa1, 0x01,                    // COLLECTION (Application)
5
6
    0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
7
    0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
8
    0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
9
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
10
    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
11
    0x75, 0x01,                    //   REPORT_SIZE (1)
12
    0x95, 0x08,                    //   REPORT_COUNT (8)
13
    0x81, 0x02,                    //   INPUT (Data,Var,Abs)
14
    0x95, 0x01,                    //   REPORT_COUNT (1)
15
    0x75, 0x08,                    //   REPORT_SIZE (8)
16
    0x81, 0x01,                    //   INPUT (Cnst,Var,Abs)
17
18
    0x95, 0x03,                    //   REPORT_COUNT (5)
19
    0x75, 0x01,                    //   REPORT_SIZE (1)
20
    0x05, 0x08,                    //   USAGE_PAGE (LEDs)
21
    0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
22
    0x29, 0x03,                    //   USAGE_MAXIMUM (Kana) Scroll Lock
23
    0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
24
    0x95, 0x05,                    //   REPORT_COUNT (1)
25
    0x75, 0x01,                    //   REPORT_SIZE (3)
26
    0x91, 0x01,                    //   OUTPUT (Cnst,Var,Abs)
27
28
    0x95, 0x06,                    //   REPORT_COUNT (6)
29
    0x75, 0x08,                    //   REPORT_SIZE (8)
30
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
31-
    0x26, 0xff, 0x00,                    //   LOGICAL_MAXIMUM (101)
31+
    0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (101)
32
    0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
33
    0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
34
    0x29, 0x91,                    //   USAGE_MAXIMUM (Keyboard Application)
35
    0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
36
    0xc0                           // END_COLLECTION
37
};
38
39
static const U8 abDescriptors [] =
40
{
41
        //
42
        //  Device descriptor
43
        //
44
        0x12,
45
        DESC_DEVICE,
46
        LE_WORD(0x0200),                // bcdUSB
47-
        0x00,                                   // bDeviceClass
47+
        0x00,                           // bDeviceClass
48-
        0x00,                                   // bDeviceSubClass
48+
        0x00,                           // bDeviceSubClass
49-
        0x00,                                   // bDeviceProtocol
49+
        0x00,                           // bDeviceProtocol
50
        MAX_PACKET_SIZE0,               // bMaxPacketSize
51
        LE_WORD(0xFFFF),                // idVendor
52
        LE_WORD(0x0003),                // idProduct
53
        LE_WORD(0x0100),                // bcdDevice
54-
        0x01,                                   // iManufacturer
54+
        0x01,                           // iManufacturer
55-
        0x02,                                   // iProduct
55+
        0x02,                           // iProduct
56-
        0x03,                                   // iSerialNumber
56+
        0x03,                           // iSerialNumber
57-
        0x01,                                   // bNumConfigurations
57+
        0x01,                           // bNumConfigurations
58
59
        //
60
        //  Configuration descriptor (Len=9)
61
        //
62-
        0x09,                                   // bLength
62+
        0x09,                           // bLength
63
        DESC_CONFIGURATION,             // bDescriptorType
64-
        LE_WORD(32+9+9+9+7),    // wTotalLength
64+
        LE_WORD(32+9+9+9+7),            // wTotalLength
65-
        0x02,                                   // bNumInterfaces*
65+
        0x02,                           // bNumInterfaces*
66-
        0x01,                                   // bConfigurationValue
66+
        0x01,                           // bConfigurationValue
67-
        0x00,                                   // iConfiguration
67+
        0x00,                           // iConfiguration
68-
        0xC0,                                   // bmAttributes
68+
        0xC0,                           // bmAttributes
69-
        0x32,                                   // bMaxPower
69+
        0x32,                           // bMaxPower
70
71
        // --
72
        // Interface 0, Alternate Setting 0, MSC Class (Len=9)
73
        //
74
        0x09,
75
        DESC_INTERFACE,
76-
        0x00,                                   // bInterfaceNumber
76+
        0x00,                           // bInterfaceNumber
77-
        0x00,                                   // bAlternateSetting
77+
        0x00,                           // bAlternateSetting
78-
        0x02,                                   // bNumEndPoints
78+
        0x02,                           // bNumEndPoints
79-
        0x08,                                   // bInterfaceClass = mass storage
79+
        0x08,                           // bInterfaceClass = mass storage
80-
        0x06,                                   // bInterfaceSubClass = transparent SCSI
80+
        0x06,                           // bInterfaceSubClass = transparent SCSI
81-
        0x50,                                   // bInterfaceProtocol = BOT
81+
        0x50,                           // bInterfaceProtocol = BOT
82-
        0x00,                                   // iInterface
82+
        0x00,                           // iInterface
83
84
        //
85
        //  EP (Len=7)
86
        //
87
        0x07,
88
        DESC_ENDPOINT,
89-
        MSC_BULK_IN_EP,                         // bEndpointAddress
89+
        MSC_BULK_IN_EP,                 // bEndpointAddress
90-
        0x02,                                           // bmAttributes = bulk
90+
        0x02,                           // bmAttributes = bulk
91
        LE_WORD(MAX_PACKET_SIZE),       // wMaxPacketSize
92-
        0x00,                                           // bInterval
92+
        0x00,                           // bInterval
93
94
        //
95
        //  EP (Len=7)
96
        //
97
        0x07,
98
        DESC_ENDPOINT,
99-
        MSC_BULK_OUT_EP,                        // bEndpointAddress
99+
        MSC_BULK_OUT_EP,                // bEndpointAddress
100-
        0x02,                                           // bmAttributes = bulk
100+
        0x02,                           // bmAttributes = bulk
101
        LE_WORD(MAX_PACKET_SIZE),       // wMaxPacketSize
102-
        0x00,                                           // bInterval
102+
        0x00,                           // bInterval
103
104
        // --
105
        // Interface 1, Alternate Setting 0, HID Class (Len=9)
106
        //
107
        0x09,
108
        DESC_INTERFACE,
109-
        0x01,                                                   // bInterfaceNumber*
109+
        0x01,                          // bInterfaceNumber*
110-
        0x00,                                                   // bAlternateSetting
110+
        0x00,                          // bAlternateSetting
111-
        0x01,                                                   // bNumEndPoints
111+
        0x01,                          // bNumEndPoints
112-
        0x03,                                                   // bInterfaceClass = HID
112+
        0x03,                          // bInterfaceClass = HID
113-
        0x00,                                                   // bInterfaceSubClass
113+
        0x00,                          // bInterfaceSubClass
114-
        0x01,                                                   // bInterfaceProtocol (keyboard)
114+
        0x01,                          // bInterfaceProtocol (keyboard)
115-
        0x00,                                                   // iInterface
115+
        0x00,                          // iInterface
116
117
        //
118
        // HID descriptor (Len=9)
119
        //
120
        0x09,
121-
        DESC_HID_HID,                                   // bDescriptorType = HID
121+
        DESC_HID_HID,                  // bDescriptorType = HID
122-
        LE_WORD(0x0110),                                // bcdHID
122+
        LE_WORD(0x0110),               // bcdHID
123-
        0x00,                                                   // bCountryCode
123+
        0x00,                          // bCountryCode
124-
        0x01,                                                   // bNumDescriptors
124+
        0x01,                          // bNumDescriptors
125-
        DESC_HID_REPORT,                                // bDescriptorType
125+
        DESC_HID_REPORT,               // bDescriptorType
126-
        LE_WORD(sizeof(abReportDesc)),  // wDescriptorLength
126+
        LE_WORD(sizeof(abReportDesc)), // wDescriptorLength
127
128
        // EP descriptor (Len=7)
129
        0x07,
130
        DESC_ENDPOINT,
131-
        INTR_IN_EP,                                             // bEndpointAddress
131+
        INTR_IN_EP,                    // bEndpointAddress
132-
        0x03,                                                   // bmAttributes = INT
132+
        0x03,                          // bmAttributes = INT
133-
        LE_WORD(8),                                             // wMaxPacketSize [LE_WORD(MAX_PACKET_SIZE)]
133+
        LE_WORD(8),                    // wMaxPacketSize [LE_WORD(MAX_PACKET_SIZE)]
134-
        0x20,                                                   // bInterval
134+
        0x20,                          // bInterval
135
136
        //
137
        //  String descriptors
138
        //
139
        0x04,
140
        DESC_STRING,
141
        LE_WORD(0x0409),
142
143-
        16+2,
143+
        8+2,
144
        DESC_STRING,
145-
        'M', 0, 'o', 0, 'b', 0, 'i', 0, 'l', 0, 'i', 0, 't', 0, 'y', 0,
145+
        'A', 0, 'c', 0, 'm', 0, 'e', 0,
146
147
        18+2,
148
        DESC_STRING,
149-
        'T', 0, 'e', 0, 'l', 0, 'e', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0,
149+
        'T', 0, 'e', 0, 's', 0, 't', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0,
150
151
        14+2,
152
        DESC_STRING,
153
        'A', 0, 'D', 0, 'R', 0, '2', 0, '0', 0, '1', 0, '2', 0,
154
155
        // terminating zero
156
        0
157
};