Changeset 432a269 in mainline for uspace/srv/hid/input/generic/input.c


Ignore:
Timestamp:
2011-09-16T21:13:57Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3a11f17
Parents:
c0e53ff (diff), fd07e526 (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 mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/generic/input.c

    rc0e53ff r432a269  
    4747#include <stdio.h>
    4848#include <ns.h>
    49 #include <ns_obsolete.h>
    5049#include <async.h>
    51 #include <async_obsolete.h>
    5250#include <errno.h>
    5351#include <adt/fifo.h>
     
    6361#include <mouse.h>
    6462
    65 // FIXME: remove this header
    66 #include <abi/ipc/methods.h>
    67 
    6863#define NUM_LAYOUTS  3
    6964
     
    7772static void kbd_devs_reclaim(void);
    7873
    79 int client_phone = -1;
     74async_sess_t *client_sess = NULL;
    8075
    8176/** List of keyboard devices */
     
    8681
    8782bool irc_service = false;
    88 int irc_phone = -1;
     83async_sess_t *irc_sess = NULL;
    8984
    9085void kbd_push_data(kbd_dev_t *kdev, sysarg_t data)
     
    170165       
    171166        ev.c = layout_parse_ev(kdev->active_layout, &ev);
    172         async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, ev.type, ev.key,
    173             ev.mods, ev.c);
     167       
     168        async_exch_t *exch = async_exchange_begin(client_sess);
     169        async_msg_4(exch, INPUT_EVENT_KEY, ev.type, ev.key, ev.mods, ev.c);
     170        async_exchange_end(exch);
    174171}
    175172
     
    177174void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy)
    178175{
    179         async_obsolete_msg_2(client_phone, INPUT_EVENT_MOVE, dx, dy);
     176        async_exch_t *exch = async_exchange_begin(client_sess);
     177        async_msg_2(exch, INPUT_EVENT_MOVE, dx, dy);
     178        async_exchange_end(exch);
    180179}
    181180
     
    183182void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press)
    184183{
    185         async_obsolete_msg_2(client_phone, INPUT_EVENT_BUTTON, bnum, press);
     184        async_exch_t *exch = async_exchange_begin(client_sess);
     185        async_msg_2(exch, INPUT_EVENT_BUTTON, bnum, press);
     186        async_exchange_end(exch);
    186187}
    187188
    188189static void client_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    189190{
    190         ipc_callid_t callid;
    191         ipc_call_t call;
    192         int retval;
    193        
    194191        async_answer_0(iid, EOK);
    195192       
    196193        while (true) {
    197                 callid = async_get_call(&call);
     194                ipc_call_t call;
     195                ipc_callid_t callid = async_get_call(&call);
    198196               
    199197                if (!IPC_GET_IMETHOD(call)) {
    200                         if (client_phone != -1) {
    201                                 async_obsolete_hangup(client_phone);
    202                                 client_phone = -1;
     198                        if (client_sess != NULL) {
     199                                async_hangup(client_sess);
     200                                client_sess = NULL;
    203201                        }
    204202                       
     
    207205                }
    208206               
    209                 switch (IPC_GET_IMETHOD(call)) {
    210                 case IPC_M_CONNECT_TO_ME:
    211                         if (client_phone != -1) {
    212                                 retval = ELIMIT;
     207                async_sess_t *sess =
     208                    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
     209                if (sess != NULL) {
     210                        if (client_sess == NULL) {
     211                                client_sess = sess;
     212                                async_answer_0(callid, EOK);
     213                        } else
     214                                async_answer_0(callid, ELIMIT);
     215                } else {
     216                        switch (IPC_GET_IMETHOD(call)) {
     217                        case INPUT_YIELD:
     218                                kbd_devs_yield();
     219                                async_answer_0(callid, EOK);
    213220                                break;
     221                        case INPUT_RECLAIM:
     222                                kbd_devs_reclaim();
     223                                async_answer_0(callid, EOK);
     224                                break;
     225                        default:
     226                                async_answer_0(callid, EINVAL);
    214227                        }
    215                         client_phone = IPC_GET_ARG5(call);
    216                         retval = 0;
    217                         break;
    218                 case INPUT_YIELD:
    219                         kbd_devs_yield();
    220                         retval = 0;
    221                         break;
    222                 case INPUT_RECLAIM:
    223                         kbd_devs_reclaim();
    224                         retval = 0;
    225                         break;
    226                 default:
    227                         retval = EINVAL;
    228228                }
    229                
    230                 async_answer_0(callid, retval);
    231229        }
    232230}
     
    648646       
    649647        if (irc_service) {
    650                 while (irc_phone < 0)
    651                         irc_phone = service_obsolete_connect_blocking(SERVICE_IRC, 0, 0);
     648                while (irc_sess == NULL)
     649                        irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     650                            SERVICE_IRC, 0, 0);
    652651        }
    653652       
Note: See TracChangeset for help on using the changeset viewer.