Skip to content

Added Long USB RecvControl call for >64 bytes #4317

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
Dec 21, 2015

Conversation

NicoHood
Copy link
Contributor

This PR replaces the 2nd commit of #4105

It makes more sense to integrate this (wrapper) function into the core instead of my project, since I use it 3 times and other people might need it too.

It doesnt break anything, just a new function was added

cc @facchinm

@facchinm facchinm self-assigned this Dec 21, 2015
@facchinm
Copy link
Member

Ok, this doesn't add any overhead if not used, so I'm for merging. Thanks!

facchinm added a commit that referenced this pull request Dec 21, 2015
Added Long USB RecvControl call for >64 bytes
@facchinm facchinm merged commit 746133d into arduino:master Dec 21, 2015
@cmaglie
Copy link
Member

cmaglie commented Dec 21, 2015

Is this API available for SAM/SAMD/others?
Is not better if we patch USB_SendControl? how much is the overhead?

@cmaglie cmaglie added this to the Release 1.6.8 milestone Dec 21, 2015
@cmaglie cmaglie added Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...) labels Dec 21, 2015
@facchinm
Copy link
Member

The overhead is BIG if we leave only the long implementation. SAM and SAMD should already handle the long case (if my memory isn't failing).

@cmaglie
Copy link
Member

cmaglie commented Dec 21, 2015

SAM and SAMD should already handle the long case (if my memory isn't failing).

My point is that if a library use USB_SendControlLong, it will fail to compile on SAM/SAMD.

The overhead is BIG if leaving only the long implementation

USB_SendControl uses int for len parameter, so we should just use int that is 16-bit math on AVR.

@facchinm
Copy link
Member

Sorry, I meant that using the USB_RecvControlLong to handle a 3 bytes transfer has a big overhead.
But you are right, we should also add a "stub" SAM/SAMD implementation

@NicoHood
Copy link
Contributor Author

You are totally right. However the whole USB Core needs an improvement, so this shouldnt matter for now (my opinion). If you really want to fix this, add a proper USB Core like LUFA with also sam compatible functions.

This PR was "just" an addition I needed for the HID Project (Raw HID especially). Its only avr compatible anyways, so for me its fine. I guess this might be the only project using the usb-core anyways. So thanks for merging! :)

@NicoHood NicoHood deleted the RecvControlLong branch December 21, 2015 11:46
@cmaglie
Copy link
Member

cmaglie commented Dec 21, 2015

Adding an API means that people starts to rely on it, we should document it and maintain (for other cores as well).

I guess this might be the only project using the usb-core anyways.

This don't justify adding a project-specific-API to the core, if you're the only one using it why you feel the need to add it to the core then?

So at this point I'm all for removing USB_RecvControlLong and fix USB_RecvControl, that is the Right Thing To Do™, since the current USB_RecvControl is buggy.

I'll try to crack a fix for this in a moment.

cmaglie added a commit to cmaglie/Arduino that referenced this pull request Dec 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Component: USB Device Opposed to USB Host. Related to the USB subsystem (SerialUSB, HID, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants