Skip to content
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

[topic-usb]usb: remove obsolete request handlers array #26854

Merged

Conversation

jfischer-no
Copy link
Collaborator

Remove obsolete request handlers array.
Apart from the fixed standard request handler,
custom, class, and vendor handlers are handled
on the basis of class/functions.
Handlers array and its initialization is no longer necessary.

Add bit-field vor bmRequestType.

@jfischer-no jfischer-no added the area: USB Universal Serial Bus label Jul 14, 2020
@github-actions github-actions bot added the area: API Changes to public APIs label Jul 14, 2020
@eobalski
Copy link
Collaborator

I think We should also update drivers to use new struct and delete all of this.

@jfischer-no
Copy link
Collaborator Author

I think We should also update drivers to use new struct and delete all of this.

yes, but I wanted to discuss it first.

if (handler == NULL) {
LOG_DBG("No handler for reqtype %d", type);
switch (setup->RequestType.type) {
case REQTYPE_TYPE_STANDARD:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: change the double space to a single space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will fix (@nzmichaelh Please "request changes" for this kind of issues)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -81,9 +81,24 @@ extern "C" {
* USB application interface
**************************************************************************/

struct usb_req_type_field {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is perfectly fine to use bitfields in packed structures, provided the endian macros are used like in this example.

Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jfischer-no jfischer-no force-pushed the pr-usb-bmrequesttype branch from 3b893b0 to 839b40f Compare July 16, 2020 16:38
@carlescufi
Copy link
Member

@emob-nordic please review

Copy link
Collaborator

@eobalski eobalski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing against, just wondering if shouldn't we reorganize the file and avoid declarations.

Comment on lines +150 to +158
static int usb_handle_standard_request(struct usb_setup_packet *setup,
int32_t *len, uint8_t **data_buf);
static int class_handler(struct usb_setup_packet *pSetup,
int32_t *len, uint8_t **data);
static int vendor_handler(struct usb_setup_packet *pSetup,
int32_t *len, uint8_t **data);
static int custom_handler(struct usb_setup_packet *pSetup,
int32_t *len, uint8_t **data);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could actually be avoided, don't You want to do that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it is temporary, I did not want to do it yet. There is still some stuff to clean up, then we can reorganize it more logical.

@jfischer-no jfischer-no added the DNM This PR should not be merged (Do Not Merge) label Jul 21, 2020
@jfischer-no
Copy link
Collaborator Author

I will reorganize it and open an other PR to rework and cleanup public headers.

Apart from the fixed standard request handler,
custom, class, and vendor handlers are handled
on the basis of class/functions.
Handlers array and its initialization is no longer necessary.

Signed-off-by: Johann Fischer <[email protected]>
@jfischer-no jfischer-no force-pushed the pr-usb-bmrequesttype branch from 839b40f to 255546d Compare July 22, 2020 09:02
@jfischer-no jfischer-no removed the DNM This PR should not be merged (Do Not Merge) label Jul 22, 2020
@carlescufi carlescufi merged commit c85eeaf into zephyrproject-rtos:topic-usb Jul 22, 2020
@jfischer-no jfischer-no deleted the pr-usb-bmrequesttype branch July 22, 2020 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: USB Universal Serial Bus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants