diff options
author | jim-p <jpingle@gmail.com> | 2009-12-28 23:47:48 -0500 |
---|---|---|
committer | jim-p <jpingle@gmail.com> | 2009-12-28 23:47:48 -0500 |
commit | 505ae49e171a2a76dd723cabc1fa72cd2dd58a4e (patch) | |
tree | e21d5ed252e8caa358ca91bc4cc6545ad0160500 /config/blinkled8/blinkled.inc | |
parent | 203fc63f805d10cb64185de78e2f6e0fd317d5c9 (diff) | |
download | pfsense-packages-505ae49e171a2a76dd723cabc1fa72cd2dd58a4e.tar.gz pfsense-packages-505ae49e171a2a76dd723cabc1fa72cd2dd58a4e.tar.bz2 pfsense-packages-505ae49e171a2a76dd723cabc1fa72cd2dd58a4e.zip |
Move blinkled to blinkled8 for pfSense 2.0. Recompiled binary for FreeBSD 8, altered .inc and XML to hopefully alleviate a small bug, version bump also.
Diffstat (limited to 'config/blinkled8/blinkled.inc')
-rw-r--r-- | config/blinkled8/blinkled.inc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/config/blinkled8/blinkled.inc b/config/blinkled8/blinkled.inc new file mode 100644 index 00000000..d50cc022 --- /dev/null +++ b/config/blinkled8/blinkled.inc @@ -0,0 +1,49 @@ +<?php +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.'; +} + +?> |