Ignore:
File:
1 edited

Legend:

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

    r15f3c3f r854eddd6  
    3737#include <ipc/adb.h>
    3838#include <async.h>
     39#include <async_obsolete.h>
    3940#include <input.h>
    4041#include <kbd_port.h>
     
    4344#include <fcntl.h>
    4445#include <errno.h>
    45 #include <loc.h>
     46#include <devmap.h>
     47#include <devmap_obsolete.h>
    4648
    4749static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall, void *arg);
     
    6163
    6264static kbd_dev_t *kbd_dev;
    63 static async_sess_t *dev_sess;
     65static int dev_phone;
    6466
    6567static int adb_port_init(kbd_dev_t *kdev)
    6668{
    6769        const char *dev = "adb/kbd";
    68         service_id_t service_id;
    69         async_exch_t *exch;
    70         int rc;
    71        
     70        devmap_handle_t handle;
     71
    7272        kbd_dev = kdev;
    7373       
    74         rc = loc_service_get_id(dev, &service_id, 0);
    75         if (rc != EOK)
     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
    7682                return rc;
    7783       
    78         dev_sess = loc_service_connect(EXCHANGE_ATOMIC, service_id, 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        
    9184        /* NB: The callback connection is slotted for removal */
    92         rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
    93         async_exchange_end(exch);
     85        rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
     86            NULL);
    9487        if (rc != EOK) {
    95                 printf("%s: Failed to create callback from device\n", NAME);
    96                 async_hangup(dev_sess);
     88                printf(NAME ": Failed to create callback from device\n");
    9789                return rc;
    9890        }
     
    142134static void adb_kbd_reg0_data(uint16_t data)
    143135{
    144         uint8_t b0 = (data >> 8) & 0xff;
    145         uint8_t b1 = data & 0xff;
    146        
     136        uint8_t b0, b1;
     137
     138        b0 = (data >> 8) & 0xff;
     139        b1 = data & 0xff;
     140
    147141        if (b0 != 0xff)
    148                 kbd_push_data(kbd_dev, b0);
    149        
     142                kbd_push_scancode(kbd_dev, b0);
    150143        if (b1 != 0xff)
    151                 kbd_push_data(kbd_dev, b1);
     144                kbd_push_scancode(kbd_dev, b1);
    152145}
    153146
Note: See TracChangeset for help on using the changeset viewer.