@@ -358,21 +358,21 @@ typedef enum usb_transfer_type {
358358 USB_INTERRUPT_TRANSFER ,
359359} usb_transfer_type_t ;
360360
361- typedef struct usb_control_setup {
361+ typedef struct usb_control_setup __attribute__(( packed )) {
362362 uint8_t bmRequestType ; /**< direction, type, and recipient */
363363 uint8_t bRequest ; /**< usb_request_t */
364364 uint16_t wValue ; /**< request specific */
365365 uint16_t wIndex ; /**< request specific */
366366 uint16_t wLength ; /**< transfer length */
367367} usb_control_setup_t ;
368368
369- typedef struct usb_descriptor {
369+ typedef struct usb_descriptor __attribute__(( packed )) {
370370 uint8_t bLength ; /**< The length of this descriptor. */
371371 uint8_t bDescriptorType ; /**< A usb_descriptor_type_t. */
372372 uint8_t data []; /**< The rest of the descriptor */
373373} usb_descriptor_t ;
374374
375- typedef struct usb_device_descriptor {
375+ typedef struct usb_device_descriptor __attribute__(( packed )) {
376376 uint8_t bLength ; /**< 18 */
377377 uint8_t bDescriptorType ; /**< USB_DEVICE_DESCRIPTOR */
378378 uint16_t bcdUSB ; /**< usb specification version */
@@ -389,7 +389,7 @@ typedef struct usb_device_descriptor {
389389 uint8_t bNumConfigurations ; /**< how many valid configuration indices */
390390} usb_device_descriptor_t ;
391391
392- typedef struct usb_device_qualifier_descriptor {
392+ typedef struct usb_device_qualifier_descriptor __attribute__(( packed )) {
393393 uint8_t bLength ; /**< 10 */
394394 uint8_t bDescriptorType ; /**< USB_DEVICE_QUALIFIER_DESCRIPTOR */
395395 uint16_t bcdUSB ; /**< usb specification version */
@@ -401,7 +401,7 @@ typedef struct usb_device_qualifier_descriptor {
401401 uint8_t bReserved ; /**< must be 0 */
402402} usb_device_qualifier_descriptor_t ;
403403
404- typedef struct usb_configuration_descriptor {
404+ typedef struct usb_configuration_descriptor __attribute__(( packed )) {
405405 uint8_t bLength ; /**< 9 */
406406 uint8_t bDescriptorType ; /**< USB_CONFIGURATION_DESCRIPTOR */
407407 uint16_t wTotalLength ; /**< total length of combined descriptors */
@@ -413,7 +413,7 @@ typedef struct usb_configuration_descriptor {
413413} usb_configuration_descriptor_t ;
414414typedef struct usb_configuration_descriptor usb_other_speed_configuration_t ;
415415
416- typedef struct usb_interface_descriptor {
416+ typedef struct usb_interface_descriptor __attribute__(( packed )) {
417417 uint8_t bLength ; /**< 9 */
418418 uint8_t bDescriptorType ; /**< USB_INTERFACE_DESCRIPTOR */
419419 uint8_t bInterfaceNumber ; /**< zero-based interface index */
@@ -425,7 +425,7 @@ typedef struct usb_interface_descriptor {
425425 uint8_t iInterface ; /**< index of description string descriptor */
426426} usb_interface_descriptor_t ;
427427
428- typedef struct usb_endpoint_descriptor {
428+ typedef struct usb_endpoint_descriptor __attribute__(( packed )) {
429429 uint8_t bLength ; /**< 7 */
430430 uint8_t bDescriptorType ; /**< USB_ENDPOINT_DESCRIPTOR */
431431 uint8_t bEndpointAddress ; /**< endpoint direction and number */
@@ -436,7 +436,7 @@ typedef struct usb_endpoint_descriptor {
436436 uint8_t bInterval ; /** transfer type specific */
437437} usb_endpoint_descriptor_t ;
438438
439- typedef struct usb_string_descriptor {
439+ typedef struct usb_string_descriptor __attribute__(( packed )) {
440440 uint8_t bLength ; /**< byte length, not character length */
441441 uint8_t bDescriptorType ; /**< USB_STRING_DESCRIPTOR */
442442 wchar_t bString []; /**< UTF-16 string, no null termination */
0 commit comments