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