Ignore:
File:
1 edited

Legend:

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

    r4c6fd56 rca48672  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5454#include "display.h"
    5555#include "dsops.h"
     56#include "ievent.h"
    5657#include "input.h"
    5758#include "main.h"
     
    6263#include "wmops.h"
    6364
     65const char *cfg_file_path = "/w/cfg/display.sif";
     66
    6467static void display_client_conn(ipc_call_t *, void *);
    6568static void display_client_ev_pending(void *);
     
    123126        ds_output_t *output = NULL;
    124127        gfx_context_t *gc = NULL;
    125         port_id_t disp_port;
    126         port_id_t gc_port;
    127         port_id_t wm_port;
    128         port_id_t dc_port;
     128        port_id_t port = 0;
    129129        loc_srv_t *srv = NULL;
    130130        service_id_t sid = 0;
     
    137137                goto error;
    138138
    139         rc = ds_seat_create(disp, "Alice", &seat);
    140         if (rc != EOK)
    141                 goto error;
     139        rc = ds_display_load_cfg(disp, cfg_file_path);
     140        if (rc != EOK) {
     141                log_msg(LOG_DEFAULT, LVL_NOTE,
     142                    "Starting with fresh configuration.");
     143
     144                /* Create first seat */
     145                rc = ds_seat_create(disp, "Alice", &seat);
     146                if (rc != EOK)
     147                        goto error;
     148        }
    142149
    143150        rc = ds_output_create(&output);
     
    150157                goto error;
    151158
     159        rc = ds_ievent_init(disp);
     160        if (rc != EOK)
     161                goto error;
     162
    152163        rc = ds_input_open(disp);
    153164        if (rc != EOK)
     
    155166
    156167        rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp,
    157             &disp_port);
    158         if (rc != EOK)
    159                 goto error;
    160 
    161         rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port);
    162         if (rc != EOK)
    163                 goto error;
    164 
    165         rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp,
    166             &wm_port);
    167         if (rc != EOK)
    168                 goto error;
    169 
    170         rc = async_create_port(INTERFACE_DISPCFG, display_dispcfg_conn, disp,
    171             &dc_port);
     168            &port);
     169        if (rc != EOK)
     170                goto error;
     171
     172        rc = async_port_create_interface(port, INTERFACE_GC, display_gc_conn,
     173            disp);
     174        if (rc != EOK)
     175                goto error;
     176
     177        rc = async_port_create_interface(port, INTERFACE_WNDMGT,
     178            display_wndmgt_conn, disp);
     179        if (rc != EOK)
     180                goto error;
     181
     182        rc = async_port_create_interface(port, INTERFACE_DISPCFG,
     183            display_dispcfg_conn, disp);
    172184        if (rc != EOK)
    173185                goto error;
     
    180192        }
    181193
    182         rc = loc_service_register(srv, SERVICE_NAME_DISPLAY, &sid);
     194        rc = loc_service_register(srv, SERVICE_NAME_DISPLAY, port, &sid);
    183195        if (rc != EOK) {
    184196                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
     
    194206        if (srv != NULL)
    195207                loc_server_unregister(srv);
    196         // XXX destroy disp_port
    197         // XXX destroy gc_port
    198         // XXX destroy wm_port
    199         // XXX destroy dc_port
     208        if (port != 0)
     209                async_port_destroy(port);
    200210#if 0
    201211        if (disp->input != NULL)
    202212                ds_input_close(disp);
    203213#endif
     214        ds_ievent_fini(disp);
    204215        if (output != NULL)
    205216                ds_output_destroy(output);
Note: See TracChangeset for help on using the changeset viewer.