Add support for the Beuchat Voyager 2G.
Another gitignore update.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Disable the gas mixes in gauge mode.
Improve the warning and error messages.
Remove the percentage variable.

There is already another variable for the O2 percentage, so re-use that
one instead.
Fix the length of the Suunto DX gas change event.

The Suunto DX uses 5 bytes for the 0x06 gas change event.
Merge branch 'dx'
Apply the gas mode immediately.

Because the gas mode takes precedence over the individual gas mix
definitions, we can simplify the code by taking the gas mode into
account immediately when parsing the gas mixes.
Cache the initial gas mix.

The gas mode should not only be taken into account for parsing the gas
mix definitions, but also for the initial gas mix. Because the logic
needs to be kept in sync, it's convenient to have all related code in a
single place, and cache the value.
Ignore disabled gas mixes.

For the older models, gas mixes are disabled by setting their oxygen
percentage byte to 0x00 or 0xFF. Trying to parse such a byte as a valid
percentage results in an invalid gas mix.

Because the device doesn't allow you to enable a gas mix if the previous
gas mix has already been disabled, we can simply stop parsing the gas
mixes once the first disabled gas mix has been found.
Merge branch 'gasmix'
Fix the temperature for the Sherwood Wisdom 2.

The sign bit should be reversed for this model.
Modified to pass file descriptor instead of path

As an experiment, the file descriptor was passed on rather than
path to the tty. Refer
http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection.html#getFileDescriptor()
for documentation regarding file descriptor to be transferred.
The idea is that Java side of the project will obtain permission for
usage of USB device and pass it on to the native side. Using this
file descriptor, the libdivecomputer is expected to import dives.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Revert to passing name rather than fd

As experiment 2 failed with the Error ENOTTY : Not a typewriter
we would revert to the original mechanism.
The reason behind this failure is explained by Jef.
The file descriptor given by android is actually the file
descriptor of the USB device not the tty built over it.
Hence it would not be possible to use libdivecomputer with this
file descriptor.
But maybe libusb can utilise this?

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Initial version serial_ftdi.c

This is based on serial_posix script.
There are a number of shortcomings.
Biggest of them is macro definition of VID and PID. Rather than this,
maintain a list of VID and PID of accepted FTDI devices.
Unimplemented functions like get_transmitted, send_break and set_break
return -1 on call.

For device_open(), vid pid would be better arguments than the path as
path is not too helpful for libftdi and libusb.

serial_enumerate gives back the path of all the devices present on all
hubs on android. Basically, all the files present in all the subfolders
of /dev/bus/usb.
A better implementation would be a set of ftdi devices attached to the
android. This could be done either using jni by enumerate_device in
android.cpp or using libusb and passing vid pid as an argument.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Check for libftdi and build for android

Added check for libftdi during configure.
Suitable modifications to enable cross building for android platform.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Corrected include statement for ftdi.h

Use libusb.h instead of libusb-1.0/ftdi.h

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Corrections in serial_open and serial_set_timeout

ftdi_context->timeout is the timeout used while libusb_bulk_transfer.
On the other hand, libdivecomputer context is used internally by
libdivecomputer. So inappropriate to set both here. By default libftdi
sets a timeout of 5000 ms on both read and write.

Usage of struct ftdi_context was wrong. Fixed it.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Finally a working version. Try again on no data.

ftdi_read_data returns 0 if no data is received from
the device. The existing code understood it as timeout errror.
Removing this check might end up in an infinite loop. But it works
in OSTC3. This should be checked further.
Cross compilation of libdivecomputer on android and running it
gives the results same as the ones on pc.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Check multiple pids while opening device

libftdi returns -3 when it could not find any device corresponding to
the pid and vid given. (Different from -3 of libusb which means you do
not have permissions to access the device)
Using this value, check among a list of accepted pids. VID is that of
ftdi ( file is called serial_ftdi :)
There is a problem when multiple devices are connected. It uses the
first one it can find in the list. This might not be correct always.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>