On 04 October, 2016 - Willem Ferguson wrote: > 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 > >-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, > > 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? >
Yep > 2) How does Linux see the USB character device? Where would I find > it? By using dmesg like for other USB devices? > lsusb , ls /dev/bus/usb/$bus/$device . > 3) Where does one find the vid/pid information for the ftdi device? > If a vendor uses a custom vid/pid its hard to say. The most complete list i know of is: https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ftdi_sio.c#L142 That said. I think we should only add custom vid/pid's that we know dive computers use. > 4) I assume android/res/xml/device_filter.xml is irrelevant for > building and executing on Linux (Ubuntu 15.04 or F22)? > Yes. There is no reson to use the libftdi code on linux other than to test the implementation or different ftdi-cables. It's only real use case is where real kernel drivers doesn't exists, ie Android. //Anton -- Anton Lundin +46702-161604 _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
