Changeset d8503fd in mainline for uspace/srv/hid/display/main.c


Ignore:
Timestamp:
2023-01-09T21:14:04Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46b02cb
Parents:
e04b72d6
Message:

Display configuration utility and server support

Currently we can only create, list and delete seats using the
'disp' utility (but no way to assign devices).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/main.c

    re04b72d6 rd8503fd  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#include <async.h>
    3737#include <disp_srv.h>
     38#include <dispcfg_srv.h>
    3839#include <errno.h>
    3940#include <gfx/context.h>
     
    4849#include <task.h>
    4950#include <wndmgt_srv.h>
     51#include "cfgclient.h"
     52#include "cfgops.h"
    5053#include "client.h"
    5154#include "display.h"
     
    6265static void display_client_ev_pending(void *);
    6366static void display_wmclient_ev_pending(void *);
     67static void display_cfgclient_ev_pending(void *);
    6468static void display_gc_conn(ipc_call_t *, void *);
    6569static void display_wndmgt_conn(ipc_call_t *, void *);
     70static void display_dispcfg_conn(ipc_call_t *, void *);
    6671
    6772#ifdef CONFIG_DISP_DOUBLE_BUF
     
    8691};
    8792
     93static ds_cfgclient_cb_t display_cfgclient_cb = {
     94        .ev_pending = display_cfgclient_ev_pending
     95};
     96
    8897static void display_client_ev_pending(void *arg)
    8998{
     
    98107
    99108        wndmgt_srv_ev_pending(srv);
     109}
     110
     111static void display_cfgclient_ev_pending(void *arg)
     112{
     113        dispcfg_srv_t *srv = (dispcfg_srv_t *) arg;
     114
     115        dispcfg_srv_ev_pending(srv);
    100116}
    101117
     
    110126        port_id_t gc_port;
    111127        port_id_t wm_port;
     128        port_id_t dc_port;
    112129        errno_t rc;
    113130
     
    118135                goto error;
    119136
    120         rc = ds_seat_create(disp, &seat);
     137        rc = ds_seat_create(disp, "Alice", &seat);
    121138        if (rc != EOK)
    122139                goto error;
     
    146163        rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp,
    147164            &wm_port);
     165        if (rc != EOK)
     166                goto error;
     167
     168        rc = async_create_port(INTERFACE_DISPCFG, display_dispcfg_conn, disp,
     169            &dc_port);
    148170        if (rc != EOK)
    149171                goto error;
     
    170192        // XXX destroy gc_port
    171193        // XXX destroy wm_port
     194        // XXX destroy dc_port
    172195#if 0
    173196        if (disp->input != NULL)
     
    284307}
    285308
     309/** Handle configuration connection to display server */
     310static void display_dispcfg_conn(ipc_call_t *icall, void *arg)
     311{
     312        ds_display_t *disp = (ds_display_t *) arg;
     313        errno_t rc;
     314        dispcfg_srv_t srv;
     315        ds_cfgclient_t *cfgclient = NULL;
     316
     317        /* Create CFG client object */
     318        ds_display_lock(disp);
     319        rc = ds_cfgclient_create(disp, &display_cfgclient_cb, &srv, &cfgclient);
     320        ds_display_unlock(disp);
     321        if (rc != EOK) {
     322                async_answer_0(icall, ENOMEM);
     323                return;
     324        }
     325
     326        /* Set up protocol structure */
     327        dispcfg_srv_initialize(&srv);
     328        srv.ops = &dispcfg_srv_ops;
     329        srv.arg = cfgclient;
     330
     331        /* Handle connection */
     332        dispcfg_conn(icall, &srv);
     333
     334        ds_display_lock(disp);
     335        ds_cfgclient_destroy(cfgclient);
     336        ds_display_unlock(disp);
     337}
     338
    286339int main(int argc, char *argv[])
    287340{
Note: See TracChangeset for help on using the changeset viewer.