/[qemu]/qemu/vl.c
ViewVC logotype

Diff of /qemu/vl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.133 by bellard, Sun Jul 24 18:44:55 2005 UTC revision 1.134 by bellard, Sat Sep 3 15:28:58 2005 UTC
# Line 1138  CharDriverState *qemu_chr_open_fd(int fd Line 1138  CharDriverState *qemu_chr_open_fd(int fd
1138    
1139  #define TERM_ESCAPE 0x01 /* ctrl-a is used for escape */  #define TERM_ESCAPE 0x01 /* ctrl-a is used for escape */
1140    
1141    #define TERM_FIFO_MAX_SIZE 1
1142    
1143  static int term_got_escape, client_index;  static int term_got_escape, client_index;
1144    static uint8_t term_fifo[TERM_FIFO_MAX_SIZE];
1145    int term_fifo_size;
1146    
1147  void term_print_help(void)  void term_print_help(void)
1148  {  {
# Line 1207  static void stdio_received_byte(int ch) Line 1211  static void stdio_received_byte(int ch)
1211                            
1212              chr = stdio_clients[client_index];              chr = stdio_clients[client_index];
1213              s = chr->opaque;              s = chr->opaque;
1214              buf[0] = ch;              if (s->fd_can_read(s->fd_opaque) > 0) {
1215              /* XXX: should queue the char if the device is not                  buf[0] = ch;
                ready */  
             if (s->fd_can_read(s->fd_opaque) > 0)  
1216                  s->fd_read(s->fd_opaque, buf, 1);                  s->fd_read(s->fd_opaque, buf, 1);
1217                } else if (term_fifo_size == 0) {
1218                    term_fifo[term_fifo_size++] = ch;
1219                }
1220          }          }
1221      }      }
1222  }  }
1223    
1224  static int stdio_can_read(void *opaque)  static int stdio_can_read(void *opaque)
1225  {  {
1226      /* XXX: not strictly correct */      CharDriverState *chr;
1227      return 1;      FDCharDriver *s;
1228    
1229        if (client_index < stdio_nb_clients) {
1230            chr = stdio_clients[client_index];
1231            s = chr->opaque;
1232            /* try to flush the queue if needed */
1233            if (term_fifo_size != 0 && s->fd_can_read(s->fd_opaque) > 0) {
1234                s->fd_read(s->fd_opaque, term_fifo, 1);
1235                term_fifo_size = 0;
1236            }
1237            /* see if we can absorb more chars */
1238            if (term_fifo_size == 0)
1239                return 1;
1240            else
1241                return 0;
1242        } else {
1243            return 1;
1244        }
1245  }  }
1246    
1247  static void stdio_read(void *opaque, const uint8_t *buf, int size)  static void stdio_read(void *opaque, const uint8_t *buf, int size)

Legend:
Removed from v.1.133  
changed lines
  Added in v.1.134

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26