Skip to content

Commit 16f2846

Browse files
committed
Fix USB Busy error for kbd hid. Made kbd USB report descriptor be
COMPILER_WORD_ALIGNED as done in adafruit#118 for mouse. Added COMPILER_WORD_ALIGNED to other UDC_DESC_STORAGE declarations that might have the same issue in the future.
1 parent 9eadda6 commit 16f2846

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

atmel-samd/asf/common/services/usb/class/cdc/device/udi_cdc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ void udi_cdc_data_disable(void);
9090
bool udi_cdc_data_setup(void);
9191
uint8_t udi_cdc_getsetting(void);
9292
void udi_cdc_data_sof_notify(void);
93+
COMPILER_WORD_ALIGNED
9394
UDC_DESC_STORAGE udi_api_t udi_api_cdc_comm = {
9495
.enable = udi_cdc_comm_enable,
9596
.disable = udi_cdc_comm_disable,
9697
.setup = udi_cdc_comm_setup,
9798
.getsetting = udi_cdc_getsetting,
9899
};
100+
COMPILER_WORD_ALIGNED
99101
UDC_DESC_STORAGE udi_api_t udi_api_cdc_data = {
100102
.enable = udi_cdc_data_enable,
101103
.disable = udi_cdc_data_disable,

atmel-samd/asf/common/services/usb/class/hid/device/generic/udi_hid_generic_desc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ UDC_DESC_STORAGE udc_config_speed_t udc_config_fshs[1] = { {
154154
}};
155155

156156
//! Add all information about USB Device in global structure for UDC
157+
COMPILER_WORD_ALIGNED
157158
UDC_DESC_STORAGE udc_config_t udc_config = {
158159
.confdev_lsfs = &udc_device_desc,
159160
.conf_lsfs = udc_config_fshs,

atmel-samd/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ bool udi_hid_kbd_setup(void);
6767
uint8_t udi_hid_kbd_getsetting(void);
6868

6969
//! Global structure which contains standard UDI interface for UDC
70+
// CircuitPython fix: UDC_DESC_STORAGE must be COMPILER_WORD_ALIGNED
71+
COMPILER_WORD_ALIGNED
7072
UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd = {
7173
.enable = (bool(*)(void))udi_hid_kbd_enable,
7274
.disable = (void (*)(void))udi_hid_kbd_disable,
@@ -117,6 +119,8 @@ COMPILER_WORD_ALIGNED
117119
//@}
118120

119121
//! HID report descriptor for standard HID keyboard
122+
// CircuitPython fix: UDC_DESC_STORAGE must be COMPILER_WORD_ALIGNED
123+
COMPILER_WORD_ALIGNED
120124
UDC_DESC_STORAGE udi_hid_kbd_report_desc_t udi_hid_kbd_report_desc = {
121125
{
122126
0x05, 0x01, /* Usage Page (Generic Desktop) */

atmel-samd/asf/common/services/usb/class/hid/device/mouse/udi_hid_mouse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ bool udi_hid_mouse_setup(void);
6666
uint8_t udi_hid_mouse_getsetting(void);
6767

6868
//! Global structure which contains standard UDI interface for UDC
69+
COMPILER_WORD_ALIGNED
6970
UDC_DESC_STORAGE udi_api_t udi_api_hid_mouse = {
7071
.enable = (bool(*)(void))udi_hid_mouse_enable,
7172
.disable = (void (*)(void))udi_hid_mouse_disable,

atmel-samd/asf/common/services/usb/udc/udc_dfu_small.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ struct udc_string_desc_t {
134134
le16_t string[Max(Max(USB_DEVICE_MANUFACTURE_NAME_SIZE, \
135135
USB_DEVICE_PRODUCT_NAME_SIZE), USB_DEVICE_SERIAL_NAME_SIZE)];
136136
};
137+
COMPILER_WORD_ALIGNED
137138
static UDC_DESC_STORAGE struct udc_string_desc_t udc_string_desc = {
138139
.header.bDescriptorType = USB_DT_STRING
139140
};
140141

141142
/**
142143
* \brief Language ID of USB device (US ID by default)
143144
*/
145+
COMPILER_WORD_ALIGNED
144146
static UDC_DESC_STORAGE usb_str_lgid_desc_t udc_string_desc_languageid = {
145147
.desc.bLength = sizeof(usb_str_lgid_desc_t),
146148
.desc.bDescriptorType = USB_DT_STRING,

0 commit comments

Comments
 (0)