Import Upstream version 1.9.0-wip.20070910
This commit is contained in:
1 parent
a60b7c6315
commit
9404a6167d
46 files changed
+321
-44839
No files matched your search
+21
-20
@@ -17,7 +17,7 @@
|
||||
|
||||
(c) 2006 Mike Lampard, Philip Lawatsch, and others
|
||||
|
||||
$Revision: 244 $ - $Date: 2007-01-05 08:04:05 +1030 (Fri, 05 Jan 2007) $ $Author: mlampard $
|
||||
$Revision: 299 $ - $Date: 2007-09-09 19:19:52 +0200 (Sun, 09 Sep 2007) $ $Author: mlampard $
|
||||
|
||||
This daemon listens on localhost port 15550 for client connections,
|
||||
and arbitrates LCD display. Allows for multiple simultaneous clients.
|
||||
@@ -43,6 +43,10 @@
|
||||
static int leaving;
|
||||
int server_events(plugin_event_t *myevent);
|
||||
|
||||
#ifndef SO_PRIORITY
|
||||
#define SO_PRIORITY 12
|
||||
#endif
|
||||
|
||||
/* tcp server defines */
|
||||
#define LISTEN_PORT 15550
|
||||
#define LISTEN_ADDR "127.0.0.1"
|
||||
@@ -87,24 +91,6 @@ static void process_client_cmds(lcdnode_t *lcdnode, int sock, unsigned int *msgb
|
||||
send(sock,msgbuf,1,0);
|
||||
break;
|
||||
}
|
||||
case CLIENT_CMD_BACKLIGHT: { /* client wants to change the LCD backlight */
|
||||
/* return current state to the client then implement the new state */
|
||||
send(sock,&lcdnode->lcd->backlight_state,1,MSG_OOB);
|
||||
lcdnode->lcd->backlight_state = msgbuf[0]-0x80;
|
||||
lcdnode->lcd->state_changed = 1;
|
||||
break;
|
||||
}
|
||||
case CLIENT_CMD_KB_BACKLIGHT: { /* client wants to change the KB backlight */
|
||||
setKBBrightness((unsigned int)msgbuf[0]-0x80);
|
||||
break;
|
||||
}
|
||||
case CLIENT_CMD_CONTRAST: { /* client wants to change the LCD contrast */
|
||||
/* send current state to the client */
|
||||
send(sock,&lcdnode->lcd->contrast_state,1,MSG_OOB);
|
||||
lcdnode->lcd->contrast_state = msgbuf[0]-0x40;
|
||||
lcdnode->lcd->state_changed = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if(msgbuf[0] & CLIENT_CMD_MKEY_LIGHTS)
|
||||
{ /* client wants to change the M-key backlights */
|
||||
@@ -120,8 +106,23 @@ static void process_client_cmds(lcdnode_t *lcdnode, int sock, unsigned int *msgb
|
||||
lcdnode->list->remote_keyhandler_sock = sock;
|
||||
g15daemon_log(LOG_WARNING, "Client has taken over keystate");
|
||||
}
|
||||
else if (msgbuf[0] & CLIENT_CMD_BACKLIGHT)
|
||||
{
|
||||
send(sock,&lcdnode->lcd->backlight_state,1,MSG_OOB);
|
||||
lcdnode->lcd->backlight_state = msgbuf[0]-0x80;
|
||||
lcdnode->lcd->state_changed = 1;
|
||||
}
|
||||
else if (msgbuf[0] & CLIENT_CMD_KB_BACKLIGHT)
|
||||
{
|
||||
setKBBrightness((unsigned int)msgbuf[0]-0x8);
|
||||
}
|
||||
else if (msgbuf[0] & CLIENT_CMD_CONTRAST)
|
||||
{
|
||||
send(sock,&lcdnode->lcd->contrast_state,1,MSG_OOB);
|
||||
lcdnode->lcd->contrast_state = msgbuf[0]-0x40;
|
||||
lcdnode->lcd->state_changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* create and open a socket for listening */
|
||||
|
||||
Reference in new issue
Block a user