Ignore:
Timestamp:
2011-09-24T14:20:29Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bf76c1
Parents:
867e2555 (diff), 1ab4aca (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/proto/mousedev.c

    r867e2555 r925a21e  
    4444#include <ipc/mouseev.h>
    4545#include <input.h>
     46#include <loc.h>
    4647#include <mouse.h>
    4748#include <mouse_port.h>
    4849#include <mouse_proto.h>
     50#include <sys/typefmt.h>
    4951
    5052/** Mousedev softstate */
     
    5557        /** Session to mouse device */
    5658        async_sess_t *sess;
    57        
    58         /** File descriptor of open mousedev device */
    59         int fd;
    6059} mousedev_t;
    6160
     
    6766       
    6867        mousedev->mouse_dev = mdev;
    69         mousedev->fd = -1;
    7068       
    7169        return mousedev;
     
    7674        if (mousedev->sess != NULL)
    7775                async_hangup(mousedev->sess);
    78        
    79         if (mousedev->fd >= 0)
    80                 close(mousedev->fd);
    8176       
    8277        free(mousedev);
     
    122117static int mousedev_proto_init(mouse_dev_t *mdev)
    123118{
    124         const char *pathname = mdev->dev_path;
    125        
    126         int fd = open(pathname, O_RDWR);
    127         if (fd < 0)
    128                 return -1;
    129        
    130         async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd);
     119        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE,
     120            mdev->svc_id, 0);
    131121        if (sess == NULL) {
    132                 printf("%s: Failed starting session with '%s'\n", NAME, pathname);
    133                 close(fd);
     122                printf("%s: Failed starting session with '%s'\n", NAME,
     123                    mdev->svc_name);
    134124                return -1;
    135125        }
     
    138128        if (mousedev == NULL) {
    139129                printf("%s: Failed allocating device structure for '%s'.\n",
    140                     NAME, pathname);
     130                    NAME, mdev->svc_name);
    141131                return -1;
    142132        }
    143133       
    144         mousedev->fd = fd;
    145134        mousedev->sess = sess;
    146135       
    147136        async_exch_t *exch = async_exchange_begin(sess);
    148137        if (exch == NULL) {
    149                 printf("%s: Failed starting exchange with '%s'.\n", NAME, pathname);
     138                printf("%s: Failed starting exchange with '%s'.\n", NAME,
     139                    mdev->svc_name);
    150140                mousedev_destroy(mousedev);
    151141                return -1;
     
    157147        if (rc != EOK) {
    158148                printf("%s: Failed creating callback connection from '%s'.\n",
    159                     NAME, pathname);
     149                    NAME, mdev->svc_name);
    160150                mousedev_destroy(mousedev);
    161151                return -1;
Note: See TracChangeset for help on using the changeset viewer.