Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3a8370c in mainline


Ignore:
Timestamp:
2011-09-13T13:30:28Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
7eb32a8
Parents:
4cbb6e4
Message:

libdrv: usbhc: use generic read/write for control transfers

File:
1 edited

Legend:

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

    r4cbb6e4 r3a8370c  
    393393        assert(usb_iface != NULL);
    394394
    395         if (!usb_iface->control_write) {
     395        if (!usb_iface->write) {
    396396                async_answer_0(callid, ENOTSUP);
    397397                return;
     
    434434                return;
    435435        }
    436         trans->setup_packet = setup_packet;
    437436        trans->buffer = data_buffer;
    438437        trans->size = data_buffer_len;
    439438
    440         rc = usb_iface->control_write(fun, target,
    441             setup_packet, setup_packet_len,
    442             data_buffer, data_buffer_len,
    443             callback_out, trans);
     439        assert(setup_packet_len == 8);
     440        uint64_t setup_buffer;
     441        memcpy(&setup_buffer, setup_packet, 8);
     442        free(setup_packet);
     443        rc = usb_iface->write(fun, target, setup_buffer, trans->buffer,
     444            trans->size, callback_out, trans);
    444445
    445446        if (rc != EOK) {
     
    456457        assert(usb_iface != NULL);
    457458
    458         if (!usb_iface->control_read) {
     459        if (!usb_iface->read) {
    459460                async_answer_0(callid, ENOTSUP);
    460461                return;
     
    494495        }
    495496        trans->data_caller = data_callid;
    496         trans->setup_packet = setup_packet;
    497497        trans->size = data_len;
    498498        trans->buffer = malloc(data_len);
     
    504504        }
    505505
    506         rc = usb_iface->control_read(fun, target,
    507             setup_packet, setup_packet_len,
    508             trans->buffer, trans->size,
    509             callback_in, trans);
    510 
     506        assert(setup_packet_len == 8);
     507        uint64_t setup_buffer;
     508        memcpy(&setup_buffer, setup_packet, 8);
     509        free(setup_packet);
     510        rc = usb_iface->read(fun, target, setup_buffer, trans->buffer,
     511            trans->size, callback_in, trans);
    511512        if (rc != EOK) {
    512513                async_answer_0(data_callid, rc);
Note: See TracChangeset for help on using the changeset viewer.