Subsurface Mobile: Adding mares USB (cp210x) support; how to proceed

Dirk Hohndel dirk at hohndel.org
Fri Mar 6 15:30:20 PST 2020


> On Mar 6, 2020, at 3:23 PM, Christof Arnosti <charno at charno.ch> wrote:
>>> There is a driver with CdcAcmSerialDriver in usb-serial-for-android!
>>> 
>>> That's exactly the use case I had in mind when I proposed driverclass-selection in the UI ;-)
>>> 
>> 
>> I understand - but Subsurface-mobile would never ever get access to this if we don't claim the PID/VID correct?
>> That's been my point here... even if you add that driverclass... how would Subsurface-mobile get access to that device in the first place?
>> Maybe I'm just misunderstanding how this is supposed to work.
> If I understand correctly, the device_filter.xml is only necessary to get the popup which then leads to the download-page. 
> 
> In the Java code, all devices known to UsbManager are compared by PID/VID by UsbSerialProber (from usb-serial-for-android). When there's a match there is a check if we have permission to use this device, and if not the permission is requested. Then the device is used.
> 

Ahh, that's the part that I didn't realize. I thought you never get to see devices that you haven't registered. In that case, yes, indeed your idea to have those generic diver-classes available does make sense. I'd still hide them in general as this should be the exception (and I'd add some feature that makes it easy for people to send us email with the necessary information so we can add the VID/PID for them).

> If we do the UsbManager-stuff beforehand to populate the device-list (and then pass the selecte usb device to Java android_serial_open) we don't need the UsbSerialProber to check the attached device, but only to find the correct driver class. If the driver class is also passed to android_serial_open we can leave out the whole UsbSerialProber-Stuff and directly instantiate the driver class with the passed usb device. With all this it's still possible to check and request for permission to access the device at runtime.
> 

And here you are losing me again :-)
Are you suggesting that we could walk through the list of devices and try to populate the dropdowns on the download page accordingly? That sounds like a great idea.
 
> I didn't consciously check for devices not entered in the device_filter.xml, but I entered "my" PID/VID pair quite late in the development cycle. I also have seen and used the "ask permission" popup which happens when a device not in device_filter.xml is used. I will test this tomorrow by removing "my" entry from the device_filter.xml.
> 

Excellent. Should I wait for further updates from you before merging the current code?

/D

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20200306/88b9c98d/attachment.html>


More information about the subsurface mailing list