Changes in uspace/drv/char/xtkbd/xtkbd.c [56fd7cf:75751db6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/xtkbd/xtkbd.c
r56fd7cf r75751db6 36 36 #include <ddf/log.h> 37 37 #include <io/keycode.h> 38 #include <io/chardev.h> 38 39 #include <io/console.h> 39 40 #include <ipc/kbdev.h> 40 41 #include <abi/ipc/methods.h> 41 42 42 #include "chardev.h"43 43 #include "xtkbd.h" 44 44 … … 159 159 static const int scanmap_e0[] = { 160 160 [0x38] = KC_RALT, 161 [0x1d] = KC_R SHIFT,161 [0x1d] = KC_RCTRL, 162 162 163 163 [0x37] = KC_PRTSCR, … … 199 199 * @param dev DDF device structure. 200 200 * 201 * Connects to parent, creates mousefunction, starts polling fibril.201 * Connects to parent, creates keyboard function, starts polling fibril. 202 202 */ 203 203 int xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev) … … 207 207 kbd->client_sess = NULL; 208 208 kbd->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 209 if (!kbd->parent_sess) 210 return ENOMEM; 209 if (!kbd->parent_sess) { 210 ddf_msg(LVL_ERROR, "Failed creating parent session."); 211 return EIO; 212 } 211 213 212 214 kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd"); 213 215 if (!kbd->kbd_fun) { 216 ddf_msg(LVL_ERROR, "Failed creating function 'kbd'."); 214 217 return ENOMEM; 215 218 } … … 218 221 int ret = ddf_fun_bind(kbd->kbd_fun); 219 222 if (ret != EOK) { 223 ddf_msg(LVL_ERROR, "Failed binding function 'kbd'."); 220 224 ddf_fun_destroy(kbd->kbd_fun); 221 return E NOMEM;225 return EEXIST; 222 226 } 223 227 224 228 ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard"); 225 229 if (ret != EOK) { 230 ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category " 231 "'keyboard'."); 226 232 ddf_fun_unbind(kbd->kbd_fun); 227 233 ddf_fun_destroy(kbd->kbd_fun); … … 231 237 kbd->polling_fibril = fibril_create(polling, kbd); 232 238 if (!kbd->polling_fibril) { 239 ddf_msg(LVL_ERROR, "Failed creating polling fibril."); 233 240 ddf_fun_unbind(kbd->kbd_fun); 234 241 ddf_fun_destroy(kbd->kbd_fun); 235 242 return ENOMEM; 236 243 } 244 237 245 fibril_add_ready(kbd->polling_fibril); 238 246 return EOK; … … 241 249 /** Get data and parse scancodes. 242 250 * @param arg Pointer to xt_kbd_t structure. 243 * @return Never.251 * @return EIO on error. 244 252 */ 245 253 int polling(void *arg) … … 259 267 uint8_t code = 0; 260 268 ssize_t size = chardev_read(parent_exch, &code, 1); 269 if (size != 1) 270 return EIO; 261 271 262 272 /** Ignore AT command reply */ … … 269 279 map_size = sizeof(scanmap_e0) / sizeof(int); 270 280 size = chardev_read(parent_exch, &code, 1); 281 if (size != 1) 282 return EIO; 283 271 284 // TODO handle print screen 272 285 } 273 274 /* Invalid read. */275 if (size != 1) {276 continue;277 }278 279 286 280 287 /* Bit 7 indicates press/release */
Note:
See TracChangeset
for help on using the changeset viewer.