Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset db6e419 in mainline for uspace/srv/hid/input/ctl/kbdev.c


Ignore:
Timestamp:
2011-08-16T18:53:00Z (10 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master
Children:
49160c4
Parents:
e0e922d (diff), 45058baa (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    re0e922d rdb6e419  
    4848#include <kbd_ctl.h>
    4949#include <kbd_port.h>
     50#include <loc.h>
    5051#include <stdlib.h>
    5152#include <vfs/vfs_sess.h>
    52 
     53#include <sys/typefmt.h>
    5354
    5455static int kbdev_ctl_init(kbd_dev_t *);
     
    7071        /** Session with kbdev device */
    7172        async_sess_t *sess;
    72 
    73         /** File descriptor of open kbdev device */
    74         int fd;
    7573} kbdev_t;
    7674
     
    8482
    8583        kbdev->kbd_dev = kdev;
    86         kbdev->fd = -1;
    8784
    8885        return kbdev;
     
    9390        if (kbdev->sess != NULL)
    9491                async_hangup(kbdev->sess);
    95         if (kbdev->fd >= 0)
    96                 close(kbdev->fd);
    9792        free(kbdev);
    9893}
     
    10095static int kbdev_ctl_init(kbd_dev_t *kdev)
    10196{
    102         const char *pathname;
    10397        async_sess_t *sess;
    10498        async_exch_t *exch;
    10599        kbdev_t *kbdev;
    106         int fd;
    107100        int rc;
    108101
    109         pathname = kdev->dev_path;
    110 
    111         fd = open(pathname, O_RDWR);
    112         if (fd < 0) {
    113                 return -1;
    114         }
    115 
    116         sess = fd_session(EXCHANGE_SERIALIZE, fd);
     102        sess = loc_service_connect(EXCHANGE_SERIALIZE, kdev->svc_id, 0);
    117103        if (sess == NULL) {
    118                 printf("%s: Failed starting session with '%s'\n", NAME, pathname);
    119                 close(fd);
     104                printf("%s: Failed starting session with '%s.'\n", NAME,
     105                    kdev->svc_name);
    120106                return -1;
    121107        }
     
    124110        if (kbdev == NULL) {
    125111                printf("%s: Failed allocating device structure for '%s'.\n",
    126                     NAME, pathname);
     112                    NAME, kdev->svc_name);
    127113                return -1;
    128114        }
    129115
    130         kbdev->fd = fd;
    131116        kbdev->sess = sess;
    132117
    133118        exch = async_exchange_begin(sess);
    134119        if (exch == NULL) {
    135                 printf("%s: Failed starting exchange with '%s'.\n", NAME, pathname);
     120                printf("%s: Failed starting exchange with '%s'.\n", NAME,
     121                    kdev->svc_name);
    136122                kbdev_destroy(kbdev);
    137123                return -1;
     
    141127        if (rc != EOK) {
    142128                printf("%s: Failed creating callback connection from '%s'.\n",
    143                     NAME, pathname);
     129                    NAME, kdev->svc_name);
    144130                async_exchange_end(exch);
    145131                kbdev_destroy(kbdev);
Note: See TracChangeset for help on using the changeset viewer.