From: Marten Richter Date: Wed, 30 Oct 2013 07:26:27 +0000 (+0100) Subject: Add led patch by dingo35 X-Git-Tag: 0-4-1~1^2~14 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=4345f657818890b8885464845d6607238bfa6f36;p=vompclient.git Add led patch by dingo35 --- diff --git a/ledraspberry.cc b/ledraspberry.cc index bda573a..6269546 100644 --- a/ledraspberry.cc +++ b/ledraspberry.cc @@ -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; }