Changeset 327f147 in mainline for uspace/lib/drv/generic/remote_usb.c
- Timestamp:
- 2017-10-23T19:03:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b724494
- Parents:
- e160bfe8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usb.c
re160bfe8 r327f147 38 38 #include <errno.h> 39 39 #include <devman.h> 40 #include <usb/host/usb_transfer_batch.h> 40 41 41 42 #include "usb_iface.h" … … 539 540 } 540 541 541 static void callback_out(int outcome, void *arg)542 { 543 async_transaction_t *trans = arg;544 545 async_answer_0(trans->caller, outcome);542 static int callback_out(usb_transfer_batch_t *batch) 543 { 544 async_transaction_t *trans = batch->on_complete_data; 545 546 const int err = async_answer_0(trans->caller, batch->error); 546 547 547 548 async_transaction_destroy(trans); 548 } 549 550 static void callback_in(int outcome, size_t actual_size, void *arg) 551 { 552 async_transaction_t *trans = (async_transaction_t *)arg; 553 554 if (outcome != EOK) { 555 async_answer_0(trans->caller, outcome); 556 if (trans->data_caller) { 549 550 return err; 551 } 552 553 static int callback_in(usb_transfer_batch_t *batch) 554 { 555 async_transaction_t *trans = batch->on_complete_data; 556 557 if (trans->data_caller) { 558 if (batch->error == EOK) { 559 batch->error = async_data_read_finalize(trans->data_caller, 560 trans->buffer, batch->transfered_size); 561 } else { 557 562 async_answer_0(trans->data_caller, EINTR); 558 563 } 559 async_transaction_destroy(trans); 560 return; 561 } 562 563 if (trans->data_caller) { 564 async_data_read_finalize(trans->data_caller, 565 trans->buffer, actual_size); 566 } 567 568 async_answer_0(trans->caller, EOK); 569 564 } 565 566 const int err = async_answer_0(trans->caller, batch->error); 570 567 async_transaction_destroy(trans); 568 return err; 571 569 } 572 570 … … 611 609 } 612 610 611 const usb_target_t target = {{ 612 /* .address is initialized by read itself */ 613 .endpoint = ep, 614 }}; 615 613 616 const int rc = usb_iface->read( 614 fun, ep, setup, trans->buffer, size, callback_in, trans);617 fun, target, setup, trans->buffer, size, callback_in, trans); 615 618 616 619 if (rc != EOK) { … … 659 662 } 660 663 664 const usb_target_t target = {{ 665 /* .address is initialized by write itself */ 666 .endpoint = ep, 667 }}; 668 661 669 const int rc = usb_iface->write( 662 fun, ep, setup, trans->buffer, size, callback_out, trans);670 fun, target, setup, trans->buffer, size, callback_out, trans); 663 671 664 672 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.