gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-mdb] 90/93: backlight on/off added


From: gnunet
Subject: [taler-taler-mdb] 90/93: backlight on/off added
Date: Mon, 18 Nov 2019 21:13:53 +0100

This is an automated email from the git hooks/post-receive script.

marco-boss pushed a commit to branch master
in repository taler-mdb.

commit a7b2536c88432536abc17994bc33201825dd8630
Author: Boss Marco <address@hidden>
AuthorDate: Sat Nov 16 14:42:00 2019 +0100

    backlight on/off added
---
 src/main.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 07aae62..6c0dfa3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -54,6 +54,8 @@ along with
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <linux/fb.h>
+#include <linux/gpio.h>
+
 
 /**
  * Disable i18n support.
@@ -146,6 +148,8 @@ struct Display
 {
   int devicefd;
 
+  int backlightfd;
+
   uint16_t *memory;
 
   struct fb_var_screeninfo orig_vinfo;
@@ -262,14 +266,18 @@ show_qrcode (const char *uri)
       unsigned int xoff = x * nwidth / size;
       unsigned int yoff = y * nwidth / size;
       unsigned int off = xoff + yoff * qrc->width;
-      if ( (xoff >= qrc->width) ||
-           (yoff >= qrc->width) )
+      if ( (xoff >= (unsigned) qrc->width) ||
+           (yoff >= (unsigned) qrc->width) )
         continue;
       qrDisplay.memory[(y + yOff) * qrDisplay.var_info.xres + (x + xOff)] =
         (0 == (qrc->data[off] & 1)) ? 0xFFFF : 0x0000;
     }
+
   QRcode_free (qrc);
   QRinput_free (qri);
+
+  if (0 < qrDisplay.backlightfd)
+    write (qrDisplay.backlightfd, "1", 1);
 }
 
 #endif
@@ -299,7 +307,8 @@ cleanup_payment (struct PaymentActivity *pa)
               0xFF,
               qrDisplay.var_info.xres * qrDisplay.var_info.yres
               * sizeof (uint16_t));
-    /* FIXME: dimm background light of display */
+    if (0 < qrDisplay.backlightfd)
+      write (qrDisplay.backlightfd, "0", 1);
 #endif
     GNUNET_free (pa->taler_pay_uri);
   }
@@ -1069,6 +1078,23 @@ run (void *cls,
                   "failed to map display memory\n");
       return;
     }
+
+    memset (qrDisplay.memory,
+            0xFF,
+            qrDisplay.var_info.xres * qrDisplay.var_info.yres
+            * sizeof (uint16_t));
+
+    qrDisplay.backlightfd = open (
+      "/sys/class/backlight/soc:backlight/brightness", O_WRONLY);
+    if (0 > qrDisplay.backlightfd)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "failed to load 
\"/sys/class/backlight/soc:backlight/brightness\", display backlight will not 
be changed\n");
+    }
+    else
+    {
+      write (qrDisplay.backlightfd, "0", 1);
+    }
   }
   else
   {

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]