Skip to content

atmel-samd: HID report descriptor for mouse had to be COMPILER_WORD_ALIGNED #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2017

Conversation

dhalbert
Copy link
Collaborator

This fixes #114. When the USB HID descriptor for the mouse was sent to the host, it was garbled. I forced the descriptor to be word-aligned, and then it was sent back properly.

There are hints that descriptors should be word-aligned. See for instance https://github.com/adafruit/circuitpython/blob/master/atmel-samd/asf/common/services/usb/udc/udd.h#L312. In many but not all places in the ASF library, USB_DESC_STORAGE declarations are COMPILER_WORD_ALIGNED, but not all. Perhaps it's an accident that most of them work: the preceeding declarations might make this so.

(Would LTO maybe have rearranged things to accidentally cause this?)

I did not fix other places that might have this problem, such as https://github.com/adafruit/circuitpython/blob/master/atmel-samd/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd.c#L120.

@tannewt
Copy link
Member

tannewt commented Apr 15, 2017

I have no idea if LTO would have done this. It might also have been -Os but I think the ASF demos are compiled with that as well.

@tannewt tannewt merged commit 225fdb0 into adafruit:master Apr 15, 2017
dhalbert added a commit to dhalbert/circuitpython that referenced this pull request Jun 30, 2017
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.
tannewt pushed a commit that referenced this pull request Jun 30, 2017
COMPILER_WORD_ALIGNED as done in #118 for mouse. Added COMPILER_WORD_ALIGNED
to other UDC_DESC_STORAGE declarations that might have the same issue in
the future.
tannewt pushed a commit that referenced this pull request Jul 12, 2017
COMPILER_WORD_ALIGNED as done in #118 for mouse. Added COMPILER_WORD_ALIGNED
to other UDC_DESC_STORAGE declarations that might have the same issue in
the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

usb_hid: "USB Busy" errors trying to use the mouse device
2 participants