Changeset c0757e1f in mainline for uspace/lib/dispcfg/src/dispcfg.c


Ignore:
Timestamp:
2023-04-19T11:13:06Z (20 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
37087c8
Parents:
ec8ef12
Message:

UI display configuration utility

In addition to the command-line utility 'disp', we introduce its UI
equivalent 'display-cfg'. Currently this allows the user to configure
seats in a very comfortable way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/dispcfg/src/dispcfg.c

    rec8ef12 rc0757e1f  
    206206/** Free seat list.
    207207 *
    208  * @param list Display configuration list
     208 * @param list Seat list
    209209 */
    210210void dispcfg_free_seat_list(dispcfg_seat_list_t *list)
     
    277277/** Free seat information.
    278278 *
    279  * @param info Display configuration information
     279 * @param info Seat information
    280280 */
    281281void dispcfg_free_seat_info(dispcfg_seat_info_t *info)
     
    378378        async_exchange_end(exch);
    379379        return rc;
     380}
     381
     382/** Get list of devices assigned to a seat.
     383 *
     384 * @param dispcfg Display configuration
     385 * @param seat_id Seat ID
     386 * @param rlist Place to store pointer to new device list structure
     387 * @return EOK on success or an error code
     388 */
     389errno_t dispcfg_get_asgn_dev_list(dispcfg_t *dispcfg, sysarg_t seat_id,
     390    dispcfg_dev_list_t **rlist)
     391{
     392        async_exch_t *exch;
     393        aid_t req;
     394        ipc_call_t answer;
     395        dispcfg_dev_list_t *list;
     396        sysarg_t ndevs;
     397        sysarg_t *devs;
     398        errno_t rc;
     399
     400        exch = async_exchange_begin(dispcfg->sess);
     401        req = async_send_1(exch, DISPCFG_GET_ASGN_DEV_LIST, seat_id, &answer);
     402
     403        /* Receive device list length */
     404        rc = async_data_read_start(exch, &ndevs, sizeof (ndevs));
     405        if (rc != EOK) {
     406                async_exchange_end(exch);
     407                async_wait_for(req, &rc);
     408                return rc;
     409        }
     410
     411        devs = calloc(ndevs, sizeof(sysarg_t));
     412        if (devs == NULL) {
     413                async_exchange_end(exch);
     414                async_forget(req);
     415                return ENOMEM;
     416        }
     417
     418        /* Receive device list */
     419        rc = async_data_read_start(exch, devs, ndevs * sizeof (sysarg_t));
     420        async_exchange_end(exch);
     421
     422        if (rc != EOK) {
     423                async_forget(req);
     424                return rc;
     425        }
     426
     427        async_wait_for(req, &rc);
     428        if (rc != EOK)
     429                return rc;
     430
     431        list = calloc(1, sizeof(dispcfg_dev_list_t));
     432        if (list == NULL)
     433                return ENOMEM;
     434
     435        list->ndevs = ndevs;
     436        list->devs = devs;
     437        *rlist = list;
     438        return EOK;
     439}
     440
     441/** Free device list.
     442 *
     443 * @param list Device list
     444 */
     445void dispcfg_free_dev_list(dispcfg_dev_list_t *list)
     446{
     447        free(list->devs);
     448        free(list);
    380449}
    381450
Note: See TracChangeset for help on using the changeset viewer.