From 477629dd03d1dc3e0cd23135034de1f0e98a14b3 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Fri, 23 Jul 2021 15:18:48 +0200
Subject: [PATCH] let it compile with old libgipod

---
 gpio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gpio.c b/gpio.c
index a61244e..277bed0 100644
--- a/gpio.c
+++ b/gpio.c
@@ -1088,6 +1088,7 @@ void gpio_cw_sidetone_set(int level) {
   int rc;
   if (ENABLE_GPIO_SIDETONE) {
 #ifdef GPIO
+#ifdef OLD_GPIOD
     //
     // changed from gpiod_ctxless_set_value_ext to gpiod_ctxless_set_value,
     // so it works with older gpiod libs
@@ -1095,6 +1096,11 @@ void gpio_cw_sidetone_set(int level) {
     if((rc=gpiod_ctxless_set_value(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL))<0) {
       g_print("%s: err=%d\n",__FUNCTION__,rc);
     }
+#else
+    if((rc=gpiod_ctxless_set_value_ext(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL,0))<0) {
+      g_print("%s: err=%d\n",__FUNCTION__,rc);
+    }
+#endif
 #endif
   }
 }
-- 
2.45.2