Applied patches supplied by Andre' Breiler:
- bugfixes for display != MatrixOrb LCD
- changes the meaning of output_state
+ it's now a bitfield where evry bit corresponds to
one output
- protocol change
output on|off|value
where on = all outputs on
off = all outputs off
value = output on for all 1 bits
- changes the behavior for key presses
Keypresses are now deliverd to _all_ clients (not only
the one with the active screen)
reason: I have an client which is only active a few seconds after
an keypress
- changes the protocol so that a response is sent for every
command
reason: the client needs to communicate with the server with a
minimal latency
This commit is contained in:
@@ -49,6 +49,7 @@ while(1)
|
|||||||
@lines = split(/\n/, $input);
|
@lines = split(/\n/, $input);
|
||||||
foreach $line (@lines)
|
foreach $line (@lines)
|
||||||
{
|
{
|
||||||
|
if ( $line =~ /^success$/ ) next;
|
||||||
if($line =~ /^ignore (\S)/) # Update just after disappearing
|
if($line =~ /^ignore (\S)/) # Update just after disappearing
|
||||||
{
|
{
|
||||||
&update_text();
|
&update_text();
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ while(1)
|
|||||||
#print "Main loop...\n";
|
#print "Main loop...\n";
|
||||||
# Handle input... (just spew it to the console)
|
# Handle input... (just spew it to the console)
|
||||||
while(defined($line = <$remote>)) {
|
while(defined($line = <$remote>)) {
|
||||||
|
if ( $line =~ /^success$/ ) next;
|
||||||
print $line;
|
print $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ while(1)
|
|||||||
# Handle input... (spew it to the console)
|
# Handle input... (spew it to the console)
|
||||||
# Also, certain keys scroll the display
|
# Also, certain keys scroll the display
|
||||||
while(defined($input = <$remote>)) {
|
while(defined($input = <$remote>)) {
|
||||||
|
if ( $input =~ /^success$/ ) next;
|
||||||
print $input;
|
print $input;
|
||||||
|
|
||||||
$slow = -10;
|
$slow = -10;
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ while(1)
|
|||||||
elsif($command eq "ignore")
|
elsif($command eq "ignore")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
elsif($command eq "success")
|
||||||
|
{
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if($line =~ /\S/) {print "Huh? $line\n";}
|
if($line =~ /\S/) {print "Huh? $line\n";}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ main_loop (mode * sequence)
|
|||||||
} else if (0 == strcmp (argv[0], "bye")) {
|
} else if (0 == strcmp (argv[0], "bye")) {
|
||||||
//printf("Exiting LCDproc\n");
|
//printf("Exiting LCDproc\n");
|
||||||
exit_program (0);
|
exit_program (0);
|
||||||
|
} else if (0 == strcmp (argv[0], "success")) {
|
||||||
} else {
|
} else {
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < argc; j++)
|
for (j = 0; j < argc; j++)
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ while (1==1) {
|
|||||||
# print "The wind blows to $wind_dir_eng, speed $wind_mph mph\n";
|
# print "The wind blows to $wind_dir_eng, speed $wind_mph mph\n";
|
||||||
|
|
||||||
} # end else
|
} # end else
|
||||||
|
# eat all input from LCDd
|
||||||
|
while(defined($input = <$remote>)) {
|
||||||
|
if ( $input =~ /^success$/ ) next;
|
||||||
|
#print $input;
|
||||||
|
}
|
||||||
print "Sleeping 15 minutes.\n";
|
print "Sleeping 15 minutes.\n";
|
||||||
sleep 900;
|
sleep 900;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "../shared/debug.h"
|
#include "../shared/debug.h"
|
||||||
#include "../shared/sockets.h"
|
#include "../shared/sockets.h"
|
||||||
@@ -116,6 +117,7 @@ client_set_func (client * c, int argc, char **argv)
|
|||||||
if (c->data->name)
|
if (c->data->name)
|
||||||
free (c->data->name);
|
free (c->data->name);
|
||||||
c->data->name = strdup (argv[i]);
|
c->data->name = strdup (argv[i]);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? name requires a parameter\n");
|
sock_send_string (c->sock, "huh? name requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -185,10 +187,14 @@ screen_add_func (client * c, int argc, char **argv)
|
|||||||
|
|
||||||
debug ("screen_add: Adding screen %s\n", argv[1]);
|
debug ("screen_add: Adding screen %s\n", argv[1]);
|
||||||
err = screen_add (c, argv[1]);
|
err = screen_add (c, argv[1]);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
fprintf (stderr, "screen_add_func: Error adding screen\n");
|
fprintf (stderr, "screen_add_func: Error adding screen\n");
|
||||||
|
sock_send_string (c->sock, "huh? failed to add screen id#\n");
|
||||||
|
}
|
||||||
if (err > 0)
|
if (err > 0)
|
||||||
sock_send_string (c->sock, "huh? You already have a screen with that id#\n");
|
sock_send_string (c->sock, "huh? You already have a screen with that id#\n");
|
||||||
|
if (err == 0)
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -215,10 +221,14 @@ screen_del_func (client * c, int argc, char **argv)
|
|||||||
|
|
||||||
debug ("screen_del: Deleting screen %s\n", argv[1]);
|
debug ("screen_del: Deleting screen %s\n", argv[1]);
|
||||||
err = screen_remove (c, argv[1]);
|
err = screen_remove (c, argv[1]);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
fprintf (stderr, "screen_del_func: Error removing screen\n");
|
fprintf (stderr, "screen_del_func: Error removing screen\n");
|
||||||
|
sock_send_string(c->sock, "huh? failed to remove screen\n");
|
||||||
|
}
|
||||||
if (err > 0)
|
if (err > 0)
|
||||||
sock_send_string (c->sock, "huh? You don't have a screen with that id#\n");
|
sock_send_string (c->sock, "huh? You don't have a screen with that id#\n");
|
||||||
|
if ( err == 0 )
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -268,6 +278,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
if (s->name)
|
if (s->name)
|
||||||
free (s->name);
|
free (s->name);
|
||||||
s->name = strdup (argv[i]);
|
s->name = strdup (argv[i]);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -name requires a parameter\n");
|
sock_send_string (c->sock, "huh? -name requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -282,6 +293,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
number = atoi (argv[i]);
|
number = atoi (argv[i]);
|
||||||
if (number > 0)
|
if (number > 0)
|
||||||
s->priority = number;
|
s->priority = number;
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -priority requires a parameter\n");
|
sock_send_string (c->sock, "huh? -priority requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -296,6 +308,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
number = atoi (argv[i]);
|
number = atoi (argv[i]);
|
||||||
if (number > 0)
|
if (number > 0)
|
||||||
s->duration = number;
|
s->duration = number;
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -duration requires a parameter\n");
|
sock_send_string (c->sock, "huh? -duration requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -321,6 +334,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
s->heartbeat = 0;
|
s->heartbeat = 0;
|
||||||
if (0 == strcmp (argv[i], "slash"))
|
if (0 == strcmp (argv[i], "slash"))
|
||||||
s->heartbeat = 2;
|
s->heartbeat = 2;
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -heartbeat requires a parameter\n");
|
sock_send_string (c->sock, "huh? -heartbeat requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -335,6 +349,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
number = atoi (argv[i]);
|
number = atoi (argv[i]);
|
||||||
if (number > 0)
|
if (number > 0)
|
||||||
s->wid = number;
|
s->wid = number;
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -wid requires a parameter\n");
|
sock_send_string (c->sock, "huh? -wid requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -349,6 +364,7 @@ screen_set_func (client * c, int argc, char **argv)
|
|||||||
number = atoi (argv[i]);
|
number = atoi (argv[i]);
|
||||||
if (number > 0)
|
if (number > 0)
|
||||||
s->hgt = number;
|
s->hgt = number;
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
} else {
|
} else {
|
||||||
sock_send_string (c->sock, "huh? -hgt requires a parameter\n");
|
sock_send_string (c->sock, "huh? -hgt requires a parameter\n");
|
||||||
}
|
}
|
||||||
@@ -419,8 +435,12 @@ widget_add_func (client * c, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
// Add the widget and set its type...
|
// Add the widget and set its type...
|
||||||
err = widget_add (s, wid, type, in, c->sock);
|
err = widget_add (s, wid, type, in, c->sock);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
fprintf (stderr, "widget_add_func: Error adding widget\n");
|
fprintf (stderr, "widget_add_func: Error adding widget\n");
|
||||||
|
sock_send_string(c->sock, "huh? failed\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -465,8 +485,12 @@ widget_del_func (client * c, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = widget_remove (s, wid, c->sock);
|
err = widget_remove (s, wid, c->sock);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
fprintf (stderr, "widget_del_func: Error removing widget\n");
|
fprintf (stderr, "widget_del_func: Error removing widget\n");
|
||||||
|
sock_send_string(c->sock, "huh? failed\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -550,6 +574,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %s\n", wid, w->text);
|
debug ("Widget %s set to %s\n", wid, w->text);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -568,6 +593,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
w->length = length;
|
w->length = length;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %i\n", wid, w->length);
|
debug ("Widget %s set to %i\n", wid, w->length);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WID_VBAR: // Vbar takes "x y length"
|
case WID_VBAR: // Vbar takes "x y length"
|
||||||
@@ -585,6 +611,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
w->length = length;
|
w->length = length;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %i\n", wid, w->length);
|
debug ("Widget %s set to %i\n", wid, w->length);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WID_ICON: // Icon takes "x y binary_data"
|
case WID_ICON: // Icon takes "x y binary_data"
|
||||||
@@ -615,6 +642,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %s\n", wid, w->text);
|
debug ("Widget %s set to %s\n", wid, w->text);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WID_SCROLLER: // Scroller takes "left top right bottom direction speed text"
|
case WID_SCROLLER: // Scroller takes "left top right bottom direction speed text"
|
||||||
@@ -650,10 +678,12 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
free (w->text);
|
free (w->text);
|
||||||
w->text = strdup (argv[i + 6]);
|
w->text = strdup (argv[i + 6]);
|
||||||
if (!w->text) {
|
if (!w->text) {
|
||||||
|
sock_send_string(c->sock, "huh? out of memory\n");
|
||||||
fprintf (stderr, "widget_set_func: Error allocating string\n");
|
fprintf (stderr, "widget_set_func: Error allocating string\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %s\n", wid, w->text);
|
debug ("Widget %s set to %s\n", wid, w->text);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -694,6 +724,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
w->length = direction;
|
w->length = direction;
|
||||||
w->speed = speed;
|
w->speed = speed;
|
||||||
debug ("Widget %s set to (%i,%i)-(%i,%i) %ix%i\n", wid, left, top, right, bottom, width, height);
|
debug ("Widget %s set to (%i,%i)-(%i,%i) %ix%i\n", wid, left, top, right, bottom, width, height);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,6 +744,7 @@ widget_set_func (client * c, int argc, char **argv)
|
|||||||
w->y = y;
|
w->y = y;
|
||||||
}
|
}
|
||||||
debug ("Widget %s set to %i\n", wid, w->y);
|
debug ("Widget %s set to %i\n", wid, w->y);
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WID_NONE:
|
case WID_NONE:
|
||||||
@@ -864,6 +896,7 @@ backlight_func (client * c, int argc, char **argv)
|
|||||||
case BACKLIGHT_VIS:
|
case BACKLIGHT_VIS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -874,16 +907,37 @@ backlight_func (client * c, int argc, char **argv)
|
|||||||
int
|
int
|
||||||
output_func (client * c, int argc, char **argv)
|
output_func (client * c, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int rc = 0;
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
sock_send_string (c->sock, "huh? Too many parameters...\n");
|
sock_send_string (c->sock, "huh? Too many parameters...\n");
|
||||||
|
rc = 1;
|
||||||
} else {
|
} else {
|
||||||
if (0 == strcmp (argv[1], "on"))
|
if (0 == strcmp (argv[1], "on"))
|
||||||
output_state = 1;
|
/* switch all ouputs on */
|
||||||
|
output_state = -1;
|
||||||
else if (0 == strcmp (argv[1], "off"))
|
else if (0 == strcmp (argv[1], "off"))
|
||||||
output_state = -1;
|
/* switch all ouputs off */
|
||||||
else
|
output_state = 0;
|
||||||
output_state = 0;
|
else {
|
||||||
|
long out;
|
||||||
|
char *endptr;
|
||||||
|
|
||||||
|
out = strtol(argv[1], &endptr, 0);
|
||||||
|
if ( (out == 0) && (errno != 0) ) {
|
||||||
|
sock_send_string (c->sock,
|
||||||
|
"huh? invalid parameter...\n");
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
output_state = out;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( rc == 0 ) {
|
||||||
|
sock_send_string(c->sock, "success\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+46
-31
@@ -14,6 +14,7 @@
|
|||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
|
|
||||||
static int custom = 0;
|
static int custom = 0;
|
||||||
|
static enum {MTXORB_LCD, MTXORB_LKD, MTXORB_VFD, MTXORB_VKD} MtxOrb_type;
|
||||||
|
|
||||||
// TODO: Remove this custom_type if not in use anymore.
|
// TODO: Remove this custom_type if not in use anymore.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -132,8 +133,26 @@ MtxOrb_init (lcd_logical_driver * driver, char *args)
|
|||||||
} else if (0 == strcmp (argv[i], "-h") || 0 == strcmp (argv[i], "--help")) {
|
} else if (0 == strcmp (argv[i], "-h") || 0 == strcmp (argv[i], "--help")) {
|
||||||
printf ("LCDproc Matrix-Orbital LCD driver\n" "\t-d\t--device\tSelect the output device to use [/dev/lcd]\n"
|
printf ("LCDproc Matrix-Orbital LCD driver\n" "\t-d\t--device\tSelect the output device to use [/dev/lcd]\n"
|
||||||
// "\t-t\t--type\t\tSelect the LCD type (size) [20x4]\n"
|
// "\t-t\t--type\t\tSelect the LCD type (size) [20x4]\n"
|
||||||
"\t-c\t--contrast\tSet the initial contrast [140]\n" "\t-s\t--speed\t\tSet the communication speed [19200]\n" "\t-h\t--help\t\tShow this help information\n");
|
"\t-c\t--contrast\tSet the initial contrast [140]\n" "\t-s\t--speed\t\tSet the communication speed [19200]\n" "\t-h\t--help\t\tShow this help information\n" "\t-t\t--type\t\tdisplay type: lcd, lkd, vfd, vkd\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if (0 == strcmp (argv[i], "-t") || 0 == strcmp (argv[i], "--type")) {
|
||||||
|
if (i + 1 > argc) {
|
||||||
|
fprintf (stderr, "MtxOrb_init: %s requires an argument\n", argv[i]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
if ( 0 == strcmp (argv[i], "lcd") ) {
|
||||||
|
MtxOrb_type = MTXORB_LCD;
|
||||||
|
} else if ( 0 == strcmp (argv[i], "lkd") ) {
|
||||||
|
MtxOrb_type = MTXORB_LKD;
|
||||||
|
} else if ( 0 == strcmp (argv[i], "vfd") ) {
|
||||||
|
MtxOrb_type = MTXORB_VFD;
|
||||||
|
} else if ( 0 == strcmp (argv[i], "vkd") ) {
|
||||||
|
MtxOrb_type = MTXORB_VKD;
|
||||||
|
} else {
|
||||||
|
fprintf (stderr, "MtxOrb_init: unknwon display type %s\n", argv[i]);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf ("Invalid parameter: %s\n", argv[i]);
|
printf ("Invalid parameter: %s\n", argv[i]);
|
||||||
}
|
}
|
||||||
@@ -268,6 +287,8 @@ MtxOrb_chr (int x, int y, char c)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Changes screen contrast (0-255; 140 seems good)
|
// Changes screen contrast (0-255; 140 seems good)
|
||||||
|
// note: works only for LCD displays
|
||||||
|
// Is it better to use the brightness for VFD/VKD displays ?
|
||||||
//
|
//
|
||||||
int
|
int
|
||||||
MtxOrb_contrast (int contrast)
|
MtxOrb_contrast (int contrast)
|
||||||
@@ -275,7 +296,8 @@ MtxOrb_contrast (int contrast)
|
|||||||
char out[4];
|
char out[4];
|
||||||
static int status = 140;
|
static int status = 140;
|
||||||
|
|
||||||
if (contrast > 0) {
|
if ( ((MtxOrb_type == MTXORB_LCD) || (MtxOrb_type == MTXORB_LKD)) &&
|
||||||
|
(contrast > 0) ) {
|
||||||
status = contrast;
|
status = contrast;
|
||||||
sprintf (out, "%cP%c", 254, status);
|
sprintf (out, "%cP%c", 254, status);
|
||||||
write (fd, out, 3);
|
write (fd, out, 3);
|
||||||
@@ -287,6 +309,8 @@ MtxOrb_contrast (int contrast)
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Sets the backlight on or off -- can be done quickly for
|
// Sets the backlight on or off -- can be done quickly for
|
||||||
// an intermediate brightness...
|
// an intermediate brightness...
|
||||||
|
// WARN: off switches vfd/vkd displays off
|
||||||
|
// -> so it's maybe the best to start LCDd with -b on
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
MtxOrb_backlight (int on)
|
MtxOrb_backlight (int on)
|
||||||
@@ -303,16 +327,30 @@ MtxOrb_backlight (int on)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Sets output port on or off
|
// Sets output port on or off
|
||||||
|
// displays with keypad have 6 outputs but the one without kepad
|
||||||
|
// have only one output
|
||||||
|
// NOTE: length of command are different
|
||||||
void
|
void
|
||||||
MtxOrb_output (int on)
|
MtxOrb_output (int on)
|
||||||
{
|
{
|
||||||
char out[4];
|
char out[5];
|
||||||
if (on > 0) {
|
if ( ((MtxOrb_type == MTXORB_LCD) || (MtxOrb_type == MTXORB_VFD)) ) {
|
||||||
sprintf (out, "%cW", 254);
|
if (on) {
|
||||||
write (fd, out, 2);
|
sprintf (out, "%cW", 254);
|
||||||
} else if (on < 0) {
|
} else {
|
||||||
sprintf (out, "%cV", 254);
|
sprintf (out, "%cV", 254);
|
||||||
|
}
|
||||||
write (fd, out, 2);
|
write (fd, out, 2);
|
||||||
|
} else {
|
||||||
|
int i;
|
||||||
|
for(i=0; i<6; i++) {
|
||||||
|
if ( on & (1 << i) ) {
|
||||||
|
sprintf (out, "%cW%c", 254, i+1);
|
||||||
|
} else {
|
||||||
|
sprintf (out, "%cW%c", 254, i+1);
|
||||||
|
}
|
||||||
|
write (fd, out, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,29 +638,6 @@ MtxOrb_getkey ()
|
|||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MtxOrb_led (int which, int on)
|
|
||||||
{
|
|
||||||
char out[4];
|
|
||||||
|
|
||||||
if (which < 0 || which > 7)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!which) {
|
|
||||||
if (on)
|
|
||||||
sprintf (out, "%cV", 254);
|
|
||||||
else
|
|
||||||
sprintf (out, "%cW", 254);
|
|
||||||
write (fd, out, 2);
|
|
||||||
} else {
|
|
||||||
if (on)
|
|
||||||
sprintf (out, "%cV%c", 254, which);
|
|
||||||
else
|
|
||||||
sprintf (out, "%cW%c", 254, which);
|
|
||||||
write (fd, out, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Ask for dynamic allocation of a custom caracter to be
|
// Ask for dynamic allocation of a custom caracter to be
|
||||||
// a well none bar graphic. The function is suppose to
|
// a well none bar graphic. The function is suppose to
|
||||||
|
|||||||
+11
-21
@@ -62,28 +62,18 @@ handle_input ()
|
|||||||
debug ("handle_input(%c)\n", (char) key);
|
debug ("handle_input(%c)\n", (char) key);
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
s = screenlist_current ();
|
/* s = screenlist_current (); */
|
||||||
if (s) {
|
c = (client *)LL_GetFirst(clients);
|
||||||
c = s->parent;
|
while(c) {
|
||||||
if (c) {
|
// TODO: Interpret and translate keys!
|
||||||
// TODO: Interpret and translate keys!
|
// If the client should have this keypress...
|
||||||
// If the client should have this keypress...
|
// Send keypress to client
|
||||||
// Send keypress to client
|
// TODO: Implement client "acceptable key" lists
|
||||||
if (key >= 'E' && key <= 'Z') {
|
sprintf(str, "key %c\n", key);
|
||||||
// TODO: Implement client "acceptable key" lists
|
sock_send_string(c->sock, str);
|
||||||
sprintf (str, "key %c\n", key);
|
c = (client *)LL_GetNext(clients);
|
||||||
sock_send_string (c->sock, str);
|
|
||||||
}
|
|
||||||
// Otherwise, tell the server about it.
|
|
||||||
else {
|
|
||||||
server_input (key);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If no parent, it means we're on the server screen.
|
|
||||||
// so, the server gets all keypresses there.
|
|
||||||
server_input (key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
server_input (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user