Changeset bd5f3b7 in mainline for uspace/srv/hid/input/ctl/kbdev.c
- Timestamp:
- 2011-08-21T13:07:35Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00aece0, f1a9e87
- Parents:
- 86a34d3e (diff), a6480d5 (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/ctl/kbdev.c
r86a34d3e rbd5f3b7 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 *); … … 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("%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); 120 106 return -1; 121 107 } … … 124 110 if (kbdev == NULL) { 125 111 printf("%s: Failed allocating device structure for '%s'.\n", 126 NAME, pathname);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("%s: Failed starting exchange with '%s'.\n", NAME, pathname); 120 printf("%s: Failed starting exchange with '%s'.\n", NAME, 121 kdev->svc_name); 136 122 kbdev_destroy(kbdev); 137 123 return -1; … … 141 127 if (rc != EOK) { 142 128 printf("%s: Failed creating callback connection from '%s'.\n", 143 NAME, pathname);129 NAME, kdev->svc_name); 144 130 async_exchange_end(exch); 145 131 kbdev_destroy(kbdev);
Note:
See TracChangeset
for help on using the changeset viewer.