Discussion:
SubSurface Mobile and OTG
Thomas Fänge
2018-05-23 05:15:40 UTC
Permalink
Hi!

First, thanks all for you effort and the great and useful application!

I'm connecting my dive computer to my Linux laptop, and that works perfect.
But, wouldn't it be possible to do that on the SubSurface Mobile (Android)
app too?

I have a "watertight" Sony phone, and I use a USB On-The-Go (OTG) cable to
use e.g. a mouse or external keyboard, so should it not then be possible to
use USB-communication from the SubSurface app too, instead of only a
Bluetooth connection? This would enable me to only bring the phone while
travelling, even on the boat or shore and download my dives, getting the
current position etc. without worrying if the phone gets wet or not.

Today, when I connect the dive computer to the phone with the OTG cable, I
can see on the leds on the interface cable that the connection is made to
the phone, but that interface (USB) never turns up as an option in the
SubSurface dive computer menu - only Bluetooth is available there.

Best regards,
Thomas
Miika Turkia
2018-05-23 05:29:13 UTC
Permalink
This does work for some divecomputers, depending on the ftdi chip that is
used on the cable. We also have some trouble with Android OS as some newer
Android versions prevent us from accessing the USB devices. What versions
of DC, cable (the serial chip), phone and Android you are using? (I have
used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully, don't
remember the Android version on the tablet.)
Post by Thomas Fänge
Hi!
First, thanks all for you effort and the great and useful application!
I'm connecting my dive computer to my Linux laptop, and that works perfect.
But, wouldn't it be possible to do that on the SubSurface Mobile (Android)
app too?
I have a "watertight" Sony phone, and I use a USB On-The-Go (OTG) cable to
use e.g. a mouse or external keyboard, so should it not then be possible to
use USB-communication from the SubSurface app too, instead of only a
Bluetooth connection? This would enable me to only bring the phone while
travelling, even on the boat or shore and download my dives, getting the
current position etc. without worrying if the phone gets wet or not.
Today, when I connect the dive computer to the phone with the OTG cable, I
can see on the leds on the interface cable that the connection is made to
the phone, but that interface (USB) never turns up as an option in the
SubSurface dive computer menu - only Bluetooth is available there.
Best regards,
Thomas
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Thomas Fänge
2018-05-23 06:19:44 UTC
Permalink
Hi Miika,

That sounds promising!

I use a Mares Puck Pro with the USB-cable (don't have it here right now so
I can't check the version of it nor the ftdi chip). And I use an Sony
Xperia XZ2 with the O release of Android.
But if you say that the support is there, then I could get the logs from
the phone and see what actually happens.
I could also try on an older Xperia Tablet (Z3 or Z4) and see if they work
(with an older Android cookie).

/Thomas
Post by Miika Turkia
This does work for some divecomputers, depending on the ftdi chip that is
used on the cable. We also have some trouble with Android OS as some newer
Android versions prevent us from accessing the USB devices. What versions
of DC, cable (the serial chip), phone and Android you are using? (I have
used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully, don't
remember the Android version on the tablet.)
Post by Thomas Fänge
Hi!
First, thanks all for you effort and the great and useful application!
I'm connecting my dive computer to my Linux laptop, and that works perfect.
But, wouldn't it be possible to do that on the SubSurface Mobile
(Android) app too?
I have a "watertight" Sony phone, and I use a USB On-The-Go (OTG) cable
to use e.g. a mouse or external keyboard, so should it not then be possible
to use USB-communication from the SubSurface app too, instead of only a
Bluetooth connection? This would enable me to only bring the phone while
travelling, even on the boat or shore and download my dives, getting the
current position etc. without worrying if the phone gets wet or not.
Today, when I connect the dive computer to the phone with the OTG cable,
I can see on the leds on the interface cable that the connection is made to
the phone, but that interface (USB) never turns up as an option in the
SubSurface dive computer menu - only Bluetooth is available there.
Best regards,
Thomas
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Guillaume Gardet
2018-05-23 08:55:12 UTC
Permalink
Hi,
This does work for some divecomputers, depending on the ftdi chip that is used on the cable. We also have some trouble with Android OS as some newer Android versions prevent us from accessing the USB devices. What versions of DC, cable (the serial chip), phone and Android you are using? (I have used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully, don't remember the Android version on the tablet.)
Does it still work? Because Vyper Air on a Nexus 7 fails for me. :(

See: http://lists.subsurface-divelog.org/pipermail/subsurface/2018-May/032015.html

Guillaume
Hi!
First, thanks all for you effort and the great and useful application!
I'm connecting my dive computer to my Linux laptop, and that works perfect.
But, wouldn't it be possible to do that on the SubSurface Mobile (Android) app too?
I have a "watertight" Sony phone, and I use a USB On-The-Go (OTG) cable to use e.g. a mouse or external keyboard, so should it not then be possible to use USB-communication from the SubSurface app too, instead of only a Bluetooth connection? This would enable me to only bring the phone while travelling, even on the boat or shore and download my dives, getting the current position etc. without worrying if the phone gets wet or not.
Today, when I connect the dive computer to the phone with the OTG cable, I can see on the leds on the interface cable that the connection is made to the phone, but that interface (USB) never turns up as an option in the SubSurface dive computer menu - only Bluetooth is available there.
Best regards,
Thomas
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface <http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Miika Turkia
2018-05-24 04:33:25 UTC
Permalink
Post by Miika Turkia
Hi,
This does work for some divecomputers, depending on the ftdi chip that is
used on the cable. We also have some trouble with Android OS as some newer
Android versions prevent us from accessing the USB devices. What versions
of DC, cable (the serial chip), phone and Android you are using? (I have
used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully, don't
remember the Android version on the tablet.)
Does it still work? Because Vyper Air on a Nexus 7 fails for me. :(
Couldn't find the original cable for Vyper air, but tested with D4. Failed
:(

miika
Thomas Fänge
2018-05-24 06:23:52 UTC
Permalink
Hi!

Tested yesterday with several different phones and tablets (all Sony), but
none of them worked. Some models doesn't enable OTG without restarting the
phone with the cable inserted (to avoid powerleakage with nothing
connected), but all phone "detects" the DC (at least the cable led turns
from green to red when connected) when the USB-port is enabled.
I can see in the log that the phone wants to use "SERIAL" interface, asks
for available interfaces and the phone responds with "SERIAL USB USBHID",
but shortly after the error DC_STATUS_UNSUPPORTED is reported and the
DCDownloadThread stops.

Just quickly looking into the code, I think the error originates from
divecomputer_device_open, where "SERIAL" is requested and supported by the
phone.

If serial (as in this case), the following code is executed
(core/libdivecomputer.c):

if (transports & DC_TRANSPORT_SERIAL) {
rc = dc_serial_open(&data->iostream, context, data->devname);
if (rc == DC_STATUS_SUCCESS)
return rc;

#ifdef SERIAL_FTDI
if (!strcmp(data->devname, "ftdi")) {
rc = ftdi_open(&data->iostream, context);
if (rc == DC_STATUS_SUCCESS)
return rc;
}
#endif
}
...
return DC_STATUS_UNSUPPORTED;

I have not digged to far, but I guess that it is this errorcode
(DC_STATUS_UNSUPPORTED) that we see.
So, either dc_serial_open or ftdi_open fails (can't see any error from them
in the log), but I could try to dig deeper ...

Related question: where can I find the log? I can show the log on the
display (from menu "Developer/App log"), but I can't copy text from that
view - is it stored somewhere? I looked for it in the filesystem, but can't
find it ...

Cheers!
Thomas
On Wed, May 23, 2018 at 11:55 AM, Guillaume Gardet <
Post by Miika Turkia
Hi,
This does work for some divecomputers, depending on the ftdi chip that is
used on the cable. We also have some trouble with Android OS as some newer
Android versions prevent us from accessing the USB devices. What versions
of DC, cable (the serial chip), phone and Android you are using? (I have
used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully, don't
remember the Android version on the tablet.)
Does it still work? Because Vyper Air on a Nexus 7 fails for me. :(
Couldn't find the original cable for Vyper air, but tested with D4. Failed
:(
miika
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Thomas Fänge
2018-05-24 07:09:58 UTC
Permalink
Hi again,

Found the log files 😉

Libdivecomputer.log says:

Subsurface: v4.7.8-213-g6a91611e90cc, built with libdivecomputer
v0.7.0-devel-Subsurface-NG (e97a47cca55973199715df0f818b4955e60d3a31)
INFO: Open: name=ftdi
ERROR: No such file or directory (2) [in
/data/android/subsurface/libdivecomputer/src/serial_posix.c:295
(dc_serial_open)]

So, as I guessed, dc_serial_open failed.

I also found an issue (#1240) on github with the same problem - accessing
ftdi ...

Cheers!
Post by Thomas Fänge
Hi!
Tested yesterday with several different phones and tablets (all Sony), but
none of them worked. Some models doesn't enable OTG without restarting the
phone with the cable inserted (to avoid powerleakage with nothing
connected), but all phone "detects" the DC (at least the cable led turns
from green to red when connected) when the USB-port is enabled.
I can see in the log that the phone wants to use "SERIAL" interface, asks
for available interfaces and the phone responds with "SERIAL USB USBHID",
but shortly after the error DC_STATUS_UNSUPPORTED is reported and the
DCDownloadThread stops.
Just quickly looking into the code, I think the error originates from
divecomputer_device_open, where "SERIAL" is requested and supported by the
phone.
If serial (as in this case), the following code is executed
if (transports & DC_TRANSPORT_SERIAL) {
rc = dc_serial_open(&data->iostream, context, data->devname);
if (rc == DC_STATUS_SUCCESS)
return rc;
#ifdef SERIAL_FTDI
if (!strcmp(data->devname, "ftdi")) {
rc = ftdi_open(&data->iostream, context);
if (rc == DC_STATUS_SUCCESS)
return rc;
}
#endif
}
...
return DC_STATUS_UNSUPPORTED;
I have not digged to far, but I guess that it is this errorcode
(DC_STATUS_UNSUPPORTED) that we see.
So, either dc_serial_open or ftdi_open fails (can't see any error from
them in the log), but I could try to dig deeper ...
Related question: where can I find the log? I can show the log on the
display (from menu "Developer/App log"), but I can't copy text from that
view - is it stored somewhere? I looked for it in the filesystem, but can't
find it ...
Cheers!
Thomas
On Wed, May 23, 2018 at 11:55 AM, Guillaume Gardet <
Post by Miika Turkia
Hi,
This does work for some divecomputers, depending on the ftdi chip that
is used on the cable. We also have some trouble with Android OS as some
newer Android versions prevent us from accessing the USB devices. What
versions of DC, cable (the serial chip), phone and Android you are using?
(I have used OTG on Nexus 7 tablet and Suunto Vyper Air DC successfully,
don't remember the Android version on the tablet.)
Does it still work? Because Vyper Air on a Nexus 7 fails for me. :(
Couldn't find the original cable for Vyper air, but tested with D4.
Failed :(
miika
_______________________________________________
subsurface mailing list
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Loading...