Ejemplo n.º 1
0
/* Common setup */
int __vesacon_open(struct file_info *fp)
{
    (void)fp;

    if (!vesacon_counter) {
	/* Are we disabled? */
	if (syslinux_serial_console_info()->flowctl & 0x8000) {
	    ti.disabled = 1;
	    ti.rows = 25;
	    ti.cols = 80;
	} else {
	    /* Switch mode */
	    if (__vesacon_init(vesacon_resolution.x, vesacon_resolution.y)) {
		vesacon_counter = -1;
		return EAGAIN;
	    }

	    /* Initial state */
	    __ansi_init(&ti);
	    ti.rows = __vesacon_text_rows;
	    ti.cols = __vesacon_text_cols;
	}
    } else if (vesacon_counter == -1) {
	return EAGAIN;
    }

    fp->o.rows = ti.rows;
    fp->o.cols = ti.cols;

    vesacon_counter++;
    return 0;
}
Ejemplo n.º 2
0
/* Common setup */
int __ansicon_open(struct file_info *fp)
{
    if (!ansicon_counter) {
	/* Are we disabled? */
	if (syslinux_serial_console_info()->flowctl & 0x8000) {
	    ti.disabled = 1;
	    ti.rows = 25;
	    ti.cols = 80;
	} else {
	    /* Force text mode */
	    firmware->o_ops->text_mode();

	    /* Initial state */
	    firmware->o_ops->get_mode(&ti.cols, &ti.rows);
	    __ansi_init(&ti);

	    /* Get cursor shape and position */
	    firmware->o_ops->get_cursor(&ti.ts->xy.x, &ti.ts->xy.y);
	}
    }

    fp->o.rows = ti.rows;
    fp->o.cols = ti.cols;

    ansicon_counter++;
    return 0;
}
Ejemplo n.º 3
0
ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
{
    const char *bufp = buf;
    size_t n = 0;

    (void)fp;

    if (!syslinux_serial_console_info()->iobase)
	return count;		/* Nothing to do */

    while (count--) {
	write_serial(*bufp++);
	n++;
    }

    return n;
}
Ejemplo n.º 4
0
ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
{
    com32sys_t ireg;
    const char *bufp = buf;
    size_t n = 0;

    (void)fp;

    if (!syslinux_serial_console_info()->iobase)
	return count;		/* Nothing to do */

    memset(&ireg, 0, sizeof ireg);
    ireg.eax.b[1] = 0x04;

    while (count--) {
	ireg.edx.b[0] = *bufp++;
	__intcall(0x21, &ireg, NULL);
	n++;
    }

    return n;
}
Ejemplo n.º 5
0
/* Common setup */
int __ansicon_open(struct file_info *fp)
{
  static com32sys_t ireg;	/* Auto-initalized to all zero */
  com32sys_t oreg;

  if (!ansicon_counter) {
    /* Are we disabled? */
    if (syslinux_serial_console_info()->flowctl & 0x8000) {
      ti.disabled = 1;
      ti.rows = 25;
      ti.cols = 80;
    } else {
      /* Force text mode */
      ireg.eax.w[0] = 0x0005;
      __intcall(0x22, &ireg, NULL);

      /* Initial state */
      ti.rows = BIOS_ROWS ? BIOS_ROWS+1 : 25;
      ti.cols = BIOS_COLS;
      __ansi_init(&ti);

      /* Get cursor shape and position */
      ireg.eax.b[1] = 0x03;
      ireg.ebx.b[1] = BIOS_PAGE;
      __intcall(0x10, &ireg, &oreg);
      cursor_type = oreg.ecx.w[0];
      ti.ts->xy.x = oreg.edx.b[0];
      ti.ts->xy.y = oreg.edx.b[1];
    }
  }

  fp->o.rows = ti.rows;
  fp->o.cols = ti.cols;

  ansicon_counter++;
  return 0;
}
Ejemplo n.º 6
0
ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
{
    const char *bufp = buf;
    size_t n = 0;
    static enum { st_init, st_tbl, st_tblc } state = st_init;
    static int ndigits;
    static int ncolor = 0;
    int num;
    const char *p;

    (void)fp;

    if (!syslinux_serial_console_info()->iobase)
	return count;		/* Nothing to do */

    while (count--) {
	unsigned char ch = *bufp++;

	switch (state) {
	case st_init:
	    if (ch >= 1 && ch <= 5) {
		state = st_tbl;
		ndigits = ch;
	    } else if (ch == '\n') {
		emit('\r');
		emit('\n');
	    } else {
		emit(ch);
	    }
	    break;

	case st_tbl:
	    if (ch == '#') {
		state = st_tblc;
		ncolor = 0;
	    } else {
		state = st_init;
	    }
	    break;

	case st_tblc:
	    num = ch - '0';
	    if (num < 10) {
		ncolor = (ncolor * 10) + num;
		if (--ndigits == 0) {
		    if (ncolor < console_color_table_size) {
			emit('\033');
			emit('[');
			emit('0');
			emit(';');
			for (p = console_color_table[ncolor].ansi; *p; p++)
			    emit(*p);
			emit('m');
		    }
		    state = st_init;
		}
	    } else {
		state = st_init;
	    }
	    break;
	}
	n++;
    }

    return n;
}