Subsurface android downloader - Project Status

Venkatesh Shukla venkatesh.shukla.eee11 at iitbhu.ac.in
Fri Aug 22 02:58:37 PDT 2014


Hello

This mail is regarding the status of the Subsurface Android Downloader
which was undertaken as a Google Summer of Code project by me under Anton
Lundin.

The aim of the project was to enable download of dives from divecomputer on
android devices.

The first part of the project was tweaking various libraries -
libdivecomputer, libusb and libftdi to work on android. Patches for these
have been sent to the corresponding organisations for merging with
respective upstreams. Libusb has been reluctant in adding support for
android citing the reason : 'The problem is that the libusb API will then
be different on Android so may not be included in the official libusb as
is'. They might be willing to add support at a later date.

Libdivecomputer - As considerable number of the divecomputers have ftdi
chipsets in them, the first step was support of libdivecomputer for ftdi
chipsets on android. As tty interface is not available for android, FTDI
chipset specific script have been developed that uses libftdi for
communication. This libftdi in turn uses libusb for USB communication.
serial_ftdi.c - This script is almost complete. Anton has found a crucial
bug in this script because of which a deadlock condition is met during
serial_read operations on android. The deadlock does not appear always and
has now been overcome by timing out in this condition. This needs further
examination. I have not been able to find a reason for this yet.

The patches associated with libusb, libftdi and libdivecomputer and
information thereof is present here
<https://github.com/venkateshshukla/gsoc14-deliverables>.

After this, the next part was using the tweaked
libusb-libftdi-libdivecomputer stack to enable download of dives in the Qt
based subsurface android ported by Anton. The original repo can be found
here <https://github.com/glance-/subsurface-android>. This was done and the
subsurface-android can now be used to download dives from ftdi based
divecomputers. The bug being due the deadlock mentioned above. The APK and
the associated usage instructions can be found here
<https://www.mail-archive.com/subsurface@hohndel.org/msg03344.html>.

Changes for addition of permissions of USB and Qt Android Template was
required for subsurface side of this application. A patch adding qt android
template was sent to the mailing list and was merged. Another patch adding
device_filter and USB permission is attached here. It also enables opening
of subsurface android application when a ftdi chipset based device is
attached to the android device. The second patch contains changes in
android.cpp for fd extraction of USB attached divecomputer device. I
request Anton to have a look at two abovementioned patches and sign-off
them for merging them to the upstream. The third patch contains changes for
passing const void *params instead of const char *name to libdivecomputer
for download. For posix and win32 systems, this would be the path to TTY
device while for android it would be the USB file descriptor (int). But
this requires changes with libdivecomputer as well and I would hold off
this one until necessary changes are made in libdivecomputer.
Patches and related information can be found here
<https://github.com/venkateshshukla/gsoc14-deliverables/tree/master/subsurface-android-qt>
as well.

The third part of this project was making of and android application that
does basically does what subsurface download from divecomputer feature
does. For this, I disregarded the Qt part of subsurface and made a
subsurface_jni library that provides us all the core functions of
subsurface. Extraction of dive data from divecomputer, processing of this
data, parsing and saving xml and so forth. This required addition of a new
build configuration in subsurface and scripts compensating for missing
fucntions which depended on Qt framework. These changes and related info
can be seen [here](
https://github.com/venkateshshukla/gsoc14-deliverables/tree/master/subsurface-android-jni).
The patches are not yet finalized and Anton and I am working on it still.
Patches could be sent to subsurface after that.

Incorporating all the above changes - libusb, libftdi and libdivecomputer
as well as subsurface_jni, an android application has been developed which
could download dives from ftdi based divecomputers. The application allows
you to choose the divecomputer, dive/dump name and logfile name along with
other options present in subsurface desktop application. Dives are then
downloaded and xml file saved in Dives folder of external storage of
android application. If dive of the same name is already present, it is
first parsed and loaded and then further dives are downloaded as per the
'force download' and 'prefer downloaded' option of the application.

The application can be found in this gihub repo
<https://github.com/venkateshshukla/subsurface-android-downloader>. The
application is still work in progress and have some bugs (again the
deadlock issue mentioned above). I would like your feedback, bugs reports
and other advice for improvement of this application. The apk file of the
application is attached. It can be found here
<https://github.com/venkateshshukla/subsurface-android-downloader/releases/> as
well. Usage can be seen here
<https://github.com/venkateshshukla/subsurface-android-downloader/blob/subsurface/README.md>
.

This is the sum total of work done by me during Google Summer of Code 2014.
The work, I understand, has many loose ends and a lot of work still needs
to be done. I will continue my work and contribute as much as I can towards
bringing subsurface on android.

The Google summer of code 2014 has been a turning point in my career and
has exposed me to the best of open source communities, some of the best
developers out there and some of the best written codes.

I thank Subsurface sincerely for giving me this opportunity.


Sincerely
-- 
Venkatesh Shukla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140822/eb720ae7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Open-subsurface-on-attaching-divecomputer.patch
Type: text/x-patch
Size: 2761 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140822/eb720ae7/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Extract-usb-file-descriptor-of-ftdi-on-Android.patch
Type: text/x-patch
Size: 4398 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140822/eb720ae7/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-On-android-use-file-descriptor-instead-of-name.patch
Type: text/x-patch
Size: 2821 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140822/eb720ae7/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subsurface-downloader-debug.apk
Type: application/vnd.android.package-archive
Size: 1661975 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140822/eb720ae7/attachment-0001.apk>


More information about the subsurface mailing list