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

mfd: usbio: gpio read payload reduces 4 bytes #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drhooray
Copy link

Following the vision driver protocol, the payload length for gpio read needs to be reduced by 4 bytes because the value field doesn't need to be sent in the request.

ret = usb_control_msg_send(bridge->udev, bridge->ep0, 0,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, 0, 0,
header, actual, timeout, GFP_KERNEL);
header, actual - 4, timeout, GFP_KERNEL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested this pull request?

Copy link
Contributor

Choose a reason for hiding this comment

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

This N-4 bytes payload length is defined in USBIO bridge protocol revision 1.0. In previous version 0.7, the format is N-bytes. Merge this request will be risky to break systems running older FW version.

Copy link

@hugh712 hugh712 Aug 2, 2024

Choose a reason for hiding this comment

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

is it possible to have a check to decide which protocol to go?
something like :
old device go:

ret = usb_control_msg_send(bridge->udev, bridge->ep0, 0, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, 0, 0, header, actual, timeout, GFP_KERNEL);
new device go:
ret = usb_control_msg_send(bridge->udev, bridge->ep0, 0, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, 0, 0, header, actual - 4, timeout, GFP_KERNEL);

Copy link
Author

Choose a reason for hiding this comment

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

is it possible to have a check to decide which protocol to go?

done

This N-4 bytes payload length is defined in USBIO bridge protocol revision 1.0. In previous version 0.7, the format is N-bytes. Merge this request will be risky to break systems running older FW version.

how about creating a function to check the protocol version based on the HID?

Have you tested this pull request?

yes

Choose a reason for hiding this comment

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

Wouldn't it make more sense to do the check once during instance creation, and save the result in a flag? Instead of doing it for each transfer?

tmsundar123 pushed a commit that referenced this pull request Jul 26, 2024
Following the vision driver protocol, the payload length for gpio read
needs to be reduced by 4 bytes because the value field doesn't need to
be sent in the request.

Signed-off-by: Jason Chen <jason.z.chen@intel.corp-partner.google.com>
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.

5 participants