Ignore:
File:
1 edited

Legend:

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

    r15f3c3f r854eddd6  
    3737#include <ipc/char.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <input.h>
    4041#include <kbd_port.h>
    4142#include <kbd.h>
    42 #include <loc.h>
     43#include <devmap.h>
     44#include <devmap_obsolete.h>
    4345#include <errno.h>
    4446#include <stdio.h>
     
    5961
    6062static kbd_dev_t *kbd_dev;
    61 static async_sess_t *dev_sess;
     63static int dev_phone;
    6264
    6365/** List of devices to try connecting to. */
     
    7173static int chardev_port_init(kbd_dev_t *kdev)
    7274{
    73         service_id_t service_id;
    74         async_exch_t *exch;
     75        devmap_handle_t handle;
    7576        unsigned int i;
    7677        int rc;
     
    7980       
    8081        for (i = 0; i < num_devs; i++) {
    81                 rc = loc_service_get_id(in_devs[i], &service_id, 0);
     82                rc = devmap_device_get_handle(in_devs[i], &handle, 0);
    8283                if (rc == EOK)
    8384                        break;
     
    8990        }
    9091       
    91         dev_sess = loc_service_connect(EXCHANGE_ATOMIC, service_id,
    92             IPC_FLAG_BLOCKING);
    93         if (dev_sess == NULL) {
     92        dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
     93        if (dev_phone < 0) {
    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        
    10598        /* NB: The callback connection is slotted for removal */
    106         rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
    107         async_exchange_end(exch);
    108        
    109         if (rc != 0) {
    110                 printf("%s: Failed to create callback from device\n", NAME);
    111                 async_hangup(dev_sess);
     99        if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
     100            NULL) != 0) {
     101                printf(NAME ": Failed to create callback from device\n");
    112102                return -1;
    113103        }
    114        
     104
    115105        return 0;
    116106}
     
    126116static void chardev_port_write(uint8_t data)
    127117{
    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);
     118        async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
    136119}
    137120
     
    153136                switch (IPC_GET_IMETHOD(call)) {
    154137                case CHAR_NOTIF_BYTE:
    155                         kbd_push_data(kbd_dev, IPC_GET_ARG1(call));
     138                        kbd_push_scancode(kbd_dev, IPC_GET_ARG1(call));
    156139                        break;
    157140                default:
Note: See TracChangeset for help on using the changeset viewer.