Changeset 925a21e in mainline for uspace/srv/hid/input/proto/mousedev.c
- Timestamp:
- 2011-09-24T14:20:29Z (13 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/proto/mousedev.c
r867e2555 r925a21e 44 44 #include <ipc/mouseev.h> 45 45 #include <input.h> 46 #include <loc.h> 46 47 #include <mouse.h> 47 48 #include <mouse_port.h> 48 49 #include <mouse_proto.h> 50 #include <sys/typefmt.h> 49 51 50 52 /** Mousedev softstate */ … … 55 57 /** Session to mouse device */ 56 58 async_sess_t *sess; 57 58 /** File descriptor of open mousedev device */59 int fd;60 59 } mousedev_t; 61 60 … … 67 66 68 67 mousedev->mouse_dev = mdev; 69 mousedev->fd = -1;70 68 71 69 return mousedev; … … 76 74 if (mousedev->sess != NULL) 77 75 async_hangup(mousedev->sess); 78 79 if (mousedev->fd >= 0)80 close(mousedev->fd);81 76 82 77 free(mousedev); … … 122 117 static int mousedev_proto_init(mouse_dev_t *mdev) 123 118 { 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); 131 121 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); 134 124 return -1; 135 125 } … … 138 128 if (mousedev == NULL) { 139 129 printf("%s: Failed allocating device structure for '%s'.\n", 140 NAME, pathname);130 NAME, mdev->svc_name); 141 131 return -1; 142 132 } 143 133 144 mousedev->fd = fd;145 134 mousedev->sess = sess; 146 135 147 136 async_exch_t *exch = async_exchange_begin(sess); 148 137 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); 150 140 mousedev_destroy(mousedev); 151 141 return -1; … … 157 147 if (rc != EOK) { 158 148 printf("%s: Failed creating callback connection from '%s'.\n", 159 NAME, pathname);149 NAME, mdev->svc_name); 160 150 mousedev_destroy(mousedev); 161 151 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.