this looks suspiciously easy

Dirk Hohndel dirk at hohndel.org
Wed Apr 18 23:40:55 PDT 2018


On Wed, Apr 18, 2018 at 11:37:53PM -0700, Dirk Hohndel wrote:
> On Thu, Apr 19, 2018 at 08:13:23AM +0200, Jef Driesen wrote:
> > 
> > You can also get the mask with the built-in transports from libdivecomputer
> > with the dc_context_get_transports() function. With the above, you'll for
> > example show usb or usbhid devices even when libdivecomputer was build
> > without usb or usbhid support.
> > 
> > For transports where subsurface uses a custom I/O implementation (bluetooth
> > and ble), you of course need to set the bits as above.
> 
> Cool - that's even better.
> Of course I first wondered... darn, where do I get the context from in
> this part of my code. Then I looked at the sources of libdivecomputer...
> 
> unsigned int
> dc_context_get_transports (dc_context_t *context)
> {
>         UNUSED(context);
> 
>         return DC_TRANSPORT_SERIAL
> #if defined(HAVE_LIBUSB)
>                 | DC_TRANSPORT_USB
> #endif
> ...
> 
> OK, I guess I'll just pass in a NULL pointer :-)

... aaaaand of course... since it ALWAYS adds in the DC_TRANSPORT_SERIAL
flag, I guess I have to mask that back out on iOS where we don't actually
have support for serial dive computers...

/D


More information about the subsurface mailing list