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

fix: Add missing fields to libusb_bos_descriptor and libusb_bos_dev_capability_descriptor #161

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

alufers
Copy link
Contributor

@alufers alufers commented Feb 27, 2023

This fix adds missing fields to these two structs so that they can be used from rust without the size mismatching from the C version.

See:

https://libusb.sourceforge.io/api-1.0/structlibusb__bos__descriptor.html
https://libusb.sourceforge.io/api-1.0/structlibusb__bos__dev__capability__descriptor.html

…apability_descriptor

This fix adds missing fields to these two structs so that they can be
used from rust without the size mismatching from the C version.

See:
https://libusb.sourceforge.io/api-1.0/structlibusb__bos__descriptor.html
https://libusb.sourceforge.io/api-1.0/structlibusb__bos__dev__capability__descriptor.html
@alufers alufers closed this Jun 8, 2023
@alufers alufers reopened this Jun 8, 2023
@alufers
Copy link
Contributor Author

alufers commented Jun 8, 2023

Hello, any progress on this?

@a1ien
Copy link
Owner

a1ien commented Jun 20, 2023

This looks like breaking changes.

@alufers
Copy link
Contributor Author

alufers commented Aug 30, 2023

No, the fields are simply missing in the Rust version, causing memory corruption when they are not present.

@a1ien
Copy link
Owner

a1ien commented Aug 30, 2023

The statement about memory corruption is not true.
In this example https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cfe918958abb877dbf05dc9a3d737c33
You can see that size and layout for structure is the same. The only downside of missing this filed is less ergonomic usage.

Yes, this filed missing in current rust version. But I can't accept this PR right now because this breaking change for users. I will merge this when I make a new release(0.7.0). Probably when 1.27 libusb released.

@alufers
Copy link
Contributor Author

alufers commented Aug 31, 2023

Okay, sorry for the false statement. Was remembering this from memory, probably confused something. No rush, I have worked around this, as you say - less ergonomically.

@a1ien a1ien mentioned this pull request Apr 15, 2024
@a1ien a1ien merged commit 01bfb3e into a1ien:master Apr 27, 2024
8 checks passed
@a1ien
Copy link
Owner

a1ien commented Apr 27, 2024

Thank you. Merged.

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.

None yet

2 participants