Changeset e273e9e in mainline for uspace/srv/hid/console


Ignore:
Timestamp:
2024-10-03T18:48:48Z (10 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
5132379
Parents:
b2c9e42c
Message:

Move link out of cons_event_t

Location:
uspace/srv/hid/console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    rb2c9e42c re273e9e  
    334334{
    335335        /* Got key press/release event */
    336         cons_event_t *event =
    337             (cons_event_t *) malloc(sizeof(cons_event_t));
     336        cons_qevent_t *event =
     337            (cons_qevent_t *) malloc(sizeof(cons_qevent_t));
    338338        if (event == NULL)
    339339                return;
    340340
    341         *event = *ev;
     341        event->ev = *ev;
    342342        link_initialize(&event->link);
    343343
     
    556556                if (pos < size) {
    557557                        link_t *link = prodcons_consume(&cons->input_pc);
    558                         cons_event_t *event = list_get_instance(link,
    559                             cons_event_t, link);
     558                        cons_qevent_t *qevent = list_get_instance(link,
     559                            cons_qevent_t, link);
     560                        cons_event_t *event = &qevent->ev;
    560561
    561562                        /* Accept key presses of printable chars only. */
     
    567568                        }
    568569
    569                         free(event);
     570                        free(qevent);
    570571                }
    571572        }
     
    703704        console_t *cons = srv_to_console(srv);
    704705        link_t *link = prodcons_consume(&cons->input_pc);
    705         cons_event_t *cevent = list_get_instance(link, cons_event_t, link);
    706 
    707         *event = *cevent;
    708         free(cevent);
     706        cons_qevent_t *qevent = list_get_instance(link, cons_qevent_t, link);
     707
     708        *event = qevent->ev;
     709        free(qevent);
    709710        return EOK;
    710711}
  • uspace/srv/hid/console/console.h

    rb2c9e42c re273e9e  
    11/*
     2 * Copyright (c) 2024 Jiri Svoboda
    23 * Copyright (c) 2006 Josef Cejka
    34 * All rights reserved.
     
    3637#define CONSOLE_CONSOLE_H__
    3738
     39#include <adt/prodcons.h>
     40#include <io/cons_event.h>
     41
    3842#define CONSOLE_COUNT   11
     43
     44/** Console event queue entry */
     45typedef struct {
     46        /** Link to list of events */
     47        link_t link;
     48        /** Console event */
     49        cons_event_t ev;
     50} cons_qevent_t;
    3951
    4052#endif
Note: See TracChangeset for help on using the changeset viewer.