Android and libusb
Anton Lundin
glance at acc.umu.se
Mon Sep 30 00:05:33 PDT 2019
On 29 September, 2019 - Dirk Hohndel wrote:
> As I try to catch up with my large backlog of email...
>
>
> > On Sep 23, 2019, at 7:45 AM, Anton Lundin <glance at acc.umu.se> wrote:
> >
> > First of all, I'd just try to run our current code on a libusb
> > containing:
> > https://github.com/libusb/libusb/commit/2f3bc98b0d0f4766496df53c855685a5f0e5e7cf <https://github.com/libusb/libusb/commit/2f3bc98b0d0f4766496df53c855685a5f0e5e7cf>
>
> That part is easy. v1.0.23 is what we want to switch to.
> But of course that breaks our current approach which works on SOME devices,
> so we can't do that until the second part below is done.
>
> > My preferred solution here would be to patch linux_scan_devices to have
> > a callback into subsurface which could do the scanning against java code
> > here, and fill up the libusb data structures. I have some unfinished
> > code working on this path, and its basically the same approach as in our
> > "open" patch. The upside with this is that it keeps all our non ftdi
> > libusb using backends in libdivecomputer still working.
>
> I honestly think that this is the right approach. I started staring at the code and
> as expected the more I look the more I worry that I will get started and never
> get finished. My challenge is that I don't understand the libusb data structures.
> So which part of the libusb_context do I need to populate from the information
> we get back from the JNI calls? That structure has quite a few members that I
> have no idea what to do with. And reading the Linux code that initializes this
> structure in the regular case really doesn't make me any smarter as just trying
> to follow the code is making me break out in a rash...
Yea, its a quite complex call chain, but I thin it can be simplified to
filling out struct libusb_device and calling usbi_connect_device on
those.
UsbManager.getDeviceList() gives us enough to fill in the libusb_device
structs.
> I have a branch for this but I don't recommend that anybody hope that I'll make
> a lot of progress. I'm just dealing with way too many other issues that people
> are equally desperately hoping for me to work on (like the UI issues and crashes
> on Android that I think the latest beta finally addresses - which means I need to
> make another release...)
Do you have a link to that branch?
https://github.com/glance-/libusb/commit/50e2690f27a04011c4eae215d8b100851278e544
Is basically the libusb patch needed, the rest of the code needed would
end up in the callback subsurface would provide.
I had a half written variant of such code somewhere but I can't find it
right now.
//Anton
--
Anton Lundin +46702-161604
More information about the subsurface
mailing list