Changeset a40dea3 in mainline for uspace/srv/hid/input


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.

Location:
uspace/srv/hid/input/port
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/port/adb.c

    r5203e256 ra40dea3  
    3737#include <ipc/adb.h>
    3838#include <async.h>
    39 #include <async_obsolete.h>
    4039#include <input.h>
    4140#include <kbd_port.h>
     
    4544#include <errno.h>
    4645#include <devmap.h>
    47 #include <devmap_obsolete.h>
    4846
    4947static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall, void *arg);
     
    6361
    6462static kbd_dev_t *kbd_dev;
    65 static int dev_phone;
     63static async_sess_t *dev_sess;
    6664
    6765static int adb_port_init(kbd_dev_t *kdev)
     
    6967        const char *dev = "adb/kbd";
    7068        devmap_handle_t handle;
    71 
     69        async_exch_t *exch;
     70        int rc;
     71       
    7272        kbd_dev = kdev;
    7373       
    74         int rc = devmap_device_get_handle(dev, &handle, 0);
    75         if (rc == EOK) {
    76                 dev_phone = devmap_obsolete_device_connect(handle, 0);
    77                 if (dev_phone < 0) {
    78                         printf("%s: Failed to connect to device\n", NAME);
    79                         return dev_phone;
    80                 }
    81         } else
     74        rc = devmap_device_get_handle(dev, &handle, 0);
     75        if (rc != EOK)
    8276                return rc;
    8377       
     78        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0);
     79        if (dev_sess == NULL) {
     80                printf("%s: Failed to connect to device\n", NAME);
     81                return ENOENT;
     82        }
     83       
     84        exch = async_exchange_begin(dev_sess);
     85        if (exch == NULL) {
     86                printf("%s: Failed starting exchange with device\n", NAME);
     87                async_hangup(dev_sess);
     88                return ENOMEM;
     89        }
     90       
    8491        /* NB: The callback connection is slotted for removal */
    85         rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
    86             NULL);
     92        rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     93        async_exchange_end(exch);
    8794        if (rc != EOK) {
    8895                printf(NAME ": Failed to create callback from device\n");
     96                async_hangup(dev_sess);
    8997                return rc;
    9098        }
  • uspace/srv/hid/input/port/chardev.c

    r5203e256 ra40dea3  
    3737#include <ipc/char.h>
    3838#include <async.h>
    39 #include <async_obsolete.h>
    4039#include <input.h>
    4140#include <kbd_port.h>
    4241#include <kbd.h>
    4342#include <devmap.h>
    44 #include <devmap_obsolete.h>
    4543#include <errno.h>
    4644#include <stdio.h>
     
    6159
    6260static kbd_dev_t *kbd_dev;
    63 static int dev_phone;
     61static async_sess_t *dev_sess;
    6462
    6563/** List of devices to try connecting to. */
     
    7472{
    7573        devmap_handle_t handle;
     74        async_exch_t *exch;
    7675        unsigned int i;
    7776        int rc;
     
    9089        }
    9190       
    92         dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    93         if (dev_phone < 0) {
     91        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle,
     92            IPC_FLAG_BLOCKING);
     93        if (dev_sess == NULL) {
    9494                printf("%s: Failed connecting to device\n", NAME);
    9595                return ENOENT;
    9696        }
    9797       
     98        exch = async_exchange_begin(dev_sess);
     99        if (exch == NULL) {
     100                printf("%s: Failed starting exchange with device\n", NAME);
     101                async_hangup(dev_sess);
     102                return ENOMEM;
     103        }
     104       
    98105        /* NB: The callback connection is slotted for removal */
    99         if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
    100             NULL) != 0) {
     106        rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     107        async_exchange_end(exch);
     108       
     109        if (rc != 0) {
    101110                printf(NAME ": Failed to create callback from device\n");
     111                async_hangup(dev_sess);
    102112                return -1;
    103113        }
    104 
     114       
    105115        return 0;
    106116}
     
    116126static void chardev_port_write(uint8_t data)
    117127{
    118         async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     128        async_exch_t *exch = async_exchange_begin(dev_sess);
     129        if (exch == NULL) {
     130                printf("%s: Failed starting exchange with device\n", NAME);
     131                return;
     132        }
     133
     134        async_msg_1(exch, CHAR_WRITE_BYTE, data);
     135        async_exchange_end(exch);
    119136}
    120137
Note: See TracChangeset for help on using the changeset viewer.