From patchwork Thu Jan 7 07:03:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrice Fontaine X-Patchwork-Id: 1423170 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rcM7OiMi; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBHKB4Ngrz9sVt for ; Thu, 7 Jan 2021 18:04:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 49A4184647; Thu, 7 Jan 2021 07:04:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gz-N0N5INdtz; Thu, 7 Jan 2021 07:04:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 90BB48464B; Thu, 7 Jan 2021 07:04:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id E04AA1BF573 for ; Thu, 7 Jan 2021 07:04:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D450187332 for ; Thu, 7 Jan 2021 07:04:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bh6kGrA0M1-O for ; Thu, 7 Jan 2021 07:04:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by hemlock.osuosl.org (Postfix) with ESMTPS id 940648732A for ; Thu, 7 Jan 2021 07:04:08 +0000 (UTC) Received: by mail-wr1-f49.google.com with SMTP id t16so4574485wra.3 for ; Wed, 06 Jan 2021 23:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ky3EzlPxHT8oe8PocL9/eHDUKVwK3QN5ZndOGcGfMEE=; b=rcM7OiMi4gM0bdOn07s4mI53V7BbkWv/dHHsvJ8KGS0v3p8Ho5wspB+EO33loCUPOR ouKCulTBUYZW9Da8JW0SDOTcfiQyIuzi/G29k4A4w9bv/CWikyBBddfumViV98Zrq+6u T5tYpT3s30y46VXf4EQLeaUW1Jg/J4VFfECAKdblzAMIo+BH1uh112/eOpZ3qKNHLdMp OHcA1AQjz2BF9+p9szlwJANNLq7Os2GshfopyD99hT+NToOecagi4g5R/CmVnTxg3WCk SE+BH0ikRohRxyvyUk3Ci08dV00YsVV2EGv5z8fVF+PKswdb+OOjqptF+OO1Wz9gz2LH eNrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ky3EzlPxHT8oe8PocL9/eHDUKVwK3QN5ZndOGcGfMEE=; b=m3XTADFvxHtY8B7bK4ny9iNxL9mCuNVda2u3nNafyQ6/MmJSoh074/cn7ULvyeIl2S HvK7N+oZfyFGS4DeeK+XbHL+6g2+g64T1aqJqJhLkyiOD16DTv0TyiXboVP8wYBWWVzI k7xSDPVEutnh5xJAaEYyZnLIV/9L5Q7GGOxqyibWDueI/kCI8yNRNarR3HCRttTvxKz1 x6Fbopfw36sVyxoMlRiL4s9BTSfREVFTCQgh7kbjZfdyb8mAoPGTwB974ZhjbdXuz6Ku h6FEwFZxZTggp3N14ej34mYcP8Q7lP/MdCdEMjGt7jnL6a7CKBwp7A6ibcvoKspTiCTP OaqA== X-Gm-Message-State: AOAM5338fpk193onNjuGTiAdKNfDQa+KpFCqflgUyBKh67SN8Sl735MK OxSOMlOhw1Dez6JxbdWi83/jQmlDLd4= X-Google-Smtp-Source: ABdhPJzmxjJfe9HK+q8z+xvGu/QB9xzxQ4MTepgkJhtDW9NmLQi+zJR8lMe2cOlQ/ePdYEFy+mQpww== X-Received: by 2002:adf:d082:: with SMTP id y2mr7557262wrh.301.1610003046723; Wed, 06 Jan 2021 23:04:06 -0800 (PST) Received: from kali.home (lfbn-ren-1-1337-238.w86-229.abo.wanadoo.fr. [86.229.184.238]) by smtp.gmail.com with ESMTPSA id n11sm7213987wra.9.2021.01.06.23.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 23:04:06 -0800 (PST) From: Fabrice Fontaine To: buildroot@buildroot.org Date: Thu, 7 Jan 2021 08:03:32 +0100 Message-Id: <20210107070332.388993-1-fontaine.fabrice@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] package/olsr: fix build of pud plugin X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrice Fontaine Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Fix build of pud plugin which was added with commit 318d160fe5b080e421dc133dff82d5ea2cf7d893 Fixes: - http://autobuild.buildroot.org/results/5b598d728e6aae61b295681b0d7777e83074fecd Signed-off-by: Fabrice Fontaine --- ...ud-adapt-to-API-changes-in-gpsd-3-20.patch | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 package/olsr/0003-pud-adapt-to-API-changes-in-gpsd-3-20.patch diff --git a/package/olsr/0003-pud-adapt-to-API-changes-in-gpsd-3-20.patch b/package/olsr/0003-pud-adapt-to-API-changes-in-gpsd-3-20.patch new file mode 100644 index 0000000000..f97798d605 --- /dev/null +++ b/package/olsr/0003-pud-adapt-to-API-changes-in-gpsd-3-20.patch @@ -0,0 +1,105 @@ +From b2dfb6c27fcf4ddae87b0e99492f4bb8472fa39a Mon Sep 17 00:00:00 2001 +From: Eneas U de Queiroz +Date: Thu, 13 Feb 2020 17:26:41 -0300 +Subject: [PATCH] pud: adapt to API changes in gpsd 3.20 + +The timestamp fields were changed from double to struct timespec, and +the geoid separation field was moved to fix.geoid_sep. + +Signed-off-by: Eneas U de Queiroz + +[Retrieved from: +https://github.com/OLSR/olsrd/commit/b2dfb6c27fcf4ddae87b0e99492f4bb8472fa39a] +Signed-off-by: Fabrice Fontaine +--- + lib/pud/src/gpsdclient.c | 36 ++++++++++++++++++++++++++++++++---- + 1 file changed, 32 insertions(+), 4 deletions(-) + +diff --git a/lib/pud/src/gpsdclient.c b/lib/pud/src/gpsdclient.c +index 9e7fb708d..2a7a26eef 100644 +--- a/lib/pud/src/gpsdclient.c ++++ b/lib/pud/src/gpsdclient.c +@@ -79,6 +79,23 @@ static void gpsdError(const char *s) { + syslog(LOG_ERR, "gpsd error: %s", s); + } + ++#if GPSD_API_MAJOR_VERSION >= 9 ++static double time_as_double(struct timespec *ts) { ++ return (ts->tv_sec + ts->tv_nsec * 1e-9); ++} ++ ++static bool is_online(struct gps_data_t *gpsdata) { ++ return !!gpsdata->online.tv_sec; ++} ++#else ++ ++#define time_as_double(x) *(x) ++ ++static bool is_online(struct gps_data_t *gpsdata) { ++ return !!gpsdata->online; ++} ++#endif ++ + /* standard parsing of a GPS data source spec */ + void gpsdParseSourceSpec(char *arg, GpsDaemon *gpsDaemon) { + if (!arg // +@@ -298,8 +315,8 @@ void nmeaInfoFromGpsd(struct gps_data_t *gpsdata, NmeaInfo *info, struct GpsdCon + 8, // + dev->parity, // + dev->stopbits, // +- dev->cycle, // +- dev->mincycle); ++ time_as_double(&dev->cycle), // ++ time_as_double(&dev->mincycle)); + + connectionTracking->devSeen[i] = true; + connectionTracking->dev[i] = *dev; +@@ -367,11 +384,18 @@ void nmeaInfoFromGpsd(struct gps_data_t *gpsdata, NmeaInfo *info, struct GpsdCon + nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_SMASK); + + /* date & time */ ++#if GPSD_API_MAJOR_VERSION >= 9 ++ if (gpsdata->fix.time.tv_sec > 0) { ++ struct tm *time = gmtime(&gpsdata->fix.time.tv_sec); ++ unsigned int hsec = (unsigned int) (gpsdata->fix.time.tv_nsec / 10000000); ++#else + if (!isNaN(gpsdata->fix.time)) { + double seconds; + double fraction = modf(fabs(gpsdata->fix.time), &seconds); + long sec = lrint(seconds); + struct tm *time = gmtime(&sec); ++ unsigned int hsec = (unsigned int) lrint(fraction * 100); ++#endif + if (time) { + info->utc.year = (unsigned int) time->tm_year + 1900; + info->utc.mon = (unsigned int) time->tm_mon + 1; +@@ -379,7 +403,7 @@ void nmeaInfoFromGpsd(struct gps_data_t *gpsdata, NmeaInfo *info, struct GpsdCon + info->utc.hour = (unsigned int) time->tm_hour; + info->utc.min = (unsigned int) time->tm_min; + info->utc.sec = (unsigned int) time->tm_sec; +- info->utc.hsec = (unsigned int) lrint(fraction * 100); ++ info->utc.hsec = hsec; + + nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_UTCDATE | NMEALIB_PRESENT_UTCTIME); + } +@@ -387,7 +411,7 @@ void nmeaInfoFromGpsd(struct gps_data_t *gpsdata, NmeaInfo *info, struct GpsdCon + gpsdata->set &= ~TIME_SET; + + /* sig & fix */ +- if (!gpsdata->online) { ++ if (!is_online(gpsdata)) { + gpsdata->fix.mode = MODE_NO_FIX; + } + +@@ -454,7 +478,11 @@ void nmeaInfoFromGpsd(struct gps_data_t *gpsdata, NmeaInfo *info, struct GpsdCon + if ((gpsdata->fix.mode >= MODE_3D) // + && !isNaN(gpsdata->fix.altitude)) { + info->elevation = gpsdata->fix.altitude; ++#if GPSD_API_MAJOR_VERSION >= 9 ++ info->height = gpsdata->fix.geoid_sep; ++#else + info->height = gpsdata->separation; ++#endif + nmeaInfoSetPresent(&info->present, NMEALIB_PRESENT_ELV | NMEALIB_PRESENT_HEIGHT); + } + gpsdata->set &= ~ALTITUDE_SET;