Beispiel #1
0
/********************************************************************
 * Flushes the console buffer to the screen but only when the
 * "con_idx" is physicaly on the screen. Doesn't do anything when it's
 * not.
 *
 * In  : con_idx = index number of the console.
 *
 * Out : -1 on error, 1 on OK
 */
int con_flush (console_t *console) {
  if (console == NULL) return ERR_CON_INVALID_CONSOLE;

  // Update the screen, only when the console is currently on the screen.
  if (get_current_console() != console) return ERR_OK;

  // Update screen
  con_update_screen (console);

  // Set cursor position
  con_set_vga_cursor (console->py * console->max_px + console->px);
  console->opy = console->py;
  console->opx = console->px;

  // Return
  return ERR_OK;
}
Beispiel #2
0
/********************************************************************
 * Places cursor at console "con_idx" on position <X,Y>
 *
 * In  : con_idx = index number of the console.
 *       x       = X position (0 based)
 *       y       = Y position (0 based)
 *
 * Out : -1 on error, 1 on OK
 */
int con_setxy (console_t *console, int x, int y) {
  if (console == NULL) return ERR_CON_INVALID_CONSOLE;

  // Make sure our values aren't bigger than the console boundaries.
  if (x>=console->max_px || y>=console->max_py) return ERR_ERROR;

  // Set position
  console->px=x;
  console->py=y;

  // And correct the cursor on the screen (if necessary)
  if (get_current_console() == console) {
    con_set_vga_cursor ((console->py * console->max_px) + console->px);
  }

  // Return
  return ERR_OK;
}
Beispiel #3
0
void get_console_chars(struct mg_connection *conn,
		 const struct mg_request_info *ri)
{
    int i;
    UInt8 console[(CONSOLE_HEIGHT * CONSOLE_WIDTH)  + (CONSOLE_HEIGHT * 2) + 1];

    /*
    pthread_mutex_lock(&console_mutex);
    pthread_cond_wait(&chars_available_cv, &console_mutex);
    pthread_mutex_unlock(&console_mutex);
    */

    get_current_console(&console);
    mg_write(conn, console, strlen(console));

    /*
    printf("\r");
    for (i = 0; i < CONSOLE_WIDTH; i ++)
        printf("*");
    printf("\n%s\n", console);
    */
}