aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim P <jim@pingle.org>2012-01-05 13:13:59 -0800
committerJim P <jim@pingle.org>2012-01-05 13:13:59 -0800
commit6714580c68465f7dcb21dcc6057db0b6b381ad8c (patch)
tree32f5a7fe0650fb4bbecd615762fd714c0be32799
parent3bd8b80e8c141174f62e93a8d7096d6bb96d4871 (diff)
parent5d2ce5c42a53b762ce5bad5a2ba86a1c45d39fa2 (diff)
downloadpfsense-packages-6714580c68465f7dcb21dcc6057db0b6b381ad8c.tar.gz
pfsense-packages-6714580c68465f7dcb21dcc6057db0b6b381ad8c.tar.bz2
pfsense-packages-6714580c68465f7dcb21dcc6057db0b6b381ad8c.zip
Merge pull request #178 from mdima/master
Many improvements/tweaks.
-rw-r--r--config/lcdproc-dev/lcdproc.inc160
-rw-r--r--config/lcdproc-dev/lcdproc.xml224
-rw-r--r--config/lcdproc-dev/lcdproc_screens.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
5 files changed, 336 insertions, 54 deletions
diff --git a/config/lcdproc-dev/lcdproc.inc b/config/lcdproc-dev/lcdproc.inc
index 5733b7aa..cf2e6e12 100644
--- a/config/lcdproc-dev/lcdproc.inc
+++ b/config/lcdproc-dev/lcdproc.inc
@@ -74,9 +74,18 @@
case "none":
continue;
break;
+ case "com1":
+ continue;
+ break;
case "com2":
continue;
break;
+ case "com1a":
+ continue;
+ break;
+ case "com2a":
+ continue;
+ break;
case "ucom1":
continue;
break;
@@ -137,6 +146,34 @@
break;
}
}
+ if($post['port_speed']) {
+ switch($post['port_speed']) {
+ case "0":
+ continue;
+ break;
+ case "1200":
+ continue;
+ break;
+ case "2400":
+ continue;
+ break;
+ case "9600":
+ continue;
+ break;
+ case "19200":
+ continue;
+ break;
+ case "57600":
+ continue;
+ break;
+ case "115200":
+ continue;
+ break;
+ default:
+ $input_errors[] = "The chosen port speed is not valid";
+ break;
+ }
+ }
}
function validate_form_lcdproc_screens($post, $input_errors) {
// No validation required ?!
@@ -155,9 +192,18 @@
/* since config is written before this file invoked we don't need to read post data */
if($lcdproc_config['enable'] && ($lcdproc_config['comport'] != "none")) {
switch($lcdproc_config['comport']) {
+ case "com1":
+ $realport = "/dev/cua0";
+ break;
case "com2":
$realport = "/dev/cua1";
break;
+ case "com1a":
+ $realport = "/dev/cuau0";
+ break;
+ case "com2a":
+ $realport = "/dev/cuau1";
+ break;
case "ucom1":
$realport = "/dev/cuaU0";
break;
@@ -211,16 +257,14 @@
case "bayrad":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Speed=9600\n";
break;
case "CFontz":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Contrast=350\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=50\n";
- $config_text .= "Speed=9600\n";
+ $config_text .= set_lcd_value("contrast", 1000, 350);
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 50);
$config_text .= "NewFirmware=no\n";
$config_text .= "Reboot=no\n";
break;
@@ -228,10 +272,9 @@
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Contrast=350\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=50\n";
- $config_text .= "Speed=19200\n";
+ $config_text .= set_lcd_value("contrast", 1000, 350);
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 50);
$config_text .= "NewFirmware=yes\n";
$config_text .= "Reboot=yes\n";
break;
@@ -240,10 +283,9 @@
$config_text .= "Device={$realport}\n";
$config_text .= "Model=635\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Contrast=350\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=50\n";
- $config_text .= "Speed=115200\n";
+ $config_text .= set_lcd_value("contrast", 1000, 350);
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 50);
$config_text .= "NewFirmware=yes\n";
$config_text .= "Reboot=yes\n";
break;
@@ -262,26 +304,23 @@
$config_text .= "Model=12232\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Speed=19200\n";
$config_text .= "Reboot=no\n";
break;
case "ea65":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "OffBrightness=0\n";
- $config_text .= "Brightness=500\n";
+ $config_text .= set_lcd_value("brightness", 1000, 500);
break;
case "EyeboxOne":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Backlight=yes\n";
- $config_text .= "Speed=19200\n";
break;
case "glk":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Contrast=560\n";
- $config_text .= "Speed=19200\n";
+ $config_text .= set_lcd_value("contrast", 1000, 350);
break;
case "hd44780":
$config_text .= "[{$lcdproc_config['driver']}]\n";
@@ -289,9 +328,9 @@
$config_text .= "ConnectionType=lcd2usb\n";
$config_text .= "Speed=0\n";
$config_text .= "Keypad=no\n";
- $config_text .= "Contrast=850\n";
- $config_text .= "Brightness=800\n";
- $config_text .= "OffBrightness=0\n";
+ $config_text .= set_lcd_value("contrast", 1000, 850);
+ $config_text .= set_lcd_value("brightness", 1000, 800);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
$config_text .= "Backlight=yes\n";
$config_text .= "OutputPort=no\n";
$config_text .= "Charmap=hd44780_default\n";
@@ -302,12 +341,11 @@
case "hd44780 fast":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "ConnectionType=lcd2usb\n";
- $config_text .= "Speed=19200\n";
$config_text .= "Charmap=hd44780_default\n";
$config_text .= "Keypad=yes\n";
- $config_text .= "Contrast=850\n";
- $config_text .= "Brightness=800\n";
- $config_text .= "OffBrightness=0\n";
+ $config_text .= set_lcd_value("contrast", 1000, 850);
+ $config_text .= set_lcd_value("brightness", 1000, 800);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
$config_text .= "Backlight=yes\n";
$config_text .= "OutputPort=no\n";
$config_text .= "DelayMult=1\n";
@@ -325,8 +363,7 @@
case "lb216":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Brightness=255\n";
- $config_text .= "Speed=9600\n";
+ $config_text .= set_lcd_value("brightness", 255, 255);
$config_text .= "Reboot=no\n";
break;
case "lcdm001":
@@ -342,32 +379,30 @@
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=0\n";
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
break;
case "ms6931":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Brightness=255\n";
$config_text .= "Reboot=no\n";
break;
case "mtc_s16209x":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Brightness=255\n";
+ $config_text .= set_lcd_value("brightness", 255, 255);
$config_text .= "Reboot=no\n";
break;
case "MtxOrb":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Contrast=480\n";
$config_text .= "Type=lcd\n";
$config_text .= "hasAdjustableBacklight=yes\n";
$config_text .= "Reboot=no\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=0\n";
- $config_text .= "Speed=19200\n";
+ $config_text .= set_lcd_value("contrast", 1000, 480);
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
break;
case "nexcom":
$config_text .= "[{$lcdproc_config['driver']}]\n";
@@ -379,9 +414,8 @@
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=0\n";
- $config_text .= "Speed=9600\n";
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
$config_text .= "Parity=0\n";
$config_text .= "Reboot=no\n";
break;
@@ -391,9 +425,10 @@
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
$config_text .= "KeyTimeout=500\n";
- $config_text .= "Brightness=1000\n";
+ $config_text .= set_lcd_value("contrast", 1000, 1000);
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
$config_text .= "Blacklight_Timer=60\n";
- $config_text .= "Contrast=1000\n";
$config_text .= "Keylights=on\n";
$config_text .= "Key0Light=on\n";
$config_text .= "Key1Light=off\n";
@@ -418,7 +453,6 @@
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
$config_text .= "Type=AEDEX\n";
- $config_text .= "Speed=9600\n";
break;
case "serialVFD":
$config_text .= "[{$lcdproc_config['driver']}]\n";
@@ -426,9 +460,8 @@
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
$config_text .= "Type=0\n"; //Just the first
- $config_text .= "Brightness=1000\n";
- $config_text .= "OffBrightness=0\n";
- $config_text .= "Speed=9600\n";
+ $config_text .= set_lcd_value("brightness", 1000, 1000);
+ $config_text .= set_lcd_value("offbrightness", 1000, 0);
$config_text .= "ISO_8859_1=yes\n";
break;
case "shuttleVFD":
@@ -439,20 +472,23 @@
$config_text .= "driverpath =/usr/local/lib/lcdproc/\n";
$config_text .= "Device={$realport}\n";
$config_text .= "Size={$lcdproc_config['size']}\n";
- $config_text .= "Edition=2\n";
- $config_text .= "Contrast=200\n";
- $config_text .= "Brightness=480\n";
- $config_text .= "Speed=19200\n";
+ $config_text .= "Edition=2\n";
+ $config_text .= set_lcd_value("contrast", 1000, 200);
+ $config_text .= set_lcd_value("brightness", 1000, 480);
break;
case "sli":
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "Device={$realport}\n";
- $config_text .= "Speed=9600\n";
break;
default:
lcdproc_warn("The chosen lcdproc driver is not a valid choice");
unset($lcdproc_config[driver]);
}
+ /* Port speed */
+ if ($lcdproc_config[port_speed] <> '' && $lcdproc_config[port_speed] <> '0') {
+ $port_speed = $lcdproc_config[port_speed];
+ $config_text .= "Speed={$port_speed}\n";
+ }
/* generate rc file start and stop */
$client_script = <<<EOD
#!/bin/sh
@@ -515,4 +551,30 @@ EOD;
config_unlock();
lcdproc_notice("Sync: End package sync");
}
+ function set_lcd_value($fieldname, $max, $default_value) {
+ global $config;
+ $lcdproc_config = $config['installedpackages']['lcdproc']['config'][0];
+ $value = $lcdproc_config[$fieldname];
+ $returnvalue = "";
+ if ($value != '' && $value != '-1') {
+ $realvalue = (int)($max * $value / 100);
+ }
+ else
+ {
+ $realvalue = $default_value;
+ }
+ switch ($fieldname)
+ {
+ case "brightness":
+ $returnvalue = "Brightness={$realvalue}\n";
+ break;
+ case "offbrightness":
+ $returnvalue = "OffBrightness={$realvalue}\n";
+ break;
+ case "contrast":
+ $returnvalue = "Contrast={$realvalue}\n";
+ break;
+ }
+ return $returnvalue;
+ }
?> \ No newline at end of file
diff --git a/config/lcdproc-dev/lcdproc.xml b/config/lcdproc-dev/lcdproc.xml
index 826ee86f..d31c9a6d 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.4 pkg v. 0.4</title>
+ <title>Services: LCDproc 0.5.4 pkg v. 0.5</title>
<name>lcdproc</name>
- <version>0.5.4 pkg v. 0.4</version>
+ <version>0.5.4 pkg v. 0.5</version>
<savetext>Save</savetext>
<include_file>/usr/local/pkg/lcdproc.inc</include_file>
<tabs>
@@ -65,10 +65,22 @@
<name>none</name>
</option>
<option>
+ <value>com1</value>
+ <name>Serial Com port 1 (/dev/cua0)</name>
+ </option>
+ <option>
<value>com2</value>
<name>Serial Com port 2 (/dev/cua1)</name>
</option>
<option>
+ <value>com1a</value>
+ <name>Serial Com port 1 alternate (/dev/cuau0)</name>
+ </option>
+ <option>
+ <value>com2a</value>
+ <name>Serial Com port 2 alternate (/dev/cuau1)</name>
+ </option>
+ <option>
<value>ucom1</value>
<name>USB Com port 1 (/dev/cuaU0)</name>
</option>
@@ -317,6 +329,214 @@
</option>
</options>
<default_value>5</default_value>
+ </field>
+ <field>
+ <fieldname>port_speed</fieldname>
+ <fielddescr>Port speed</fielddescr>
+ <description>Set the port speed. Caution: not all the driver or panels support all the speeds, leave "default" if unsure.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <value>0</value>
+ <name>Default</name>
+ </option>
+ <option>
+ <value>1200</value>
+ <name>1200 bps</name>
+ </option>
+ <option>
+ <value>2400</value>
+ <name>2400 bps</name>
+ </option>
+ <option>
+ <value>9600</value>
+ <name>9600 bps</name>
+ </option>
+ <option>
+ <value>19200</value>
+ <name>19200 bps</name>
+ </option>
+ <option>
+ <value>57600</value>
+ <name>57600 bps</name>
+ </option>
+ <option>
+ <value>115200</value>
+ <name>115200 bps</name>
+ </option>
+ </options>
+ <default_value>0</default_value>
+ </field>
+ <field>
+ <fieldname>brightness</fieldname>
+ <fielddescr>Brightness</fielddescr>
+ <description>Set the brightness of the LCD panel. This option is not supported by all the LCD panels, leave "default" if unsure.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <value>-1</value>
+ <name>Default</name>
+ </option>
+ <option>
+ <value>0</value>
+ <name>0%</name>
+ </option>
+ <option>
+ <value>10</value>
+ <name>10%</name>
+ </option>
+ <option>
+ <value>20</value>
+ <name>20%</name>
+ </option>
+ <option>
+ <value>30</value>
+ <name>30%</name>
+ </option>
+ <option>
+ <value>40</value>
+ <name>40%</name>
+ </option>
+ <option>
+ <value>50</value>
+ <name>50%</name>
+ </option>
+ <option>
+ <value>60</value>
+ <name>60%</name>
+ </option>
+ <option>
+ <value>70</value>
+ <name>70%</name>
+ </option>
+ <option>
+ <value>80</value>
+ <name>80%</name>
+ </option>
+ <option>
+ <value>90</value>
+ <name>90%</name>
+ </option>
+ <option>
+ <value>100</value>
+ <name>100%</name>
+ </option>
+ </options>
+ <default_value>-1</default_value>
+ </field>
+ <field>
+ <fieldname>offbrightness</fieldname>
+ <fielddescr>Offrightness</fielddescr>
+ <description>Set the off-brightness of the LCD panel. This value is used when the display is normally switched off in case LCDd is inactive. This option is not supported by all the LCD panels, leave "default" if unsure.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <value>-1</value>
+ <name>Default</name>
+ </option>
+ <option>
+ <value>0</value>
+ <name>0%</name>
+ </option>
+ <option>
+ <value>10</value>
+ <name>10%</name>
+ </option>
+ <option>
+ <value>20</value>
+ <name>20%</name>
+ </option>
+ <option>
+ <value>30</value>
+ <name>30%</name>
+ </option>
+ <option>
+ <value>40</value>
+ <name>40%</name>
+ </option>
+ <option>
+ <value>50</value>
+ <name>50%</name>
+ </option>
+ <option>
+ <value>60</value>
+ <name>60%</name>
+ </option>
+ <option>
+ <value>70</value>
+ <name>70%</name>
+ </option>
+ <option>
+ <value>80</value>
+ <name>80%</name>
+ </option>
+ <option>
+ <value>90</value>
+ <name>90%</name>
+ </option>
+ <option>
+ <value>100</value>
+ <name>100%</name>
+ </option>
+ </options>
+ <default_value>-1</default_value>
+ </field>
+ <field>
+ <fieldname>contrast</fieldname>
+ <fielddescr>Contrast</fielddescr>
+ <description>Set the contrast of the LCD panel. This option is not supported by all the LCD panels, leave "default" if unsure.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <value>-1</value>
+ <name>Default</name>
+ </option>
+ <option>
+ <value>0</value>
+ <name>0%</name>
+ </option>
+ <option>
+ <value>10</value>
+ <name>10%</name>
+ </option>
+ <option>
+ <value>20</value>
+ <name>20%</name>
+ </option>
+ <option>
+ <value>30</value>
+ <name>30%</name>
+ </option>
+ <option>
+ <value>40</value>
+ <name>40%</name>
+ </option>
+ <option>
+ <value>50</value>
+ <name>50%</name>
+ </option>
+ <option>
+ <value>60</value>
+ <name>60%</name>
+ </option>
+ <option>
+ <value>70</value>
+ <name>70%</name>
+ </option>
+ <option>
+ <value>80</value>
+ <name>80%</name>
+ </option>
+ <option>
+ <value>90</value>
+ <name>90%</name>
+ </option>
+ <option>
+ <value>100</value>
+ <name>100%</name>
+ </option>
+ </options>
+ <default_value>-1</default_value>
</field>
</fields>
<custom_php_command_before_form>
diff --git a/config/lcdproc-dev/lcdproc_screens.xml b/config/lcdproc-dev/lcdproc_screens.xml
index 7dee9a9f..1d2318fd 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.4 pkg v. 0.4</version>
+ <version>0.5.4 pkg v. 0.5</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 bcb7d0e4..a2435a3d 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1022,7 +1022,7 @@
<descr>LCD display driver - Development version</descr>
<website>http://www.lcdproc.org/</website>
<category>Utility</category>
- <version>lcdproc-0.5.4 pkg v. 0.4</version>
+ <version>lcdproc-0.5.4 pkg v. 0.5</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 b6d18cc6..2b6e0231 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -993,7 +993,7 @@
<descr>LCD display driver - Development version</descr>
<website>http://www.lcdproc.org/</website>
<category>Utility</category>
- <version>lcdproc-0.5.4 pkg v. 0.4</version>
+ <version>lcdproc-0.5.4 pkg v. 0.5</version>
<status>BETA</status>
<required_version>2.0</required_version>
<maintainer>michele@nt2.it</maintainer>