aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2009-07-11 01:26:57 -0400
committerjim-p <jim@pingle.org>2009-07-11 01:26:57 -0400
commite968f5ee09483675c3fc73a9a34c1fbd06b1be54 (patch)
tree6e0eecd675722afb5c2ca60eae1b8d588328e038
parent6df4fc24f66bbfc9edef0ec3303b518b2eb12e61 (diff)
downloadpfsense-packages-e968f5ee09483675c3fc73a9a34c1fbd06b1be54.tar.gz
pfsense-packages-e968f5ee09483675c3fc73a9a34c1fbd06b1be54.tar.bz2
pfsense-packages-e968f5ee09483675c3fc73a9a34c1fbd06b1be54.zip
Let's try a blinkled package. Also part of feature #17
Seemed like a good idea at the time.
-rw-r--r--config/blinkled/binaries/blinkledbin0 -> 9311 bytes
-rw-r--r--config/blinkled/blinkled.inc50
-rw-r--r--config/blinkled/blinkled.xml75
-rwxr-xr-xpkg_config.7.xml11
-rwxr-xr-xpkg_config.8.xml11
5 files changed, 147 insertions, 0 deletions
diff --git a/config/blinkled/binaries/blinkled b/config/blinkled/binaries/blinkled
new file mode 100644
index 00000000..2a8681a5
--- /dev/null
+++ b/config/blinkled/binaries/blinkled
Binary files differ
diff --git a/config/blinkled/blinkled.inc b/config/blinkled/blinkled.inc
new file mode 100644
index 00000000..25403232
--- /dev/null
+++ b/config/blinkled/blinkled.inc
@@ -0,0 +1,50 @@
+<?php
+require_once("config.inc");
+require_once("functions.inc");
+
+function blinkled_running () {
+ return ((int)exec('pgrep blinkled | wc -l') > 0);
+}
+
+function sync_package_blinkled() {
+ global $config;
+ $blinkled_config = $config['installedpackages']['blinkled']['config'][0];
+ /* kill all instances of blinkled */
+ if(blinkled_running()) {
+ blinkled_stop();
+ }
+ /* if blinkled not running start it */
+ if(!blinkled_running()) {
+ blinkled_start();
+ }
+}
+
+function blinkled_launch($int, $led) {
+ mwexec("/usr/local/bin/blinkled -i " . escapeshellarg($int) . " -l /dev/led/led" . escapeshellarg($led));
+}
+
+function blinkled_start() {
+ global $config;
+ $blinkled_config = $config['installedpackages']['blinkled']['config'][0];
+ if (!($blinkled_config['enable']))
+ return;
+
+ if (($blinkled_config['enable_led2']) && ($blinkled_config['iface_led2']))
+ blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led2']), 2);
+ if (($blinkled_config['enable_led3']) && ($blinkled_config['iface_led3']))
+ blinkled_launch(convert_friendly_interface_to_real_interface_name($blinkled_config['iface_led3']), 3);
+}
+
+function blinkled_stop() {
+ mwexec("/usr/bin/killall -9 blinkled");
+}
+
+function validate_form_blinkled($post, $input_errors) {
+ /* Make sure both aren't using the same interface */
+ if (($post['iface_led2']) && ($post['iface_led3']) &&
+ (($post['enable_led2']) && ($post['enable_led3'])) &&
+ ($post['iface_led2'] == $post['iface_led3']))
+ $input_errors[] = 'You cannot set two LEDs for a single interface. Please choose seperate interfaces.';
+}
+
+?>
diff --git a/config/blinkled/blinkled.xml b/config/blinkled/blinkled.xml
new file mode 100644
index 00000000..6fb474bb
--- /dev/null
+++ b/config/blinkled/blinkled.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<packagegui>
+ <title>Interfaces: Assign LEDs</title>
+ <name>blinkled</name>
+ <version>20090710</version>
+ <savetext>Save</savetext>
+ <include_file>/usr/local/pkg/blinkled.inc</include_file>
+ <menu>
+ <name>Assign LEDs</name>
+ <tooltiptext>Assign LEDs to indicate network activity.</tooltiptext>
+ <section>Interfaces</section>
+ <url>/pkg_edit.php?xml=blinkled.xml;id=0</url>
+ </menu>
+ <additional_files_needed>
+ <item>http://www.pfsense.org/packages/config/blinkled/blinkled.inc</item>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/bin/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/blinkled/binaries/blinkled</item>
+ </additional_files_needed>
+ <service>
+ <name>blinkled</name>
+ <rcfile>blinkled.sh</rcfile>
+ <executable>blinkled</executable>
+ </service>
+ <tabs>
+ <tab>
+ <text>Assign LEDs</text>
+ <url>/pkg_edit.php?xml=miniupnpd.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <fielddescr>Enable blinkled</fielddescr>
+ <fieldname>enable</fieldname>
+ <type>checkbox</type>
+ <enablefields>enable_led2,enable_led3,iface_led2,iface_led3</enablefields>
+ <description>if this is enabled, it will use LED #2 and #3 to
+ indicate network activity. Be aware, however, that this will
+ possibly consume some system resources in the process.</description>
+ </field>
+ <field>
+ <fielddescr>Enable LED #2</fielddescr>
+ <fieldname>enable_led2</fieldname>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Interface For LED #2</fielddescr>
+ <fieldname>iface_led2</fieldname>
+ <type>interfaces_selection</type>
+ <description>Pick an interface to blink for activity on LED #2</description>
+ </field>
+ <field>
+ <fielddescr>Enable LED #3</fielddescr>
+ <fieldname>enable_led3</fieldname>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Interface For LED #3</fielddescr>
+ <fieldname>iface_led3</fieldname>
+ <type>interfaces_selection</type>
+ <description>Pick an interface to blink for activity on LED #3</description>
+ </field>
+ </fields>
+ <custom_php_validation_command>
+ validate_form_blinkled($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
+ <custom_php_resync_config_command>
+ sync_package_blinkled();
+ </custom_php_resync_config_command>
+</packagegui>
diff --git a/pkg_config.7.xml b/pkg_config.7.xml
index e77c92cf..3a11b984 100755
--- a/pkg_config.7.xml
+++ b/pkg_config.7.xml
@@ -779,5 +779,16 @@
<config_file>http://www.pfsense.org/packages/config/rate/rate.xml</config_file>
<configurationfile>rate.xml</configurationfile>
</package>
+ <package>
+ <name>blinkled</name>
+ <descr>Allows you to use LEDs for network activity on supported platforms (ALIX, WRAP, Soekris, etc)</descr>
+ <category>System</category>
+ <version>0.0.0.0.0.1</version>
+ <status>So Alpha it's Omega</status>
+ <maintainer>jimp@pfsense.org</maintainer>
+ <required_version>1.2.3</required_version>
+ <config_file>http://www.pfsense.org/packages/config/blinkled/blinkled.xml</config_file>
+ <configurationfile>blinkled.xml</configurationfile>
+ </package>
</packages>
</pfsensepkgs>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 57b91599..e53b9f01 100755
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -710,5 +710,16 @@
<config_file>http://www.pfsense.org/packages/config/rate/rate.xml</config_file>
<configurationfile>rate.xml</configurationfile>
</package>
+ <package>
+ <name>blinkled</name>
+ <descr>Allows you to use LEDs for network activity on supported platforms (ALIX, WRAP, Soekris, etc)</descr>
+ <category>System</category>
+ <version>0.0.0.0.0.1</version>
+ <status>So Alpha it's Omega</status>
+ <maintainer>jimp@pfsense.org</maintainer>
+ <required_version>1.2.3</required_version>
+ <config_file>http://www.pfsense.org/packages/config/blinkled/blinkled.xml</config_file>
+ <configurationfile>blinkled.xml</configurationfile>
+ </package>
</packages>
</pfsensepkgs>