aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/lcdproc-dev/lcdproc.inc12
-rw-r--r--config/lcdproc-dev/lcdproc.xml4
-rw-r--r--config/lcdproc-dev/lcdproc_client.php39
-rw-r--r--config/lcdproc-dev/lcdproc_screens.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
6 files changed, 38 insertions, 23 deletions
diff --git a/config/lcdproc-dev/lcdproc.inc b/config/lcdproc-dev/lcdproc.inc
index 3d0a7e69..7617e168 100644
--- a/config/lcdproc-dev/lcdproc.inc
+++ b/config/lcdproc-dev/lcdproc.inc
@@ -237,7 +237,7 @@
$config_text .= "User=nobody\n";
$config_text .= "ServerScreen=no\n";
$config_text .= "Foreground=no\n";
- $config_text .= "TitleSpeed=10\n";
+ $config_text .= "TitleSpeed=5\n";
$config_text .= "DriverPath=/usr/local/lib/lcdproc/\n";
$config_text .= "GoodBye=\"Thanks for using\"\n";
$config_text .= "GoodBye=\" {$g['product_name']} \"\n";
@@ -502,14 +502,8 @@
/* generate rc file start and stop */
$client_script = <<<EOD
#!/bin/sh
-# script starts a lcd client and always keeps it active for 3 attemps
-counter=1
-while [ \$counter -le 3 ]
-do
- # loop the client to drive the display
- /usr/local/bin/php -f /usr/local/pkg/lcdproc_client.php
- counter=\$(( \$counter + 1 ))
- sleep 1
+/usr/local/bin/php -f /usr/local/pkg/lcdproc_client.php
+sleep 1
done
EOD;
/* generate rc file start and stop */
diff --git a/config/lcdproc-dev/lcdproc.xml b/config/lcdproc-dev/lcdproc.xml
index 51a80f72..0ef98694 100644
--- a/config/lcdproc-dev/lcdproc.xml
+++ b/config/lcdproc-dev/lcdproc.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
- <title>Services: LCDproc 0.5.5 pkg v. 0.9</title>
+ <title>Services: LCDproc 0.5.5 pkg v. 0.9.1</title>
<name>lcdproc</name>
- <version>0.5.5 pkg v. 0.9</version>
+ <version>0.5.5 pkg v. 0.9.1</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/lcdproc.inc</include_file>
<tabs>
diff --git a/config/lcdproc-dev/lcdproc_client.php b/config/lcdproc-dev/lcdproc_client.php
index d931b9d0..36bf63fe 100644
--- a/config/lcdproc-dev/lcdproc_client.php
+++ b/config/lcdproc-dev/lcdproc_client.php
@@ -399,6 +399,7 @@
/* Define functions */
function send_lcd_commands($lcd, $lcd_cmds) {
+ global $lcdproc_connect_errors;
if(!is_array($lcd_cmds) || (empty($lcd_cmds))) {
lcdproc_warn("Failed to interpret lcd commands");
return;
@@ -407,13 +408,16 @@
$cmd_output = "";
if(! fwrite($lcd, "$lcd_cmd\n")) {
lcdproc_warn("Connection to LCDd process lost $errstr ($errno)");
- die();
+ $lcdproc_connect_errors++;
+ return;
}
+ usleep(20); // waits 20ms
$cmd_output = fgets($lcd, 256);
// FIXME: add support for interpreting menu commands here.
if(preg_match("/^huh?/", $cmd_output)) {
lcdproc_notice("LCDd output: \"$cmd_output\". Executed \"$lcd_cmd\"");
}
+ $lcdproc_connect_errors = 0; // Reset the error counter
}
}
@@ -722,6 +726,7 @@
function loop_status($lcd) {
global $g;
global $config;
+ global $lcdproc_connect_errors;
$lcdproc_screens_config = $config['installedpackages']['lcdprocscreens']['config'][0];
$lcdpanel_width = get_lcdpanel_width();
$lcdpanel_height = get_lcdpanel_height();
@@ -874,7 +879,12 @@
add_summary_values($lcd_cmds, $name, $lcd_summary_data, $lcdpanel_width);
}
}
+ $temp_lcdproc_connect_errors = $lcdproc_connect_errors;
send_lcd_commands($lcd, $lcd_cmds);
+ if ($temp_lcdproc_connect_errors != $lcdproc_connect_errors)
+ { //an error occurred
+ return;
+ }
sleep($refresh_frequency * $widget_counter);
$i++;
}
@@ -883,14 +893,25 @@
$traffic_last_ugmt = 0;
$traffic_last_ifin = 0;
$traffic_last_ifout = 0;
+ /* Initialize the global error counter */
+ $lcdproc_connect_errors = 0;
+ $lcdproc_max_connect_errors = 2;
/* Connect to the LCDd port and interface with the LCD */
- $lcd = fsockopen(LCDPROC_HOST, LCDPROC_PORT, $errno, $errstr, 10);
- if (!$lcd) {
- lcdproc_warn("Failed to connect to LCDd process $errstr ($errno)");
- } else {
- build_interface($lcd);
- loop_status($lcd);
- /* loop exited? Close fd and wait for the script to kick in again */
- fclose($lcd);
+ while ($lcdproc_connect_errors <= $lcdproc_max_connect_errors)
+ {
+ lcdproc_warn("Start client procedure. Error counter: ($lcdproc_connect_errors)");
+ $lcd = fsockopen(LCDPROC_HOST, LCDPROC_PORT, $errno, $errstr, 10);
+ if (!$lcd) {
+ lcdproc_warn("Failed to connect to LCDd process $errstr ($errno)");
+ $lcdproc_connect_errors++;
+ } else {
+ build_interface($lcd);
+ loop_status($lcd);
+ fclose($lcd);
+ }
+ }
+ if ($lcdproc_connect_errors >= $lcdproc_max_connect_errors)
+ {
+ lcdproc_warn("Too many errors, the client ends.");
}
?> \ No newline at end of file
diff --git a/config/lcdproc-dev/lcdproc_screens.xml b/config/lcdproc-dev/lcdproc_screens.xml
index b49018e3..3dfe4b75 100644
--- a/config/lcdproc-dev/lcdproc_screens.xml
+++ b/config/lcdproc-dev/lcdproc_screens.xml
@@ -2,7 +2,7 @@
<packagegui>
<title>Services: LCDproc: Screens</title>
<name>lcdproc_screens</name>
- <version>0.5.5 pkg v. 0.9</version>
+ <version>0.5.5 pkg v. 0.9.1</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/lcdproc.inc</include_file>
<tabs>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index e61c6e5d..4597463e 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1023,7 +1023,7 @@
<descr>LCD display driver - Development version</descr>
<website>http://www.lcdproc.org/</website>
<category>Utility</category>
- <version>lcdproc-0.5.5 pkg v. 0.9</version>
+ <version>lcdproc-0.5.5 pkg v. 0.9.1</version>
<status>BETA</status>
<required_version>2.0</required_version>
<maintainer>michele@nt2.it</maintainer>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index cda307dc..9dfcee33 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -989,7 +989,7 @@
<descr>LCD display driver - Development version</descr>
<website>http://www.lcdproc.org/</website>
<category>Utility</category>
- <version>lcdproc-0.5.5 pkg v. 0.9</version>
+ <version>lcdproc-0.5.5 pkg v. 0.9.1</version>
<status>BETA</status>
<required_version>2.0</required_version>
<maintainer>michele@nt2.it</maintainer>