Changeset d3109ff in mainline for uspace/srv/hid/output


Ignore:
Timestamp:
2024-09-24T17:59:36Z (17 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
6a753a9c
Parents:
3fcea34
Message:

Cursor and color control in remote console + RGB

Move vt100 module from output server into separate vt library
Add cursor and color control to remcons using libvt
Add RGB color control to serial console and remote console

Location:
uspace/srv/hid/output
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/output/ctl/serial.c

    r3fcea34 rd3109ff  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2006 Ondrej Palkovsky
    34 * Copyright (c) 2008 Martin Decky
     
    3738#include <errno.h>
    3839#include <io/chargrid.h>
     40#include <vt/vt100.h>
    3941#include "../output.h"
    40 #include "../proto/vt100.h"
    4142#include "serial.h"
    4243
     
    8485static console_caps_t serial_get_caps(outdev_t *dev)
    8586{
    86         return (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED);
     87        return (CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
    8788}
    8889
     
    125126    vt100_control_puts_t control_puts_fn, vt100_flush_t flush_fn)
    126127{
     128        char_attrs_t attrs;
    127129        vt100_state_t *state =
    128             vt100_state_create(SERIAL_COLS, SERIAL_ROWS, putuchar_fn,
     130            vt100_state_create(NULL, SERIAL_COLS, SERIAL_ROWS, putuchar_fn,
    129131            control_puts_fn, flush_fn);
    130132        if (state == NULL)
    131133                return ENOMEM;
     134        state->enable_rgb = true;
     135
     136        vt100_cursor_visibility(state, false);
     137        attrs.type = CHAR_ATTR_STYLE;
     138        attrs.val.style = STYLE_NORMAL;
     139        vt100_set_attr(state, attrs);
     140        vt100_cls(state);
    132141
    133142        outdev_t *dev = outdev_register(&serial_ops, state);
  • uspace/srv/hid/output/ctl/serial.h

    r3fcea34 rd3109ff  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2006 Ondrej Palkovsky
    34 * Copyright (c) 2008 Martin Decky
     
    3536#define OUTPUT_CTL_SERIAL_H_
    3637
    37 #include "../proto/vt100.h"
     38#include <vt/vt100.h>
    3839
    3940extern errno_t serial_init(vt100_putuchar_t, vt100_control_puts_t, vt100_flush_t);
  • uspace/srv/hid/output/meson.build

    r3fcea34 rd3109ff  
    11#
     2# Copyright (c) 2024 Jiri Svoboda
    23# Copyright (c) 2005 Martin Decky
    34# Copyright (c) 2007 Jakub Jermar
     
    2829#
    2930
    30 deps = [ 'codepage', 'console', 'drv', 'fbfont', 'pixconv', 'ddev', 'output' ]
     31deps = [ 'codepage', 'console', 'drv', 'fbfont', 'pixconv', 'ddev', 'output',
     32    'vt' ]
    3133src = files(
    3234        'ctl/serial.c',
     
    3436        'port/chardev.c',
    3537        'port/ddev.c',
    36         'proto/vt100.c',
    3738        'output.c',
    3839)
  • uspace/srv/hid/output/output.c

    r3fcea34 rd3109ff  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * Copyright (c) 2011 Martin Decky
    44 * All rights reserved.
     
    4040#include <ipc/output.h>
    4141#include <config.h>
     42#include <vt/vt100.h>
    4243#include "port/ega.h"
    4344#include "port/chardev.h"
  • uspace/srv/hid/output/port/chardev.c

    r3fcea34 rd3109ff  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2016 Jakub Jermar
    3  * Copyright (c) 2017 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    6565static FIBRIL_CONDVAR_INITIALIZE(discovery_cv);
    6666
    67 static void chardev_flush(void)
     67static void chardev_flush(void *arg)
    6868{
    6969        size_t nwr;
     70
     71        (void)arg;
    7072
    7173        if (chardev_bused == 0)
     
    8183{
    8284        if (chardev_bused == chardev_buf_size)
    83                 chardev_flush();
     85                chardev_flush(NULL);
    8486        chardev_buf[chardev_bused++] = (uint8_t) ch;
    8587}
    8688
    87 static void chardev_putuchar(char32_t ch)
     89static void chardev_putuchar(void *arg, char32_t ch)
    8890{
    8991        char buf[STR_BOUNDS(1)];
     
    9294        errno_t rc;
    9395
     96        (void)arg;
     97
    9498        off = 0;
    9599        rc = chr_encode(ch, buf, &off, sizeof(buf));
     
    101105}
    102106
    103 static void chardev_control_puts(const char *str)
     107static void chardev_control_puts(void *arg, const char *str)
    104108{
    105109        const char *p;
     
    107111        p = str;
    108112        while (*p != '\0')
    109                 chardev_putuchar(*p++);
     113                chardev_putuchar(arg, *p++);
    110114}
    111115
Note: See TracChangeset for help on using the changeset viewer.