Changeset 74017ce in mainline for uspace/srv/hid/input/input.c


Ignore:
Timestamp:
2017-11-22T17:36:54Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7a6065c
Parents:
c4c6025
git-author:
Jiri Svoboda <jiri@…> (2017-11-22 15:53:34)
git-committer:
Jiri Svoboda <jiri@…> (2017-11-22 17:36:54)
Message:

Convert char_dev_iface users to chardev.

File:
1 edited

Legend:

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

    rc4c6025 r74017ce  
    3737 */
    3838
     39#include <adt/fifo.h>
    3940#include <adt/list.h>
    40 #include <stdbool.h>
     41#include <async.h>
     42#include <config.h>
     43#include <errno.h>
     44#include <fibril.h>
    4145#include <fibril_synch.h>
     46#include <io/chardev.h>
     47#include <io/console.h>
     48#include <io/keycode.h>
    4249#include <ipc/services.h>
    4350#include <ipc/input.h>
    44 #include <config.h>
     51#include <loc.h>
     52#include <ns.h>
     53#include <stdbool.h>
    4554#include <stdio.h>
    4655#include <stdlib.h>
    47 #include <ns.h>
    48 #include <async.h>
    49 #include <errno.h>
    50 #include <adt/fifo.h>
    51 #include <io/console.h>
    52 #include <io/keycode.h>
    53 #include <loc.h>
    5456#include <str_error.h>
    55 #include <char_dev_iface.h>
    56 #include <fibril.h>
    57 #include "layout.h"
     57
     58#include "input.h"
    5859#include "kbd.h"
    5960#include "kbd_port.h"
    6061#include "kbd_ctl.h"
     62#include "layout.h"
    6163#include "mouse.h"
    6264#include "mouse_proto.h"
    6365#include "serial.h"
    64 #include "input.h"
    6566
    6667#define NUM_LAYOUTS  4
     
    536537        while (true) {
    537538                uint8_t data;
    538 
    539                 char_dev_read(sdev->sess, &data, sizeof(data));
     539                size_t nread;
     540
     541                chardev_read(sdev->chardev, &data, sizeof(data), &nread);
     542                /* XXX Handle error */
    540543                kbd_push_data(sdev->kdev, data);
    541544        }
     
    552555{
    553556        bool match = false;
     557        int rc;
    554558
    555559        serial_dev_t *sdev = serial_dev_new();
     
    559563        sdev->kdev->svc_id = service_id;
    560564       
    561         int rc = loc_service_get_name(service_id, &sdev->kdev->svc_name);
     565        rc = loc_service_get_name(service_id, &sdev->kdev->svc_name);
    562566        if (rc != EOK)
    563567                goto fail;
     
    582586                sdev->sess = loc_service_connect(service_id, INTERFACE_DDF,
    583587                    IPC_FLAG_BLOCKING);
     588
     589                rc = chardev_open(sdev->sess, &sdev->chardev);
     590                if (rc != EOK) {
     591                        async_hangup(sdev->sess);
     592                        sdev->sess = NULL;
     593                        list_remove(&sdev->link);
     594                        goto fail;
     595                }
    584596
    585597                fid_t fid = fibril_create(serial_consumer, sdev);
Note: See TracChangeset for help on using the changeset viewer.