Changeset 19a1800 in mainline for uspace/srv/hid/console/console.c


Ignore:
Timestamp:
2011-03-01T22:20:56Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e24e7b1
Parents:
976f546 (diff), ac8285d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with the current development

File:
1 edited

Legend:

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

    r976f546 r19a1800  
    3434
    3535#include <libc.h>
    36 #include <ipc/ipc.h>
    3736#include <ipc/kbd.h>
    3837#include <io/keycode.h>
     
    4039#include <ipc/fb.h>
    4140#include <ipc/services.h>
     41#include <ipc/ns.h>
    4242#include <errno.h>
    4343#include <ipc/console.h>
     
    116116static void curs_hide_sync(void)
    117117{
    118         ipc_call_sync_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
     118        async_req_1_0(fb_info.phone, FB_CURSOR_VISIBILITY, false);
    119119}
    120120
     
    131131static void screen_yield(void)
    132132{
    133         ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_YIELD);
     133        async_req_0_0(fb_info.phone, FB_SCREEN_YIELD);
    134134}
    135135
    136136static void screen_reclaim(void)
    137137{
    138         ipc_call_sync_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
     138        async_req_0_0(fb_info.phone, FB_SCREEN_RECLAIM);
    139139}
    140140
    141141static void kbd_yield(void)
    142142{
    143         ipc_call_sync_0_0(kbd_phone, KBD_YIELD);
     143        async_req_0_0(kbd_phone, KBD_YIELD);
    144144}
    145145
    146146static void kbd_reclaim(void)
    147147{
    148         ipc_call_sync_0_0(kbd_phone, KBD_RECLAIM);
     148        async_req_0_0(kbd_phone, KBD_RECLAIM);
    149149}
    150150
     
    438438                        retval = ENOENT;
    439439                }
    440                 ipc_answer_0(callid, retval);
     440                async_answer_0(callid, retval);
    441441        }
    442442}
     
    474474                }
    475475
    476                 ipc_answer_0(callid, retval);
     476                async_answer_0(callid, retval);
    477477        }
    478478}
     
    485485       
    486486        if (rc != EOK) {
    487                 ipc_answer_0(rid, rc);
     487                async_answer_0(rid, rc);
    488488                return;
    489489        }
     
    500500       
    501501        gcons_notify_char(cons->index);
    502         ipc_answer_1(rid, EOK, size);
     502        async_answer_1(rid, EOK, size);
    503503       
    504504        free(buf);
     
    510510        size_t size;
    511511        if (!async_data_read_receive(&callid, &size)) {
    512                 ipc_answer_0(callid, EINVAL);
    513                 ipc_answer_0(rid, EINVAL);
     512                async_answer_0(callid, EINVAL);
     513                async_answer_0(rid, EINVAL);
    514514                return;
    515515        }
     
    517517        char *buf = (char *) malloc(size);
    518518        if (buf == NULL) {
    519                 ipc_answer_0(callid, ENOMEM);
    520                 ipc_answer_0(rid, ENOMEM);
     519                async_answer_0(callid, ENOMEM);
     520                async_answer_0(rid, ENOMEM);
    521521                return;
    522522        }
     
    536536        if (pos == size) {
    537537                (void) async_data_read_finalize(callid, buf, size);
    538                 ipc_answer_1(rid, EOK, size);
     538                async_answer_1(rid, EOK, size);
    539539                free(buf);
    540540        } else {
     
    554554recheck:
    555555        if (keybuffer_pop(&cons->keybuffer, &ev)) {
    556                 ipc_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);
     556                async_answer_4(rid, EOK, ev.type, ev.key, ev.mods, ev.c);
    557557        } else {
    558558                fibril_condvar_wait(&input_cv, &input_mutex);
     
    580580       
    581581        if (cons == NULL) {
    582                 ipc_answer_0(iid, ENOENT);
     582                async_answer_0(iid, ENOENT);
    583583                return;
    584584        }
     
    599599       
    600600        /* Accept the connection */
    601         ipc_answer_0(iid, EOK);
     601        async_answer_0(iid, EOK);
    602602       
    603603        while (true) {
     
    659659                        rc = ccap_fb_to_con(fb_info.color_cap, &arg1);
    660660                        if (rc != EOK) {
    661                                 ipc_answer_0(callid, rc);
     661                                async_answer_0(callid, rc);
    662662                                continue;
    663663                        }
     
    703703                        break;
    704704                }
    705                 ipc_answer_3(callid, EOK, arg1, arg2, arg3);
     705                async_answer_3(callid, EOK, arg1, arg2, arg3);
    706706        }
    707707}
     
    727727        /* NB: The callback connection is slotted for removal */
    728728        sysarg_t phonehash;
     729        sysarg_t taskhash;
    729730        int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE,
    730             0, 0, NULL, NULL, NULL, NULL, &phonehash);
     731            0, 0, NULL, NULL, NULL, &taskhash, &phonehash);
    731732        if (rc != EOK) {
    732733                printf(NAME ": Failed to create callback from input device\n");
     
    734735        }
    735736       
    736         async_new_connection(phonehash, 0, NULL, keyboard_events);
     737        async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events);
    737738
    738739        printf(NAME ": we got a hit (new keyboard \"%s\").\n", path);
     
    761762        if (retval != EOK) {
    762763                async_wait_for(req, NULL);
    763                 ipc_hangup(devmap_phone);
     764                async_hangup(devmap_phone);
    764765                return retval;
    765766        }
     
    768769
    769770        if (retval != EOK) {
    770                 ipc_hangup(devmap_phone);
     771                async_hangup(devmap_phone);
    771772                return retval;
    772773        }
     
    774775        devmap_handle_t handle = (devmap_handle_t) IPC_GET_ARG1(answer);
    775776
    776         ipc_hangup(devmap_phone);
     777        async_hangup(devmap_phone);
    777778
    778779        int phone = async_connect_me_to(PHONE_NS,
     
    784785        /* NB: The callback connection is slotted for removal */
    785786        sysarg_t phonehash;
     787        sysarg_t taskhash;
    786788        int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE,
    787             0, 0, NULL, NULL, NULL, NULL, &phonehash);
     789            0, 0, NULL, NULL, NULL, &taskhash, &phonehash);
    788790        if (rc != EOK) {
    789791                printf(NAME ": Failed to create callback from input device\n");
     
    791793        }
    792794
    793         async_new_connection(phonehash, 0, NULL, keyboard_events);
     795        async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events);
    794796
    795797        printf(NAME ": we got a hit (new keyboard \"/dev/%s\").\n",
     
    862864        }
    863865       
    864         sysarg_t phonehash;
    865         if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) {
     866        if (async_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, mouse_events)
     867            != 0) {
    866868                printf(NAME ": Failed to create callback from mouse device\n");
    867869                mouse_phone = -1;
     
    869871        }
    870872       
    871         async_new_connection(phonehash, 0, NULL, mouse_events);
    872873skip_mouse:
    873874       
    874875        /* Connect to framebuffer driver */
    875         fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VIDEO, 0, 0);
     876        fb_info.phone = service_connect_blocking(SERVICE_VIDEO, 0, 0);
    876877        if (fb_info.phone < 0) {
    877878                printf(NAME ": Failed to connect to video service\n");
     
    949950       
    950951        /* Receive kernel notifications */
     952        async_set_interrupt_received(interrupt_received);
    951953        if (event_subscribe(EVENT_KCONSOLE, 0) != EOK)
    952954                printf(NAME ": Error registering kconsole notifications\n");
    953        
    954         async_set_interrupt_received(interrupt_received);
    955955       
    956956        /* Start fibril for checking on hot-plugged keyboards. */
Note: See TracChangeset for help on using the changeset viewer.