From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- wifi/asusled.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 wifi/asusled.cpp (limited to 'wifi/asusled.cpp') diff --git a/wifi/asusled.cpp b/wifi/asusled.cpp new file mode 100644 index 00000000..19784c16 --- /dev/null +++ b/wifi/asusled.cpp @@ -0,0 +1,78 @@ + +/*************************************************************************** + led.cpp - description + ------------------- + begin : wo okt 8 2003 + copyright : (C) 2003 by Stefan Winter + email : mail@stefan-winter.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include "asusled.h" + +#include + +Led::Led () +{ + led = new std::ofstream ("/proc/acpi/asus/wled"); + + // If there is no LED, just give a one time warning on cerr + if (!(*led)) + { + static bool error_given = false; + if (!error_given) + { + kdDebug () << + "No Asus WLAN LED found, disabling LED updates" << endl; + error_given = true; + } + } + Off (); + // if Asusled not present, state never gets initialised, so we do it once here + // so that valgrind doesn't complain. + state = false; +} + +Led::~Led () +{ + + Off (); + delete led; + +} + + +void +Led::On (void) +{ + + if (*led) + { + *led << 1; + led->flush (); + state = true; + } + +} + +void +Led::Off (void) +{ + + if (*led) + { + *led << 0; + led->flush (); + state = false; + } + +} -- cgit v1.2.1