Changeset a40dea3 in mainline for uspace/srv/hid/char_mouse/chardev.c


Ignore:
Timestamp:
2011-06-20T20:04:39Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6a0ff7f4
Parents:
5203e256
Message:

Eliminate devmap_obsolete API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/char_mouse/chardev.c

    r5203e256 ra40dea3  
    3636#include <ipc/char.h>
    3737#include <async.h>
    38 #include <async_obsolete.h>
    3938#include <vfs/vfs.h>
    4039#include <fcntl.h>
    4140#include <errno.h>
    4241#include <devmap.h>
    43 #include <devmap_obsolete.h>
    4442#include <char_mouse.h>
    4543#include <mouse_port.h>
     
    4745static void chardev_events(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    4846
    49 static int dev_phone;
     47static async_sess_t *dev_sess;
    5048
    5149#define NAME "char_mouse"
     
    5452{
    5553        devmap_handle_t handle;
    56         int rc = devmap_device_get_handle("char/ps2b", &handle,
     54        async_exch_t *exch;
     55        int rc;
     56       
     57        rc = devmap_device_get_handle("char/ps2b", &handle,
    5758            IPC_FLAG_BLOCKING);
    5859       
     
    6263        }
    6364       
    64         dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    65         if (dev_phone < 0) {
     65        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle,
     66            IPC_FLAG_BLOCKING);
     67        if (dev_sess == NULL) {
    6668                printf("%s: Failed connecting to PS/2\n", NAME);
    6769                return ENOENT;
    6870        }
    6971       
     72        exch = async_exchange_begin(dev_sess);
     73        if (exch == NULL) {
     74                printf("%s: Failed starting exchange with PS/2\n", NAME);
     75                async_hangup(dev_sess);
     76                return ENOMEM;
     77        }
     78       
    7079        /* NB: The callback connection is slotted for removal */
    71         if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events,
    72             NULL) != 0) {
     80        rc = async_connect_to_me(exch, 0, 0, 0, chardev_events, NULL);
     81        async_exchange_end(exch);
     82       
     83        if (rc != 0) {
    7384                printf(NAME ": Failed to create callback from device\n");
     85                async_hangup(dev_sess);
    7486                return false;
    7587        }
     
    88100void mouse_port_write(uint8_t data)
    89101{
    90         async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     102        async_exch_t *exch = async_exchange_begin(dev_sess);
     103        if (exch == NULL) {
     104                printf("%s: Failed starting exchange with PS/2\n", NAME);
     105                return;
     106        }
     107       
     108        async_msg_1(exch, CHAR_WRITE_BYTE, data);
     109       
     110        async_exchange_end(exch);
    91111}
    92112
Note: See TracChangeset for help on using the changeset viewer.