[PATCH] Commented out section waiting on commit from libdivecomputer. It relied on DC_EVENT_BATTERY.

Linus Torvalds torvalds at linux-foundation.org
Mon Oct 27 18:03:07 PDT 2014


On Mon, Oct 27, 2014 at 5:51 PM, John Van Ostrand <john at vanostrand.com> wrote:
> +/* waiting for libdivecomputer patch
>                 case 0xC2:      // Low battery warning
>                         add_event(dc, seconds, SAMPLE_EVENT_BATTERY,
>                                         SAMPLE_FLAGS_NONE, 0,
>                                         QT_TRANSLATE_NOOP("gettextFromC", "battery"));
>                         break;
> +*/

Please change your libdivecomputer patch to do what I did with some
EON Steel infrastructure: add a

    #define SAMPLE_EVENT_BATTERY SAMPLE_EVENT_BATTERY

define in the header file that declares that thing, and then users can just do

  #ifdef SAMPLE_EVENT_BATTERY
             ...
   #endif

and it will automatically pick up on whether the libdivecomputer you
are building against supports this or not.

Anything else is broken. Checking versions is insane (and doesn't work
in between releases). The whole "check if it's defined" is the sane
and clean way to do these things, and the self-define is the way to
handle things that are actually declared other ways (ie as enum's as
in this case, or just function declarations etc for new support
functions).

               Linus


More information about the subsurface mailing list