Changeset c0757e1f in mainline for uspace/srv/hid/display/cfgops.c
- Timestamp:
- 2023-04-19T11:13:06Z (20 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 37087c8
- Parents:
- ec8ef12
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/cfgops.c
rec8ef12 rc0757e1f 50 50 static errno_t dispc_dev_assign(void *, sysarg_t, sysarg_t); 51 51 static errno_t dispc_dev_unassign(void *, sysarg_t); 52 static errno_t dispc_get_asgn_dev_list(void *, sysarg_t, dispcfg_dev_list_t **); 52 53 static errno_t dispc_get_event(void *, dispcfg_ev_t *); 53 54 … … 59 60 .dev_assign = dispc_dev_assign, 60 61 .dev_unassign = dispc_dev_unassign, 62 .get_asgn_dev_list = dispc_get_asgn_dev_list, 61 63 .get_event = dispc_get_event, 62 64 }; … … 281 283 } 282 284 285 /** Get assigned device list. 286 * 287 * @param arg Argument (CFG client) 288 * @param seat_id Seat ID 289 * @param rlist Place to store pointer to new list 290 * @return EOK on success or an error code 291 */ 292 static errno_t dispc_get_asgn_dev_list(void *arg, sysarg_t seat_id, 293 dispcfg_dev_list_t **rlist) 294 { 295 ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg; 296 dispcfg_dev_list_t *list; 297 ds_seat_t *seat; 298 ds_idevcfg_t *idevcfg; 299 unsigned i; 300 301 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_get_asgn_dev_list()"); 302 303 list = calloc(1, sizeof(dispcfg_dev_list_t)); 304 if (list == NULL) 305 return ENOMEM; 306 307 ds_display_lock(cfgclient->display); 308 309 seat = ds_display_find_seat(cfgclient->display, seat_id); 310 if (seat == NULL) { 311 ds_display_unlock(cfgclient->display); 312 free(list); 313 return ENOENT; 314 } 315 316 /* Count the number of devices */ 317 list->ndevs = 0; 318 idevcfg = ds_seat_first_idevcfg(seat); 319 while (idevcfg != NULL) { 320 ++list->ndevs; 321 idevcfg = ds_display_next_idevcfg(idevcfg); 322 } 323 324 /* Allocate array for device IDs */ 325 list->devs = calloc(list->ndevs, sizeof(sysarg_t)); 326 if (list->devs == NULL) { 327 ds_display_unlock(cfgclient->display); 328 free(list); 329 return ENOMEM; 330 } 331 332 /* Fill in device IDs */ 333 i = 0; 334 idevcfg = ds_seat_first_idevcfg(seat); 335 while (idevcfg != NULL) { 336 list->devs[i++] = idevcfg->svc_id; 337 idevcfg = ds_display_next_idevcfg(idevcfg); 338 } 339 340 ds_display_unlock(cfgclient->display); 341 *rlist = list; 342 return EOK; 343 } 344 283 345 /** Get display configuration event. 284 346 *
Note:
See TracChangeset
for help on using the changeset viewer.