Changeset 60ebe63 in mainline


Ignore:
Timestamp:
2022-11-08T21:20:23Z (18 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bcd15f
Parents:
3a6d44b7
Message:

Store positioning device ID in position events

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/input.c

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    106106static void input_ev_key(input_t *input, ipc_call_t *call)
    107107{
     108        unsigned kbd_id;
    108109        kbd_event_type_t type;
    109110        keycode_t key;
     
    112113        errno_t rc;
    113114
    114         type = ipc_get_arg1(call);
    115         key = ipc_get_arg2(call);
    116         mods = ipc_get_arg3(call);
    117         c = ipc_get_arg4(call);
    118 
    119         rc = input->ev_ops->key(input, type, key, mods, c);
     115        kbd_id = ipc_get_arg1(call);
     116        type = ipc_get_arg2(call);
     117        key = ipc_get_arg3(call);
     118        mods = ipc_get_arg4(call);
     119        c = ipc_get_arg5(call);
     120
     121        rc = input->ev_ops->key(input, kbd_id, type, key, mods, c);
    120122        async_answer_0(call, rc);
    121123}
     
    123125static void input_ev_move(input_t *input, ipc_call_t *call)
    124126{
     127        unsigned pos_id;
    125128        int dx;
    126129        int dy;
    127130        errno_t rc;
    128131
    129         dx = ipc_get_arg1(call);
    130         dy = ipc_get_arg2(call);
    131 
    132         rc = input->ev_ops->move(input, dx, dy);
     132        pos_id = ipc_get_arg1(call);
     133        dx = ipc_get_arg2(call);
     134        dy = ipc_get_arg3(call);
     135
     136        rc = input->ev_ops->move(input, pos_id, dx, dy);
    133137        async_answer_0(call, rc);
    134138}
     
    136140static void input_ev_abs_move(input_t *input, ipc_call_t *call)
    137141{
     142        unsigned pos_id;
    138143        unsigned x;
    139144        unsigned y;
     
    142147        errno_t rc;
    143148
    144         x = ipc_get_arg1(call);
    145         y = ipc_get_arg2(call);
    146         max_x = ipc_get_arg3(call);
    147         max_y = ipc_get_arg4(call);
    148 
    149         rc = input->ev_ops->abs_move(input, x, y, max_x, max_y);
     149        pos_id = ipc_get_arg1(call);
     150        x = ipc_get_arg2(call);
     151        y = ipc_get_arg3(call);
     152        max_x = ipc_get_arg4(call);
     153        max_y = ipc_get_arg5(call);
     154
     155        rc = input->ev_ops->abs_move(input, pos_id, x, y, max_x, max_y);
    150156        async_answer_0(call, rc);
    151157}
     
    153159static void input_ev_button(input_t *input, ipc_call_t *call)
    154160{
     161        unsigned pos_id;
    155162        int bnum;
    156163        int press;
    157164        errno_t rc;
    158165
    159         bnum = ipc_get_arg1(call);
    160         press = ipc_get_arg2(call);
    161 
    162         rc = input->ev_ops->button(input, bnum, press);
     166        pos_id = ipc_get_arg1(call);
     167        bnum = ipc_get_arg2(call);
     168        press = ipc_get_arg3(call);
     169
     170        rc = input->ev_ops->button(input, pos_id, bnum, press);
    163171        async_answer_0(call, rc);
    164172}
     
    166174static void input_ev_dclick(input_t *input, ipc_call_t *call)
    167175{
     176        unsigned pos_id;
    168177        int bnum;
    169178        errno_t rc;
    170179
    171         bnum = ipc_get_arg1(call);
    172 
    173         rc = input->ev_ops->dclick(input, bnum);
     180        pos_id = ipc_get_arg1(call);
     181        bnum = ipc_get_arg2(call);
     182
     183        rc = input->ev_ops->dclick(input, pos_id, bnum);
    174184        async_answer_0(call, rc);
    175185}
  • uspace/lib/c/include/io/input.h

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5050        errno_t (*active)(input_t *);
    5151        errno_t (*deactive)(input_t *);
    52         errno_t (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    53         errno_t (*move)(input_t *, int, int);
    54         errno_t (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned);
    55         errno_t (*button)(input_t *, int, int);
    56         errno_t (*dclick)(input_t *, int);
     52        errno_t (*key)(input_t *, unsigned, kbd_event_type_t, keycode_t,
     53            keymod_t, char32_t);
     54        errno_t (*move)(input_t *, unsigned, int, int);
     55        errno_t (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned,
     56            unsigned);
     57        errno_t (*button)(input_t *, unsigned, int, int);
     58        errno_t (*dclick)(input_t *, unsigned, int);
    5759} input_ev_ops_t;
    5860
  • uspace/srv/hid/console/console.c

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * Copyright (c) 2011 Martin Decky
    44 * All rights reserved.
     
    120120static errno_t input_ev_active(input_t *);
    121121static errno_t input_ev_deactive(input_t *);
    122 static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    123 static errno_t input_ev_move(input_t *, int, int);
    124 static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
    125 static errno_t input_ev_button(input_t *, int, int);
    126 static errno_t input_ev_dclick(input_t *, int);
     122static errno_t input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
     123    keymod_t, char32_t);
     124static errno_t input_ev_move(input_t *, unsigned, int, int);
     125static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
     126    unsigned, unsigned);
     127static errno_t input_ev_button(input_t *, unsigned, int, int);
     128static errno_t input_ev_dclick(input_t *, unsigned, int);
    127129
    128130static input_ev_ops_t input_ev_ops = {
     
    357359}
    358360
    359 static errno_t input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
    360     keymod_t mods, char32_t c)
     361static errno_t input_ev_key(input_t *input, unsigned kbd_id,
     362    kbd_event_type_t type, keycode_t key, keymod_t mods, char32_t c)
    361363{
    362364        cons_event_t event;
     
    369371                event.type = CEV_KEY;
    370372
     373                (void)kbd_id;
    371374                event.ev.key.type = type;
    372375                event.ev.key.key = key;
     
    417420}
    418421
    419 static errno_t input_ev_move(input_t *input, int dx, int dy)
    420 {
     422static errno_t input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
     423{
     424        (void) pos_id;
    421425        pointer_update(pointer_x + dx, pointer_y + dy);
    422426        return EOK;
    423427}
    424428
    425 static errno_t input_ev_abs_move(input_t *input, unsigned x, unsigned y,
    426     unsigned max_x, unsigned max_y)
    427 {
     429static errno_t input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
     430    unsigned y, unsigned max_x, unsigned max_y)
     431{
     432        (void)pos_id;
    428433        pointer_update(mouse_scale_x * cols * x / max_x, mouse_scale_y * rows * y / max_y);
    429434        return EOK;
    430435}
    431436
    432 static errno_t input_ev_button(input_t *input, int bnum, int bpress)
     437static errno_t input_ev_button(input_t *input, unsigned pos_id, int bnum,
     438    int bpress)
    433439{
    434440        cons_event_t event;
     441
     442        (void)pos_id;
    435443
    436444        event.type = CEV_POS;
     
    444452}
    445453
    446 static errno_t input_ev_dclick(input_t *input, int bnum)
     454static errno_t input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
    447455{
    448456        cons_event_t event;
     457
     458        (void)pos_id;
    449459
    450460        event.type = CEV_POS;
  • uspace/srv/hid/display/input.c

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4545static errno_t ds_input_ev_active(input_t *);
    4646static errno_t ds_input_ev_deactive(input_t *);
    47 static errno_t ds_input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, char32_t);
    48 static errno_t ds_input_ev_move(input_t *, int, int);
    49 static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
    50 static errno_t ds_input_ev_button(input_t *, int, int);
    51 static errno_t ds_input_ev_dclick(input_t *, int);
     47static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
     48    keymod_t, char32_t);
     49static errno_t ds_input_ev_move(input_t *, unsigned, int, int);
     50static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
     51    unsigned, unsigned);
     52static errno_t ds_input_ev_button(input_t *, unsigned, int, int);
     53static errno_t ds_input_ev_dclick(input_t *, unsigned, int);
    5254
    5355static input_ev_ops_t ds_input_ev_ops = {
     
    7173}
    7274
    73 static errno_t ds_input_ev_key(input_t *input, kbd_event_type_t type,
    74     keycode_t key, keymod_t mods, char32_t c)
     75static errno_t ds_input_ev_key(input_t *input, unsigned kbd_id,
     76    kbd_event_type_t type, keycode_t key, keymod_t mods, char32_t c)
    7577{
    7678        ds_display_t *disp = (ds_display_t *) input->user;
    7779        kbd_event_t event;
    7880        errno_t rc;
     81
     82        (void)kbd_id;
    7983
    8084        event.type = type;
     
    8993}
    9094
    91 static errno_t ds_input_ev_move(input_t *input, int dx, int dy)
    92 {
    93         ds_display_t *disp = (ds_display_t *) input->user;
    94         ptd_event_t event;
    95         errno_t rc;
    96 
     95static errno_t ds_input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
     96{
     97        ds_display_t *disp = (ds_display_t *) input->user;
     98        ptd_event_t event;
     99        errno_t rc;
     100
     101        event.pos_id = pos_id;
    97102        event.type = PTD_MOVE;
    98103        event.dmove.x = dx;
     
    105110}
    106111
    107 static errno_t ds_input_ev_abs_move(input_t *input, unsigned x, unsigned y,
    108     unsigned max_x, unsigned max_y)
    109 {
    110         ds_display_t *disp = (ds_display_t *) input->user;
    111         ptd_event_t event;
    112         errno_t rc;
    113 
     112static errno_t ds_input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
     113    unsigned y, unsigned max_x, unsigned max_y)
     114{
     115        ds_display_t *disp = (ds_display_t *) input->user;
     116        ptd_event_t event;
     117        errno_t rc;
     118
     119        event.pos_id = pos_id;
    114120        event.type = PTD_ABS_MOVE;
    115121        event.apos.x = x;
     
    126132}
    127133
    128 static errno_t ds_input_ev_button(input_t *input, int bnum, int bpress)
    129 {
    130         ds_display_t *disp = (ds_display_t *) input->user;
    131         ptd_event_t event;
    132         errno_t rc;
    133 
     134static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum,
     135    int bpress)
     136{
     137        ds_display_t *disp = (ds_display_t *) input->user;
     138        ptd_event_t event;
     139        errno_t rc;
     140
     141        event.pos_id = pos_id;
    134142        event.type = bpress ? PTD_PRESS : PTD_RELEASE;
    135143        event.btn_num = bnum;
     
    143151}
    144152
    145 static errno_t ds_input_ev_dclick(input_t *input, int bnum)
    146 {
    147         ds_display_t *disp = (ds_display_t *) input->user;
    148         ptd_event_t event;
    149         errno_t rc;
    150 
     153static errno_t ds_input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
     154{
     155        ds_display_t *disp = (ds_display_t *) input->user;
     156        ptd_event_t event;
     157        errno_t rc;
     158
     159        event.pos_id = pos_id;
    151160        event.type = PTD_DCLICK;
    152161        event.btn_num = bnum;
  • uspace/srv/hid/display/seat.c

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    364364        if (event->type == PTD_PRESS || event->type == PTD_RELEASE ||
    365365            event->type == PTD_DCLICK) {
    366                 pevent.pos_id = 0;
     366                pevent.pos_id = event->pos_id;
    367367                switch (event->type) {
    368368                case PTD_PRESS:
     
    395395                seat->pntpos = npos;
    396396
    397                 pevent.pos_id = 0;
     397                pevent.pos_id = event->pos_id;
    398398                pevent.type = POS_UPDATE;
    399399                pevent.btn_num = 0;
     
    423423                seat->pntpos = npos;
    424424
    425                 pevent.pos_id = 0;
     425                pevent.pos_id = event->pos_id;
    426426                pevent.type = POS_UPDATE;
    427427                pevent.btn_num = 0;
  • uspace/srv/hid/display/types/display/ptd_event.h

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4848/** Pointing device event */
    4949typedef struct {
     50        /** Positioning device ID */
     51        unsigned pos_id;
     52        /** PTD event type */
    5053        ptd_event_type_t type;
    5154        /** Button number for PTD_PRESS or PTD_RELEASE */
  • uspace/srv/hid/input/input.c

    r3a6d44b7 r60ebe63  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * Copyright (c) 2006 Josef Cejka
    44 * All rights reserved.
     
    253253                if (client->active) {
    254254                        async_exch_t *exch = async_exchange_begin(client->sess);
    255                         async_msg_4(exch, INPUT_EVENT_KEY, ev.type, ev.key, ev.mods, ev.c);
     255                        async_msg_5(exch, INPUT_EVENT_KEY, kdev->svc_id,
     256                            ev.type, ev.key, ev.mods, ev.c);
    256257                        async_exchange_end(exch);
    257258                }
     
    267268
    268269                        if ((dx) || (dy))
    269                                 async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy);
     270                                async_msg_3(exch, INPUT_EVENT_MOVE,
     271                                    mdev->svc_id, dx, dy);
    270272
    271273                        if (dz) {
     
    274276
    275277                                for (unsigned int i = 0; i < 3; i++)
    276                                         async_msg_4(exch, INPUT_EVENT_KEY, KEY_PRESS, code, 0, 0);
    277 
    278                                 async_msg_4(exch, INPUT_EVENT_KEY, KEY_RELEASE, code, 0, 0);
     278                                        async_msg_5(exch, INPUT_EVENT_KEY,
     279                                            0 /* XXX kbd_id */,
     280                                            KEY_PRESS, code, 0, 0);
     281
     282                                async_msg_5(exch, INPUT_EVENT_KEY, KEY_RELEASE,
     283                                    0 /* XXX kbd_id */, code, 0, 0);
    279284                        }
    280285
     
    292297                        if ((max_x) && (max_y)) {
    293298                                async_exch_t *exch = async_exchange_begin(client->sess);
    294                                 async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y);
     299                                async_msg_5(exch, INPUT_EVENT_ABS_MOVE,
     300                                    mdev->svc_id, x, y, max_x, max_y);
    295301                                async_exchange_end(exch);
    296302                        }
     
    305311                if (client->active) {
    306312                        async_exch_t *exch = async_exchange_begin(client->sess);
    307                         async_msg_2(exch, INPUT_EVENT_BUTTON, bnum, press);
     313                        async_msg_3(exch, INPUT_EVENT_BUTTON, mdev->svc_id,
     314                            bnum, press);
    308315                        async_exchange_end(exch);
    309316                }
     
    317324                if (client->active) {
    318325                        async_exch_t *exch = async_exchange_begin(client->sess);
    319                         async_msg_1(exch, INPUT_EVENT_DCLICK, bnum);
     326                        async_msg_2(exch, INPUT_EVENT_DCLICK, mdev->svc_id,
     327                            bnum);
    320328                        async_exchange_end(exch);
    321329                }
Note: See TracChangeset for help on using the changeset viewer.