From: John Melton - G0ORX <john.d.melton@googlemail.com>
Date: Wed, 11 Aug 2021 05:38:41 +0000 (+0100)
Subject: fix LOCALCW problem with CWL and CWR being added twice to line monitoring
X-Git-Url: https://git.rkrishnan.org/pf/content/en/frontends/flags//%22%3C?a=commitdiff_plain;h=9d373452843619e3e53f197579a84f6ec171ed98;p=pihpsdr.git

fix LOCALCW problem with CWL and CWR being added twice to line monitoring
---

diff --git a/gpio.c b/gpio.c
index 5505c5b..e5afe7e 100644
--- a/gpio.c
+++ b/gpio.c
@@ -1029,14 +1029,9 @@ int gpio_init() {
     if((ret=setup_line(chip,CWL_BUTTON,CW_ACTIVE_LOW==1))<0) {
       goto err;
     }
-    monitor_lines[lines]=CWL_BUTTON;
-    lines++;
     if((ret=setup_line(chip,CWR_BUTTON,CW_ACTIVE_LOW==1))<0) {
       goto err;
     }
-    monitor_lines[lines]=CWR_BUTTON;
-    lines++;
-
   }
   if (ENABLE_GPIO_SIDETONE) {
 //
@@ -1093,7 +1088,11 @@ void gpio_close() {
 void gpio_cw_sidetone_set(int level) {
   int rc;
   if (ENABLE_GPIO_SIDETONE) {
+#ifdef OLD_GPIOD
+    if((rc=gpiod_ctxless_set_value(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL))<0) {
+#else
     if((rc=gpiod_ctxless_set_value_ext(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL,0))<0) {
+#endif
       g_print("%s: err=%d\n",__FUNCTION__,rc);
     }
   }