Ignore:
Timestamp:
2011-09-14T20:15:03Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bbce2c2
Parents:
365e29e2
Message:

usb: Send any setup data during initial opening call.

NOTE: receiving function uses those parameters even if they were not sent, this is rather ugly but it does not matter, because any value that might appear in setup data will be ignored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    r365e29e2 rbdd8ad2f  
    230230ipc_callid_t callid, ipc_call_t *call)
    231231{
     232        assert(false);
    232233        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    233234        assert(usb_iface != NULL);
     
    291292ipc_callid_t callid, ipc_call_t *call)
    292293{
     294        assert(false);
    293295        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
    294296        assert(usb_iface != NULL);
     
    388390#undef _INIT_FROM_LOW_DATA3
    389391
    390         int rc = usb_iface->register_endpoint(fun, target.address,
    391             speed, target.endpoint,
    392             transfer_type, direction, max_packet_size, interval);
     392        int rc = usb_iface->register_endpoint(fun, target.address, speed,
     393            target.endpoint, transfer_type, direction, max_packet_size, interval);
    393394
    394395        async_answer_0(callid, rc);
     
    431432
    432433        const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
     434        const uint64_t setup =
     435            ((uint64_t)DEV_IPC_GET_ARG2(*call)) |
     436            (((uint64_t)DEV_IPC_GET_ARG3(*call)) << 32);
    433437
    434438        async_transaction_t *trans = async_transaction_create(callid);
     
    451455
    452456        const int rc = hc_iface->read(
    453             fun, target, 0, trans->buffer, trans->size, callback_in, trans);
     457            fun, target, setup, trans->buffer, trans->size, callback_in, trans);
    454458
    455459        if (rc != EOK) {
     
    475479
    476480        const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
     481        const size_t data_buffer_len = DEV_IPC_GET_ARG2(*call);
     482        const uint64_t setup =
     483            ((uint64_t)DEV_IPC_GET_ARG3(*call)) |
     484            (((uint64_t)DEV_IPC_GET_ARG4(*call)) << 32);
    477485
    478486        async_transaction_t *trans = async_transaction_create(callid);
     
    482490        }
    483491
    484         int rc = async_data_write_accept(&trans->buffer, false,
    485             1, USB_MAX_PAYLOAD_SIZE,
    486             0, &trans->size);
    487 
    488         if (rc != EOK) {
    489                 async_answer_0(callid, rc);
    490                 async_transaction_destroy(trans);
    491                 return;
    492         }
    493 
    494         rc = hc_iface->write(
    495             fun, target, 0, trans->buffer, trans->size, callback_out, trans);
     492        if (data_buffer_len > 0) {
     493                int rc = async_data_write_accept(&trans->buffer, false,
     494                    1, USB_MAX_PAYLOAD_SIZE,
     495                    0, &trans->size);
     496
     497                if (rc != EOK) {
     498                        async_answer_0(callid, rc);
     499                        async_transaction_destroy(trans);
     500                        return;
     501                }
     502        }
     503
     504        int rc = hc_iface->write(
     505            fun, target, setup, trans->buffer, trans->size, callback_out, trans);
    496506
    497507        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.