Ignore:
File:
1 edited

Legend:

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

    r5842493 rec59693  
    4040
    4141#define USB_MAX_PAYLOAD_SIZE 1020
     42#define HACK_MAX_PACKET_SIZE 8
     43#define HACK_MAX_PACKET_SIZE_INTERRUPT_IN 4
    4244
    4345static void remote_usbhc_get_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     
    240242
    241243static void callback_out(device_t *device,
    242     usb_transaction_outcome_t outcome, void *arg)
     244    int outcome, void *arg)
    243245{
    244246        async_transaction_t *trans = (async_transaction_t *)arg;
     
    250252
    251253static void callback_in(device_t *device,
    252     usb_transaction_outcome_t outcome, size_t actual_size, void *arg)
     254    int outcome, size_t actual_size, void *arg)
    253255{
    254256        async_transaction_t *trans = (async_transaction_t *)arg;
    255257
    256         if (outcome != USB_OUTCOME_OK) {
     258        if (outcome != EOK) {
    257259                async_answer_0(trans->caller, outcome);
    258260                if (trans->data_caller) {
     
    270272        }
    271273
    272         async_answer_0(trans->caller, USB_OUTCOME_OK);
     274        async_answer_0(trans->caller, EOK);
    273275
    274276        async_transaction_destroy(trans);
     
    322324        trans->size = len;
    323325
    324         int rc = transfer_func(device, target, buffer, len,
     326        int rc = transfer_func(device, target, HACK_MAX_PACKET_SIZE,
     327            buffer, len,
    325328            callback_out, trans);
    326329
     
    368371        trans->size = len;
    369372
    370         int rc = transfer_func(device, target, trans->buffer, len,
     373        int rc = transfer_func(device, target, HACK_MAX_PACKET_SIZE_INTERRUPT_IN,
     374            trans->buffer, len,
    371375            callback_in, trans);
    372376
     
    540544                .endpoint = DEV_IPC_GET_ARG2(*call)
    541545        };
     546        size_t data_buffer_len = DEV_IPC_GET_ARG3(*call);
    542547
    543548        int rc;
     
    546551        void *data_buffer = NULL;
    547552        size_t setup_packet_len = 0;
    548         size_t data_buffer_len = 0;
    549553
    550554        rc = async_data_write_accept(&setup_packet, false,
     
    554558                return;
    555559        }
    556         rc = async_data_write_accept(&data_buffer, false,
    557             1, USB_MAX_PAYLOAD_SIZE, 0, &data_buffer_len);
    558         if (rc != EOK) {
    559                 async_answer_0(callid, rc);
    560                 free(setup_packet);
    561                 return;
     560
     561        if (data_buffer_len > 0) {
     562                rc = async_data_write_accept(&data_buffer, false,
     563                    1, USB_MAX_PAYLOAD_SIZE, 0, &data_buffer_len);
     564                if (rc != EOK) {
     565                        async_answer_0(callid, rc);
     566                        free(setup_packet);
     567                        return;
     568                }
    562569        }
    563570
     
    573580        trans->size = data_buffer_len;
    574581
    575         rc = usb_iface->control_write(device, target,
     582        rc = usb_iface->control_write(device, target, HACK_MAX_PACKET_SIZE,
    576583            setup_packet, setup_packet_len,
    577584            data_buffer, data_buffer_len,
     
    596603        }
    597604
    598         size_t data_len = DEV_IPC_GET_ARG3(*call);
    599605        usb_target_t target = {
    600606                .address = DEV_IPC_GET_ARG1(*call),
     
    606612        void *setup_packet = NULL;
    607613        size_t setup_packet_len = 0;
     614        size_t data_len = 0;
    608615
    609616        rc = async_data_write_accept(&setup_packet, false,
     
    637644        }
    638645
    639         rc = usb_iface->control_read(device, target,
     646        rc = usb_iface->control_read(device, target, HACK_MAX_PACKET_SIZE,
    640647            setup_packet, setup_packet_len,
    641648            trans->buffer, trans->size,
Note: See TracChangeset for help on using the changeset viewer.