Testing ftdi code

Anton Lundin glance at acc.umu.se
Sun Sep 18 01:48:45 PDT 2016


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
-DFTDISUPPORT=ON

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


-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list