Changeset fa09449 in mainline for uspace/srv/console/console.c


Ignore:
Timestamp:
2009-02-15T22:31:07Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6cd9aa6
Parents:
76dd25b
Message:

Keycodes, keyboard events, kbd_event_get(). Keyboard driver now (formally) produces kbd events (press/release, keycode, mods, char) instead of just characters. In reality, the driver and client are only hacked to work with the new interface atm.

File:
1 edited

Legend:

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

    r76dd25b rfa09449  
    298298        ipc_call_t call;
    299299        int retval;
    300         int c;
     300        kbd_event_t ev;
    301301        connection_t *conn;
    302302        int newcon;
     
    320320                        retval = 0;
    321321                        break;
    322                 case KBD_PUSHCHAR:
    323                         /* got key from keyboard driver */
     322                case KBD_EVENT:
     323                        /* Got event from keyboard driver. */
    324324                        retval = 0;
    325                         c = IPC_GET_ARG1(call);
     325                        ev.type = IPC_GET_ARG1(call);
     326                        ev.key = IPC_GET_ARG2(call);
     327                        ev.mods = IPC_GET_ARG3(call);
     328                        ev.c = IPC_GET_ARG4(call);
     329                       
    326330                        /* switch to another virtual console */
    327331                       
    328332                        conn = &connections[active_console];
    329 /*
    330  *                      if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 +
    331  *                              CONSOLE_COUNT)) {
    332  */
    333                         if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) {
    334                                 if (c == 0x112)
     333
     334                        if ((ev.key >= 0x101) && (ev.key < 0x101 +
     335                            CONSOLE_COUNT)) {
     336                                if (ev.key == 0x112)
    335337                                        change_console(KERNEL_CONSOLE);
    336338                                else
    337                                         change_console(c - 0x101);
     339                                        change_console(ev.key - 0x101);
    338340                                break;
    339341                        }
     
    342344                        if (conn->keyrequest_counter > 0) {             
    343345                                conn->keyrequest_counter--;
    344                                 ipc_answer_1(fifo_pop(conn->keyrequests), EOK,
    345                                     c);
     346                                ipc_answer_4(fifo_pop(conn->keyrequests), EOK,
     347                                    ev.type, ev.key, ev.mods, ev.c);
    346348                                break;
    347349                        }
    348                        
    349                         keybuffer_push(&conn->keybuffer, c);
     350
     351                        keybuffer_push(&conn->keybuffer, &ev);
    350352                        retval = 0;
    351                        
     353
    352354                        break;
    353355                default:
     
    364366        ipc_call_t call;
    365367        int consnum;
    366         ipcarg_t arg1, arg2, arg3;
     368        ipcarg_t arg1, arg2, arg3, arg4;
    367369        connection_t *conn;
    368370       
     
    389391                arg1 = 0;
    390392                arg2 = 0;
     393                arg3 = 0;
     394                arg4 = 0;
     395
    391396                switch (IPC_GET_METHOD(call)) {
    392397                case IPC_M_PHONE_HUNGUP:
     
    459464                                curs_visibility(arg1);
    460465                        break;
    461                 case CONSOLE_GETCHAR:
     466                case CONSOLE_GETKEY:
    462467                        if (keybuffer_empty(&conn->keybuffer)) {
    463468                                /* buffer is empty -> store request */
     
    475480                                continue;
    476481                        }
    477                         int ch;
    478                         keybuffer_pop(&conn->keybuffer, &ch);
    479                         arg1 = ch;
     482                        kbd_event_t ev;
     483                        keybuffer_pop(&conn->keybuffer, &ev);
     484                        arg1 = ev.type;
     485                        arg2 = ev.key;
     486                        arg3 = ev.mods;
     487                        arg4 = ev.c;
    480488                        break;
    481489                }
    482                 ipc_answer_2(callid, EOK, arg1, arg2);
     490                ipc_answer_4(callid, EOK, arg1, arg2, arg3, arg4);
    483491        }
    484492}
Note: See TracChangeset for help on using the changeset viewer.