aboutsummaryrefslogtreecommitdiffstats
path: root/src/keydis.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keydis.c')
-rw-r--r--src/keydis.c106
1 files changed, 100 insertions, 6 deletions
diff --git a/src/keydis.c b/src/keydis.c
index e921f79..33eef20 100644
--- a/src/keydis.c
+++ b/src/keydis.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.2 2008/02/15 03:32:07 james
+ * *** empty log message ***
+ *
* Revision 1.1 2008/02/14 02:46:44 james
* *** empty log message ***
*
@@ -21,10 +24,11 @@ static char rcsid[] = "$Id$";
#include "project.h"
+#define CMD_BUFLEN 128
+
typedef struct
{
KEYDIS_SIGNATURE;
- Context *c;
} KeyDis_VT102;
typedef struct
@@ -42,7 +46,7 @@ keydis_close (KeyDis * t)
static int
-keydis_ipc_key (KeyDis * _t, int key)
+keydis_ipc_key (KeyDis * _t, Context * c, int key)
{
KeyDis_IPC *t = (KeyDis_IPC *) _t;
@@ -50,22 +54,85 @@ keydis_ipc_key (KeyDis * _t, int key)
}
static int
-keydis_vt102_key (KeyDis * _t, int key)
+keydis_ipc_set_baud (KeyDis * _t, Context * c, int baud)
+{
+ KeyDis_IPC *t = (KeyDis_IPC *) _t;
+
+ ipc_msg_send_setbaud (t->s, baud);
+
+ return 0;
+}
+
+static int
+keydis_ipc_send_break (KeyDis * _t, Context * c)
+{
+ KeyDis_IPC *t = (KeyDis_IPC *) _t;
+
+ ipc_msg_send_sendbreak (t->s);
+
+ return 0;
+}
+
+static int
+keydis_ipc_set_flow (KeyDis * _t, Context * c, int flow)
+{
+ KeyDis_IPC *t = (KeyDis_IPC *) _t;
+
+ ipc_msg_send_setflow (t->s, flow);
+
+ return 0;
+}
+
+static int
+keydis_vt102_key (KeyDis * _t, Context * c, int key)
+{
+ KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
+
+ vt102_send (c, key);
+ return 0;
+}
+
+static int
+keydis_vt102_set_baud (KeyDis * _t, Context * c, int baud)
{
KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
- vt102_send (t->c, key);
+ tty_set_baud (c->t, baud);
+
return 0;
}
+static int
+keydis_vt102_send_break (KeyDis * _t, Context * c)
+{
+ KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
+
+ tty_send_break (c->t);
+
+ return 0;
+}
+
+static int
+keydis_vt102_set_flow (KeyDis * _t, Context * c, int flow)
+{
+ KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
+
+ tty_set_flow (c->t, flow);
+
+ return 0;
+}
+
+
KeyDis *
-keydis_vt102_new (Context * c)
+keydis_vt102_new (void)
{
KeyDis_VT102 *t = malloc (sizeof (KeyDis_VT102));
t->key = keydis_vt102_key;
t->close = keydis_close;
- t->c = c;
+ t->set_baud = keydis_vt102_set_baud;
+ t->send_break = keydis_vt102_send_break;
+ t->set_flow = keydis_vt102_set_flow;
return (KeyDis *) t;
}
@@ -76,6 +143,33 @@ keydis_ipc_new (Socket * s)
KeyDis_IPC *t = malloc (sizeof (KeyDis_IPC));
t->key = keydis_ipc_key;
t->close = keydis_close;
+ t->set_baud = keydis_ipc_set_baud;
+ t->send_break = keydis_ipc_send_break;
+ t->set_flow = keydis_ipc_set_flow;
t->s = s;
return (KeyDis *) t;
}
+
+
+
+
+
+
+int
+keydis_key (KeyDis * t, Context * c, int key)
+{
+
+ if (!c->d)
+ return t->key (t, c, key);
+
+ cmd_show_status (c->d, c);
+
+ if (c->d->active)
+ return cmd_key (c->d, c, key);
+
+ if (key == CMD_KEY)
+ return cmd_activate (c->d, c);
+
+
+ return t->key (t, c, key);
+}