diff options
author | Thomas Bushnell <thomas@gnu.org> | 1998-11-16 18:22:56 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1998-11-16 18:22:56 +0000 |
commit | d536020c53166ecfa2b032fd13e4a9289cedf68b (patch) | |
tree | 9f0f8e4ec2c9edc42e588c4c7675024cf38d6003 /term/devio.c | |
parent | 19656903db2c911122154aa3e96f768b30edc201 (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.
Diffstat (limited to 'term/devio.c')
-rw-r--r-- | term/devio.c | 40 |
1 files changed, 35 insertions, 5 deletions
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; } } |