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

Transition to libusb and support targeting device by serial number #59

Merged

Conversation

quic-bjorande
Copy link
Contributor

Transitioning to libusb avoids open-coded USB descriptor parsing and removes the strong dependency
on the Linux-specific ioctl-based interface.
This should allow QDL to run on other OSs, it cleans up the code a bit, and it allow us to more conveniently
implement reading of the string descriptors, for a serial number comparison, in the support for selecting a
specific board when more than one is available.

@EmbeddedAndroid
Copy link

Gave this a spin on my Mac M3, built and runs. I'll try flashing tonight to confirm full function. Thanks @quic-bjorande!

In order to support selecting board based on serial number the iProduct
field needs to be inspected, with the hand-rolled parsing of the USB
descriptors this becomes cumbersome.

Furthermore the direct use of Linux's USBDEVFS creats an unnecessary
dependency on the host OS being Linux.

It's unclear why libusb wasn't choosen in the first place, perhaps it
relates to the faint memory of 0.1 vs 1.0 packaging issues?

Move to libusb-1.0 in order to resolve these issues, as well as clean up
the code a bit.

Signed-off-by: Bjorn Andersson <[email protected]>
When working on a host with multiple boards attached being able to
select a specific board by serial number becomes necessary.

In the EDL USB descriptors a device serial number is available as part
of the iProduct string, so this can be used for comparison.

As libusb requires a handle the libusb_open() needs to be moved into the
loop.

Signed-off-by: Bjorn Andersson <[email protected]>
@andersson andersson force-pushed the for-linux-msm/libusb-and-serial branch from a46c596 to 43976ff Compare May 9, 2024 21:52
@ricardosalveti
Copy link
Contributor

That's awesome, will give it a try as well, thanks for doing the work!

@ricardosalveti
Copy link
Contributor

Tested flashing lmp/yocto image on a mac m3 and worked fine!

@konradybcio konradybcio merged commit 25ce7fa into linux-msm:master May 10, 2024
2 checks passed
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.

4 participants