keypad_test_mode made functional. get_info also modified to work.

This commit is contained in:
wayn3
2002-11-24 01:18:43 +00:00
parent f9c84384a4
commit 026e647e88
+23 -7
View File
@@ -386,13 +386,15 @@ MtxOrb_init (Driver *drvthis, char *args)
/* keypad test mode? */ /* keypad test mode? */
if (drvthis->config_get_bool( drvthis->name , "keypad_test_mode" , 0 , 0)) { if (drvthis->config_get_bool( drvthis->name , "keypad_test_mode" , 0 , 0)) {
report (RPT_INFO, "MtxOrb: Entering keypad test mode...\n"); fprintf( stdout, "MtxOrb: Entering keypad test mode...\n");
p->keypad_test_mode = 1; p->keypad_test_mode = 1;
stay_in_foreground = 1;
} }
if (!p->keypad_test_mode) { if (!p->keypad_test_mode) {
/* We don't send any chars to the server in keypad test mode. /* We don't send any chars to the server in keypad test mode.
* So there's no need to get them from the configfile in keypad test mode. * So there's no need to get them from the configfile in keypad
* test mode.
*/ */
/* left_key */ /* left_key */
@@ -419,7 +421,6 @@ report (RPT_DEBUG, "MtxOrb: Using \"%c\" as EnterKey.", p->enter_key);
p->escape_key = MtxOrb_parse_keypad_setting (drvthis, "EscapeKey", MTXORB_DEFAULT_Escape); p->escape_key = MtxOrb_parse_keypad_setting (drvthis, "EscapeKey", MTXORB_DEFAULT_Escape);
report (RPT_DEBUG, "MtxOrb: Using \"%c\" as EscapeKey.", p->escape_key); report (RPT_DEBUG, "MtxOrb: Using \"%c\" as EscapeKey.", p->escape_key);
} }
/* End of config file parsing*/ /* End of config file parsing*/
@@ -876,7 +877,8 @@ MtxOrb_get_info (Driver *drvthis)
tv.tv_sec = 0; /* seconds */ tv.tv_sec = 0; /* seconds */
tv.tv_usec = 500; /* microseconds */ tv.tv_usec = 500; /* microseconds */
retval = select(1, &rfds, NULL, NULL, &tv); /* retval = select(p->fd+1, &rfds, NULL, NULL, &tv); */
retval = select(p->fd+1, &rfds, NULL, NULL, NULL);
if (retval) { if (retval) {
if (read (p->fd, &in, 1) < 0) { if (read (p->fd, &in, 1) < 0) {
@@ -928,7 +930,8 @@ MtxOrb_get_info (Driver *drvthis)
tv.tv_sec = 0; /* seconds */ tv.tv_sec = 0; /* seconds */
tv.tv_usec = 500; /* microseconds */ tv.tv_usec = 500; /* microseconds */
retval = select(1, &rfds, NULL, NULL, &tv); /* retval = select(p->fd+1, &rfds, NULL, NULL, &tv); */
retval = select(p->fd+1, &rfds, NULL, NULL, NULL);
if (retval) { if (retval) {
if (read (p->fd, &tmp, 2) < 0) { if (read (p->fd, &tmp, 2) < 0) {
@@ -951,7 +954,8 @@ MtxOrb_get_info (Driver *drvthis)
tv.tv_sec = 0; /* seconds */ tv.tv_sec = 0; /* seconds */
tv.tv_usec = 500; /* microseconds */ tv.tv_usec = 500; /* microseconds */
retval = select(1, &rfds, NULL, NULL, &tv); /* retval = select(p->fd+1, &rfds, NULL, NULL, &tv); */
retval = select(p->fd+1, &rfds, NULL, NULL, NULL);
if (retval) { if (retval) {
if (read (p->fd, &tmp, 2) < 0) { if (read (p->fd, &tmp, 2) < 0) {
@@ -1238,8 +1242,14 @@ MtxOrb_get_key (Driver *drvthis)
PrivateData * p = drvthis->private_data; PrivateData * p = drvthis->private_data;
read (p->fd, &in, 1); (void) read (p->fd, &in, 1);
if ( 0 == in ) {
debug( RPT_INFO, "MtxOrb_get_key: in=>%d\n", in );
return NULL;
}
if (!p->keypad_test_mode) {
if (in==p->left_key) { return "Left"; if (in==p->left_key) { return "Left";
} else if (in==p->right_key) { return "Up"; } else if (in==p->right_key) { return "Up";
} else if (in==p->up_key) { return "Down"; } else if (in==p->up_key) { return "Down";
@@ -1250,6 +1260,12 @@ MtxOrb_get_key (Driver *drvthis)
report( RPT_INFO, "MtxOrb Untreated key 0x%2x", in); report( RPT_INFO, "MtxOrb Untreated key 0x%2x", in);
return NULL; return NULL;
} }
} else {
fprintf (stdout, "MtxOrb: Received character %c\n", in);
in = 0;
fprintf (stdout, "MtxOrb: Press another key of your device.\n");
}
return NULL;
} }