]> git.vomp.tv Git - vompclient.git/commitdiff
Add led patch by dingo35
authorMarten Richter <marten.richter@freenet.de>
Wed, 30 Oct 2013 07:26:27 +0000 (08:26 +0100)
committerMarten Richter <marten.richter@freenet.de>
Wed, 30 Oct 2013 07:26:27 +0000 (08:26 +0100)
ledraspberry.cc

index bda573a993bd55011eb68cfddc846b402dfbfd6d..6269546d1205e69cc0a4b28ce1d3d573dadb4114 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "ledraspberry.h"
 
+#define GREEN_LED "/sys/class/leds/led0/brightness"
+
 LedRaspberry::LedRaspberry()
 {
   initted = 0;
@@ -32,6 +34,11 @@ LedRaspberry::~LedRaspberry()
 int LedRaspberry::init(int tdevice)
 {
   if (initted) return 0;
+  FILE *led=fopen(GREEN_LED,"w");
+  if (led) {
+    fputc('0',led);
+    fclose(led);
+  }
   initted = 1;
   return 1;
 }
@@ -46,11 +53,21 @@ int LedRaspberry::shutdown()
 int LedRaspberry::on()
 {
   if (!initted) return 0;
+  FILE *led=fopen(GREEN_LED,"w");
+  if (led) {
+    fputc('1',led);
+    fclose(led);
+  }
   return 0;
 }
 
 int LedRaspberry::off()
 {
   if (!initted) return 0;
+  FILE *led=fopen(GREEN_LED,"w");
+  if (led) {
+    fputc('0',led);
+    fclose(led);
+  }
   return 0;
 }