Changeset a35b458 in mainline for uspace/drv/hid/atkbd/atkbd.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/atkbd/atkbd.c
r3061bc1 ra35b458 205 205 size_t nwr; 206 206 errno_t rc; 207 207 208 208 while (true) { 209 209 uint8_t code = 0; … … 211 211 if (rc != EOK) 212 212 return EIO; 213 213 214 214 const unsigned int *map; 215 215 size_t map_size; 216 216 217 217 if (code == KBD_SCANCODE_SET_EXTENDED) { 218 218 map = scanmap_e0; 219 219 map_size = sizeof(scanmap_e0) / sizeof(unsigned int); 220 220 221 221 rc = chardev_read(kbd->chardev, &code, 1, &nwr); 222 222 if (rc != EOK) … … 270 270 map_size = sizeof(scanmap_simple) / sizeof(unsigned int); 271 271 } 272 272 273 273 kbd_event_type_t type; 274 274 if (code == KBD_SCANCODE_KEY_RELEASE) { … … 280 280 type = KEY_PRESS; 281 281 } 282 282 283 283 const unsigned int key = (code < map_size) ? map[code] : 0; 284 284 285 285 if (key != 0) 286 286 push_event(kbd->client_sess, type, key); … … 315 315 async_sess_t *sess = 316 316 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); 317 317 318 318 /* Probably ENOMEM error, try again. */ 319 319 if (sess == NULL) { … … 323 323 break; 324 324 } 325 325 326 326 if (kbd->client_sess == NULL) { 327 327 kbd->client_sess = sess; … … 332 332 async_answer_0(icallid, ELIMIT); 333 333 } 334 334 335 335 break; 336 336 } … … 359 359 async_sess_t *parent_sess; 360 360 errno_t rc; 361 361 362 362 assert(kbd); 363 363 assert(dev); 364 364 365 365 kbd->client_sess = NULL; 366 366 parent_sess = ddf_dev_parent_sess_get(dev); … … 370 370 goto error; 371 371 } 372 372 373 373 rc = chardev_open(parent_sess, &kbd->chardev); 374 374 if (rc != EOK) { … … 376 376 return EIO; 377 377 } 378 378 379 379 kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd"); 380 380 if (!kbd->kbd_fun) { … … 382 382 return ENOMEM; 383 383 } 384 384 385 385 ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops); 386 386 387 387 errno_t ret = ddf_fun_bind(kbd->kbd_fun); 388 388 if (ret != EOK) { … … 391 391 return EEXIST; 392 392 } 393 393 394 394 ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard"); 395 395 if (ret != EOK) { … … 400 400 return ENOMEM; 401 401 } 402 402 403 403 kbd->polling_fibril = fibril_create(polling, kbd); 404 404 if (!kbd->polling_fibril) { … … 408 408 return ENOMEM; 409 409 } 410 410 411 411 fibril_add_ready(kbd->polling_fibril); 412 412 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.