Android: Subsurface-mobile downloadfrom divecomputer

Anton Lundin glance at acc.umu.se
Wed Apr 6 06:56:39 PDT 2016


On 03 April, 2016 - Willem Ferguson wrote:

> On 18/02/2016 16:09, Anton Lundin wrote:
> >Is there a way in android to check for a PID? You can imagine that
> >the initial step of devising communication will be immensely
> >complex.
> >>>A PID is useless without the corresponding VID. We already have code
> >>>that checks for supported PID/VID's in get_usb_fd(). We would get
> >>>intents from the system if a PID/VID that we had listed in the manifest
> >>>would be connected to the device too.
>
> 1) get_usb_fd() has two parameters: idVendor and idProduct. Where
> are the values for these obtained?
> 

They are coming from libusb.

> 2) This function then initialises vendorid and productid and
> provides a basic method to verify a valid USB device. Am I correct?
> 
No. get_usb_fd() is a replacement for open() on /dev/bus/usb/XXX/YYY,
because on android we ain't allowed to open usb device nodes directly,
so we need to call into the platform services to do that for us, and
then they pass back the fd. 


> 3) It appears this function is not called anywhere within the
> Subsurface software yet. Is this correct?
> 

Yes. Its called from libusb, after the patch in
packaging/android/patches/libusb-android.patch is applied to libusb.



The call-chain goes:
subsurface -> libdivecomputer -> libftdi -> libusb -> subsurface::get_usb_fd()

> >My tip is to play around with the desktop app on your Android
> >device. //Anton
> ok, what do you mean with "desktop app on Android"?. An app
> downloadable from Play Store?
> 

No.

Build for android with SUBSURFACE_DESKTOP=ON , then you get the regular
desktop ui on your android device. It has a working download from bt /
ftdi implementation. To use a ftdi device, you just enter the magic
string "ftdi" as device and core/libdivecomputer.c:976 will call into
dc_serial_ftdi_open and things würk.



The _only_ thing needed to get downloads working on Android is to
implement the download dialog where you can choose vendor, model, 
bluetooth device or ftdi.


//Anton

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list