summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1998-11-16 18:22:56 +0000
committerThomas Bushnell <thomas@gnu.org>1998-11-16 18:22:56 +0000
commitd536020c53166ecfa2b032fd13e4a9289cedf68b (patch)
tree9f0f8e4ec2c9edc42e588c4c7675024cf38d6003
parent19656903db2c911122154aa3e96f768b30edc201 (diff)
Mon Oct 26 16:47:18 1998 Thomas Bushnell, BSG <tb@mit.edu>
* devio.c (char_size_mask_xxx): New variable. (devio_set_bits): Don't munge c_cflag here. Instead, set char_size_mask_xxx. (device_read_reply_inband): Mask off high bits from the input to simulate less than 8-bit channels.
-rw-r--r--term/ChangeLog8
-rw-r--r--term/devio.c40
2 files changed, 43 insertions, 5 deletions
diff --git a/term/ChangeLog b/term/ChangeLog
index 754f5d02..cc248f92 100644
--- a/term/ChangeLog
+++ b/term/ChangeLog
@@ -1,3 +1,11 @@
+Mon Oct 26 16:47:18 1998 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * devio.c (char_size_mask_xxx): New variable.
+ (devio_set_bits): Don't munge c_cflag here. Instead,
+ set char_size_mask_xxx.
+ (device_read_reply_inband): Mask off high bits from the input to
+ simulate less than 8-bit channels.
+
1998-09-04 Roland McGrath <roland@baalperazim.frob.com>
* devio.c: Add #undef's for B19200, B38400, B57600, B115200, in case
diff --git a/term/devio.c b/term/devio.c
index 32ac0387..6c5a9683 100644
--- a/term/devio.c
+++ b/term/devio.c
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
@@ -77,6 +77,10 @@ static device_t device_master;
static int output_stopped;
+/* XXX Mask that omits high bits we are currently not supposed to pass
+ through. */
+static int char_size_mask_xxx = 0xff;
+
/* Forward */
static void devio_desert_dtr ();
@@ -302,7 +306,13 @@ device_read_reply_inband (mach_port_t replypt,
if (!error_code && (termstate.c_cflag & CREAD))
for (i = 0; i < datalen; i++)
{
- flush = input_character (data[i]);
+ int c = data[i];
+
+ /* XXX Mach only supports 8-bit channels; this munges things
+ to account for the reality. */
+ c &= char_size_mask_xxx;
+
+ flush = input_character (c);
if (flush)
break;
}
@@ -535,9 +545,29 @@ devio_set_bits ()
else
termstate.c_cflag &= ~CSTOPB;
- /* Mach only supports 8 bit channels. So wark the CSIZE to conform. */
- termstate.c_cflag = ((termstate.c_cflag & ~CSIZE)
- | ((termstate.c_cflag & PARENB) ? CS7 : CS8));
+ /* Figure out how to munge input, since we are unable to actually
+ affect what the hardware does. */
+ switch (termstate.c_cflag & CSIZE)
+ {
+ case CS5:
+ char_size_mask_xxx = 0x1f;
+ break;
+
+ case CS6:
+ char_size_mask_xxx = 0x3f;
+ break;
+
+ case CS7:
+ char_size_mask_xxx = 0x7f;
+ break;
+
+ case CS8:
+ default:
+ char_size_mask_xxx = 0xff;
+ break;
+ }
+ if (termstate.c_cflag & PARENB)
+ char_size_mask_xxx |= 0x80;
}
}