Testing ftdi code

Willem Ferguson willemferguson at zoology.up.ac.za
Tue Oct 4 06:57:57 PDT 2016

On 18/09/2016 10:48, Anton Lundin wrote:
> After the last round of custom serial rewrite, the ftdi custom serial
> code now can be used with all libdivecomputer backends, and not just
> OSTC3.
> I thought its time to share how this works so more developers can test
> different backends with the ftdi code.
> 1. Start by installing libftdi1. Either download the source from
> http://www.intra2net.com/en/developer/libftdi/download.php and build it
> yourself (only c library is needed, see packaging/android/build.sh for
> ref.) or install it from your package manager. In debian/ubuntu the
> relevant package is libftdi1-dev.
> 2. Build subsurface with FTDI support by calling cmake with
> 3. Plug in your ftdi device/cable and chown the usb character device
> your test user. lsusb will give you bus / device and the device is found
> at /dev/bus/usb/$bus/$device . This can be automated with udev.
> 4. Open the regular download from divecomputer dialog and choose vendor
> / device. Instead of entering a serial port, enter "ftdi" in the "Device
> or mountpoint" filed.
> 5. Click download, and the custom serial code will kick in, using the
> first ftdi device it finds.
> There are probably a bunch of usb vid/pid's missing so if you know that
> your device uses ftdi, you can add those vid/pid's to
> core/serial_ftdi.c: serial_ftdi_open_device(...) and to
> android/res/xml/device_filter.xml.
> Note. The libftdi code doesn't make sense on regular systems, where a
> good native serial<->usb driver is already available, but it rather
> makes sense on Android, where we don't have any kernel driver for ftdi.
> This way we can test the code on regular machines, before testing it on
> Android. Its way easier to debug on a regular machine.
> If you're feeling adventurous, you can build Subsurface desktop for
> android and do the exact same things on Android. I suggest using a mouse
> to navigate the ui.
> //Anton


I am now starting to work with this. But need a bit of help.

1) I do not use cmake directly (I'm far too dumb for that) but use the 
build.sh script for building subsurface. I assume I can add the 
-DFTDISUPPORT=ON to the call on line 245 of the build script?

2) How does Linux see the USB character device? Where would I find it? 
By using dmesg like for other USB devices?

3) Where does one find the vid/pid information for the ftdi device?

4) I assume   android/res/xml/device_filter.xml is irrelevant for 
building and executing on Linux (Ubuntu 15.04 or F22)?

Kind regards,

More information about the subsurface mailing list