From f3975a977bc50b3040193db7eb9277924dd3326a Mon Sep 17 00:00:00 2001 From: Michele Di Maria Date: Thu, 5 Jan 2012 21:02:05 +0100 Subject: Many improvements/tweaks. - Added in the com port selection: com1 (dev/cua0), com1 and com2 alternative (dev/cuau0 and dev/cuau1) - Added com port speed selection (hope users won't make a mess) - Added Contrast/Brightness/Offbrightness selection. If the setting from the user do not match the possibility of the driver the setting is just ignored. --- config/lcdproc-dev/lcdproc.inc | 160 +++++++++++++++-------- config/lcdproc-dev/lcdproc.xml | 224 ++++++++++++++++++++++++++++++++- config/lcdproc-dev/lcdproc_screens.xml | 2 +- 3 files changed, 334 insertions(+), 52 deletions(-) (limited to 'config/lcdproc-dev') 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 = << \ 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 @@ - Services: LCDproc 0.5.4 pkg v. 0.4 + Services: LCDproc 0.5.4 pkg v. 0.5 lcdproc - 0.5.4 pkg v. 0.4 + 0.5.4 pkg v. 0.5 Save /usr/local/pkg/lcdproc.inc @@ -64,10 +64,22 @@ none none + + + 5 + + + port_speed + Port speed + Set the port speed. Caution: not all the driver or panels support all the speeds, leave "default" if unsure. + select + + + + + + + + + + 0 + + + brightness + Brightness + Set the brightness of the LCD panel. This option is not supported by all the LCD panels, leave "default" if unsure. + select + + + + + + + + + + + + + + + -1 + + + offbrightness + Offrightness + 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. + select + + + + + + + + + + + + + + + -1 + + + contrast + Contrast + Set the contrast of the LCD panel. This option is not supported by all the LCD panels, leave "default" if unsure. + select + + + + + + + + + + + + + + + -1 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 @@ Services: LCDproc: Screens lcdproc_screens - 0.5.4 pkg v. 0.4 + 0.5.4 pkg v. 0.5 Save /usr/local/pkg/lcdproc.inc -- cgit v1.2.3