google / gousb

gousb provides low-level interface for accessing USB devices
Apache License 2.0
845 stars 124 forks source link

Add functions to achieve android support #126

Closed juaoose closed 3 months ago

juaoose commented 6 months ago

Since Android has limitations for enumerating devices (see), it would be useful to have other ways of opening devices.

This PR adds a new function to open a device provided its file descriptor, along with it also allows the user to set the LIBUSB_OPTION_NO_DEVICE_DISCOVERY, again, to try to overcome the Android limitations.

This PR is missing some work on the tests, plus I'm not sure if the way I modified the API follows your standards, please let me know.

kubaraczkowski commented 4 months ago

I've adjusted the changes according to the recommendations and fixed the test to use the fake implementation. The code is here: https://github.com/kubaraczkowski/gousb/tree/android, but TBH i'm not sure what's the proper way to get it added to this PR. Do I make a new PR here, or perhaps at @juaoose repo?

Thx!

zagrodzki commented 4 months ago

I've adjusted the changes according to the recommendations and fixed the test to use the fake implementation. The code is here: https://github.com/kubaraczkowski/gousb/tree/android, but TBH i'm not sure what's the proper way to get it added to this PR. Do I make a new PR here, or perhaps at @juaoose repo?

Thx!

A new PR is the best way to go, I think.

kubaraczkowski commented 4 months ago

Super! See here: https://github.com/google/gousb/pull/130

zagrodzki commented 3 months ago

closing this in favor of #130