Changes in uspace/srv/hid/input/ctl/kbdev.c [854eddd6:cce8a83] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/input/ctl/kbdev.c
r854eddd6 rcce8a83 48 48 #include <kbd_ctl.h> 49 49 #include <kbd_port.h> 50 #include <loc.h> 50 51 #include <stdlib.h> 51 52 #include <vfs/vfs_sess.h> 52 53 #include <sys/typefmt.h> 53 54 54 55 static int kbdev_ctl_init(kbd_dev_t *); 55 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned );56 static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned int); 56 57 57 58 static void kbdev_callback_conn(ipc_callid_t, ipc_call_t *, void *arg); 58 59 59 60 kbd_ctl_ops_t kbdev_ctl = { 60 .parse _scancode= NULL,61 .parse = NULL, 61 62 .init = kbdev_ctl_init, 62 63 .set_ind = kbdev_ctl_set_ind … … 70 71 /** Session with kbdev device */ 71 72 async_sess_t *sess; 72 73 /** File descriptor of open kbdev device */74 int fd;75 73 } kbdev_t; 76 74 … … 84 82 85 83 kbdev->kbd_dev = kdev; 86 kbdev->fd = -1;87 84 88 85 return kbdev; … … 93 90 if (kbdev->sess != NULL) 94 91 async_hangup(kbdev->sess); 95 if (kbdev->fd >= 0)96 close(kbdev->fd);97 92 free(kbdev); 98 93 } … … 100 95 static int kbdev_ctl_init(kbd_dev_t *kdev) 101 96 { 102 const char *pathname;103 97 async_sess_t *sess; 104 98 async_exch_t *exch; 105 99 kbdev_t *kbdev; 106 int fd;107 100 int rc; 108 101 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); 117 103 if (sess == NULL) { 118 printf( NAME ": Failed starting session with '%s'\n", pathname);119 close(fd);104 printf("%s: Failed starting session with '%s.'\n", NAME, 105 kdev->svc_name); 120 106 return -1; 121 107 } … … 123 109 kbdev = kbdev_new(kdev); 124 110 if (kbdev == NULL) { 125 printf( NAME ": Failed allocating device structure for '%s'.\n",126 pathname);111 printf("%s: Failed allocating device structure for '%s'.\n", 112 NAME, kdev->svc_name); 127 113 return -1; 128 114 } 129 115 130 kbdev->fd = fd;131 116 kbdev->sess = sess; 132 117 133 118 exch = async_exchange_begin(sess); 134 119 if (exch == NULL) { 135 printf(NAME ": Failed starting exchange with '%s'.\n", pathname); 120 printf("%s: Failed starting exchange with '%s'.\n", NAME, 121 kdev->svc_name); 136 122 kbdev_destroy(kbdev); 137 123 return -1; … … 140 126 rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev); 141 127 if (rc != EOK) { 142 printf( NAME ": Failed creating callback connection from '%s'.\n",143 pathname);128 printf("%s: Failed creating callback connection from '%s'.\n", 129 NAME, kdev->svc_name); 144 130 async_exchange_end(exch); 145 131 kbdev_destroy(kbdev); … … 193 179 type = IPC_GET_ARG1(call); 194 180 key = IPC_GET_ARG2(call); 195 kbd_push_ev (kbdev->kbd_dev, type, key);181 kbd_push_event(kbdev->kbd_dev, type, key); 196 182 break; 197 183 default:
Note:
See TracChangeset
for help on using the changeset viewer.