Changeset a46e56b in mainline for uspace/lib/drv/generic/remote_usbhid.c
- Timestamp:
- 2018-03-22T06:49:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f0a1d
- Parents:
- 3e242d2
- git-author:
- Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhid.c
r3e242d2 ra46e56b 309 309 310 310 void remote_usbhid_get_event_length(ddf_fun_t *fun, void *iface, 311 cap_call_handle_t c allid, ipc_call_t *call)311 cap_call_handle_t chandle, ipc_call_t *call) 312 312 { 313 313 printf("remote_usbhid_get_event_length()\n"); … … 317 317 if (!hid_iface->get_event_length) { 318 318 printf("Get event length not set!\n"); 319 async_answer_0(c allid, ENOTSUP);319 async_answer_0(chandle, ENOTSUP); 320 320 return; 321 321 } … … 325 325 // len = EEMPTY; 326 326 // } 327 async_answer_1(c allid, EOK, len);327 async_answer_1(chandle, EOK, len); 328 328 329 329 // if (len < 0) { 330 // async_answer_0(c allid, len);330 // async_answer_0(chandle, len); 331 331 // } else { 332 // async_answer_1(c allid, EOK, len);332 // async_answer_1(chandle, EOK, len); 333 333 // } 334 334 } 335 335 336 336 void remote_usbhid_get_event(ddf_fun_t *fun, void *iface, 337 cap_call_handle_t c allid, ipc_call_t *call)337 cap_call_handle_t chandle, ipc_call_t *call) 338 338 { 339 339 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 340 340 341 341 if (!hid_iface->get_event) { 342 async_answer_0(c allid, ENOTSUP);342 async_answer_0(chandle, ENOTSUP); 343 343 return; 344 344 } … … 347 347 348 348 size_t len; 349 cap_call_handle_t data_c allid;350 if (!async_data_read_receive(&data_c allid, &len)) {351 async_answer_0(c allid, EPARTY);349 cap_call_handle_t data_chandle; 350 if (!async_data_read_receive(&data_chandle, &len)) { 351 async_answer_0(chandle, EPARTY); 352 352 return; 353 353 } … … 357 357 // } 358 358 if (len == 0) { 359 async_answer_0(data_c allid, EINVAL);360 async_answer_0(c allid, EINVAL);359 async_answer_0(data_chandle, EINVAL); 360 async_answer_0(chandle, EINVAL); 361 361 return; 362 362 } … … 366 366 uint8_t *data = malloc(len); 367 367 if (data == NULL) { 368 async_answer_0(data_c allid, ENOMEM);369 async_answer_0(c allid, ENOMEM);368 async_answer_0(data_chandle, ENOMEM); 369 async_answer_0(chandle, ENOMEM); 370 370 return; 371 371 } … … 376 376 if (rc != EOK) { 377 377 free(data); 378 async_answer_0(data_c allid, rc);379 async_answer_0(c allid, rc);378 async_answer_0(data_chandle, rc); 379 async_answer_0(chandle, rc); 380 380 return; 381 381 } … … 386 386 } 387 387 388 async_data_read_finalize(data_c allid, data, act_length);388 async_data_read_finalize(data_chandle, data, act_length); 389 389 390 390 free(data); 391 391 392 async_answer_1(c allid, EOK, event_nr);392 async_answer_1(chandle, EOK, event_nr); 393 393 } 394 394 395 395 void remote_usbhid_get_report_descriptor_length(ddf_fun_t *fun, void *iface, 396 cap_call_handle_t c allid, ipc_call_t *call)396 cap_call_handle_t chandle, ipc_call_t *call) 397 397 { 398 398 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 399 399 400 400 if (!hid_iface->get_report_descriptor_length) { 401 async_answer_0(c allid, ENOTSUP);401 async_answer_0(chandle, ENOTSUP); 402 402 return; 403 403 } 404 404 405 405 size_t len = hid_iface->get_report_descriptor_length(fun); 406 async_answer_1(c allid, EOK, (sysarg_t) len);406 async_answer_1(chandle, EOK, (sysarg_t) len); 407 407 } 408 408 409 409 void remote_usbhid_get_report_descriptor(ddf_fun_t *fun, void *iface, 410 cap_call_handle_t c allid, ipc_call_t *call)410 cap_call_handle_t chandle, ipc_call_t *call) 411 411 { 412 412 usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface; 413 413 414 414 if (!hid_iface->get_report_descriptor) { 415 async_answer_0(c allid, ENOTSUP);415 async_answer_0(chandle, ENOTSUP); 416 416 return; 417 417 } 418 418 419 419 size_t len; 420 cap_call_handle_t data_c allid;421 if (!async_data_read_receive(&data_c allid, &len)) {422 async_answer_0(c allid, EINVAL);420 cap_call_handle_t data_chandle; 421 if (!async_data_read_receive(&data_chandle, &len)) { 422 async_answer_0(chandle, EINVAL); 423 423 return; 424 424 } 425 425 426 426 if (len == 0) { 427 async_answer_0(data_c allid, EINVAL);428 async_answer_0(c allid, EINVAL);427 async_answer_0(data_chandle, EINVAL); 428 async_answer_0(chandle, EINVAL); 429 429 return; 430 430 } … … 432 432 uint8_t *descriptor = malloc(len); 433 433 if (descriptor == NULL) { 434 async_answer_0(data_c allid, ENOMEM);435 async_answer_0(c allid, ENOMEM);434 async_answer_0(data_chandle, ENOMEM); 435 async_answer_0(chandle, ENOMEM); 436 436 return; 437 437 } … … 445 445 if (rc != EOK) { 446 446 free(descriptor); 447 async_answer_0(data_c allid, rc);448 async_answer_0(c allid, rc);449 return; 450 } 451 452 async_data_read_finalize(data_c allid, descriptor, act_len);453 async_answer_0(c allid, EOK);447 async_answer_0(data_chandle, rc); 448 async_answer_0(chandle, rc); 449 return; 450 } 451 452 async_data_read_finalize(data_chandle, descriptor, act_len); 453 async_answer_0(chandle, EOK); 454 454 455 455 free(descriptor);
Note:
See TracChangeset
for help on using the changeset viewer.