Changeset 60ebe63 in mainline
- Timestamp:
- 2022-11-08T21:20:23Z (22 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7bcd15f
- Parents:
- 3a6d44b7
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/input.c
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 106 106 static void input_ev_key(input_t *input, ipc_call_t *call) 107 107 { 108 unsigned kbd_id; 108 109 kbd_event_type_t type; 109 110 keycode_t key; … … 112 113 errno_t rc; 113 114 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); 120 122 async_answer_0(call, rc); 121 123 } … … 123 125 static void input_ev_move(input_t *input, ipc_call_t *call) 124 126 { 127 unsigned pos_id; 125 128 int dx; 126 129 int dy; 127 130 errno_t rc; 128 131 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); 133 137 async_answer_0(call, rc); 134 138 } … … 136 140 static void input_ev_abs_move(input_t *input, ipc_call_t *call) 137 141 { 142 unsigned pos_id; 138 143 unsigned x; 139 144 unsigned y; … … 142 147 errno_t rc; 143 148 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); 150 156 async_answer_0(call, rc); 151 157 } … … 153 159 static void input_ev_button(input_t *input, ipc_call_t *call) 154 160 { 161 unsigned pos_id; 155 162 int bnum; 156 163 int press; 157 164 errno_t rc; 158 165 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); 163 171 async_answer_0(call, rc); 164 172 } … … 166 174 static void input_ev_dclick(input_t *input, ipc_call_t *call) 167 175 { 176 unsigned pos_id; 168 177 int bnum; 169 178 errno_t rc; 170 179 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); 174 184 async_answer_0(call, rc); 175 185 } -
uspace/lib/c/include/io/input.h
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 50 50 errno_t (*active)(input_t *); 51 51 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); 57 59 } input_ev_ops_t; 58 60 -
uspace/srv/hid/console/console.c
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * Copyright (c) 2011 Martin Decky 4 4 * All rights reserved. … … 120 120 static errno_t input_ev_active(input_t *); 121 121 static 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); 122 static errno_t input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t, 123 keymod_t, char32_t); 124 static errno_t input_ev_move(input_t *, unsigned, int, int); 125 static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, 126 unsigned, unsigned); 127 static errno_t input_ev_button(input_t *, unsigned, int, int); 128 static errno_t input_ev_dclick(input_t *, unsigned, int); 127 129 128 130 static input_ev_ops_t input_ev_ops = { … … 357 359 } 358 360 359 static errno_t input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,360 k eymod_t mods, char32_t c)361 static 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) 361 363 { 362 364 cons_event_t event; … … 369 371 event.type = CEV_KEY; 370 372 373 (void)kbd_id; 371 374 event.ev.key.type = type; 372 375 event.ev.key.key = key; … … 417 420 } 418 421 419 static errno_t input_ev_move(input_t *input, int dx, int dy) 420 { 422 static errno_t input_ev_move(input_t *input, unsigned pos_id, int dx, int dy) 423 { 424 (void) pos_id; 421 425 pointer_update(pointer_x + dx, pointer_y + dy); 422 426 return EOK; 423 427 } 424 428 425 static errno_t input_ev_abs_move(input_t *input, unsigned x, unsigned y, 426 unsigned max_x, unsigned max_y) 427 { 429 static 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; 428 433 pointer_update(mouse_scale_x * cols * x / max_x, mouse_scale_y * rows * y / max_y); 429 434 return EOK; 430 435 } 431 436 432 static errno_t input_ev_button(input_t *input, int bnum, int bpress) 437 static errno_t input_ev_button(input_t *input, unsigned pos_id, int bnum, 438 int bpress) 433 439 { 434 440 cons_event_t event; 441 442 (void)pos_id; 435 443 436 444 event.type = CEV_POS; … … 444 452 } 445 453 446 static errno_t input_ev_dclick(input_t *input, int bnum)454 static errno_t input_ev_dclick(input_t *input, unsigned pos_id, int bnum) 447 455 { 448 456 cons_event_t event; 457 458 (void)pos_id; 449 459 450 460 event.type = CEV_POS; -
uspace/srv/hid/display/input.c
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 45 45 static errno_t ds_input_ev_active(input_t *); 46 46 static 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); 47 static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t, 48 keymod_t, char32_t); 49 static errno_t ds_input_ev_move(input_t *, unsigned, int, int); 50 static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, 51 unsigned, unsigned); 52 static errno_t ds_input_ev_button(input_t *, unsigned, int, int); 53 static errno_t ds_input_ev_dclick(input_t *, unsigned, int); 52 54 53 55 static input_ev_ops_t ds_input_ev_ops = { … … 71 73 } 72 74 73 static errno_t ds_input_ev_key(input_t *input, kbd_event_type_t type,74 k eycode_t key, keymod_t mods, char32_t c)75 static 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) 75 77 { 76 78 ds_display_t *disp = (ds_display_t *) input->user; 77 79 kbd_event_t event; 78 80 errno_t rc; 81 82 (void)kbd_id; 79 83 80 84 event.type = type; … … 89 93 } 90 94 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 95 static 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; 97 102 event.type = PTD_MOVE; 98 103 event.dmove.x = dx; … … 105 110 } 106 111 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 112 static 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; 114 120 event.type = PTD_ABS_MOVE; 115 121 event.apos.x = x; … … 126 132 } 127 133 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 134 static 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; 134 142 event.type = bpress ? PTD_PRESS : PTD_RELEASE; 135 143 event.btn_num = bnum; … … 143 151 } 144 152 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 153 static 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; 151 160 event.type = PTD_DCLICK; 152 161 event.btn_num = bnum; -
uspace/srv/hid/display/seat.c
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 364 364 if (event->type == PTD_PRESS || event->type == PTD_RELEASE || 365 365 event->type == PTD_DCLICK) { 366 pevent.pos_id = 0;366 pevent.pos_id = event->pos_id; 367 367 switch (event->type) { 368 368 case PTD_PRESS: … … 395 395 seat->pntpos = npos; 396 396 397 pevent.pos_id = 0;397 pevent.pos_id = event->pos_id; 398 398 pevent.type = POS_UPDATE; 399 399 pevent.btn_num = 0; … … 423 423 seat->pntpos = npos; 424 424 425 pevent.pos_id = 0;425 pevent.pos_id = event->pos_id; 426 426 pevent.type = POS_UPDATE; 427 427 pevent.btn_num = 0; -
uspace/srv/hid/display/types/display/ptd_event.h
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 48 48 /** Pointing device event */ 49 49 typedef struct { 50 /** Positioning device ID */ 51 unsigned pos_id; 52 /** PTD event type */ 50 53 ptd_event_type_t type; 51 54 /** Button number for PTD_PRESS or PTD_RELEASE */ -
uspace/srv/hid/input/input.c
r3a6d44b7 r60ebe63 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * Copyright (c) 2006 Josef Cejka 4 4 * All rights reserved. … … 253 253 if (client->active) { 254 254 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); 256 257 async_exchange_end(exch); 257 258 } … … 267 268 268 269 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); 270 272 271 273 if (dz) { … … 274 276 275 277 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); 279 284 } 280 285 … … 292 297 if ((max_x) && (max_y)) { 293 298 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); 295 301 async_exchange_end(exch); 296 302 } … … 305 311 if (client->active) { 306 312 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); 308 315 async_exchange_end(exch); 309 316 } … … 317 324 if (client->active) { 318 325 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); 320 328 async_exchange_end(exch); 321 329 }
Note:
See TracChangeset
for help on using the changeset viewer.