diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /wifi/asusled.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
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
Diffstat (limited to 'wifi/asusled.cpp')
-rw-r--r-- | wifi/asusled.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
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 : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <fstream> +#include "asusled.h" + +#include <kdebug.h> + +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; + } + +} |