Changeset df8f3fa in mainline


Ignore:
Timestamp:
2011-08-24T13:32:47Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5fe0a69
Parents:
31bc40e
Message:

Fix: only reset ep if the control transfer was sucessful.

Location:
uspace/lib/usbhost
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r31bc40e rdf8f3fa  
    4141#include <usb/host/batch.h>
    4242#include <usbhc_iface.h>
    43 //#include <driver.h>
    4443
    4544typedef struct hcd hcd_t;
     
    5453        void (*batch_private_dtor)(void *);
    5554};
    56 
     55/*----------------------------------------------------------------------------*/
    5756static inline int hcd_init(hcd_t *hcd, size_t bandwidth)
    5857{
     
    6160        return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth);
    6261}
    63 
     62/*----------------------------------------------------------------------------*/
     63static inline void reset_ep_if_need(
     64    hcd_t *hcd, usb_target_t target, const char* setup_data)
     65{
     66        assert(hcd);
     67        usb_endpoint_manager_reset_if_need(
     68            &hcd->ep_manager, target, (const uint8_t *)setup_data);
     69}
     70/*----------------------------------------------------------------------------*/
    6471static inline hcd_t * fun_to_hcd(ddf_fun_t *fun)
    6572{
     
    6774        return fun->driver_data;
    6875}
    69 
     76/*----------------------------------------------------------------------------*/
    7077extern usbhc_iface_t hcd_iface;
    7178
  • uspace/lib/usbhost/src/batch.c

    r31bc40e rdf8f3fa  
    3838#include <usb/debug.h>
    3939#include <usb/host/batch.h>
     40#include <usb/host/hcd.h>
    4041
    4142void usb_transfer_batch_call_in(usb_transfer_batch_t *instance);
     
    150151            str_error(instance->error));
    151152
     153        if (instance->ep->transfer_type == USB_TRANSFER_CONTROL
     154            && instance->error == EOK) {
     155                usb_target_t target =
     156                    {instance->ep->address, instance->ep->endpoint};
     157                reset_ep_if_need(
     158                    fun_to_hcd(instance->fun), target, instance->setup_buffer);
     159        }
     160
    152161        instance->callback_out(instance->fun,
    153162            instance->error, instance->arg);
  • uspace/lib/usbhost/src/iface.c

    r31bc40e rdf8f3fa  
    117117        assert(address);
    118118
    119         usb_log_debug("Address request with speed %d.\n", speed);
     119        usb_log_debug("Address request speed: %s.\n", usb_str_speed(speed));
    120120        *address = device_keeper_get_free_address(&hcd->dev_manager, speed);
    121121        usb_log_debug("Address request with result: %d.\n", *address);
     
    191191            usb_device_keeper_get_speed(&hcd->dev_manager, address);
    192192        if (speed >= USB_SPEED_MAX) {
     193                // Does this happen?
    193194                speed = ep_speed;
    194195        }
     
    306307        return send_batch(fun, target, USB_DIRECTION_BOTH, data, size,
    307308            setup_data, setup_size, NULL, callback, arg, "Control WRITE");
    308 //      usb_endpoint_manager_reset_if_need(&hc->ep_manager, target, setup_data);
    309309}
    310310/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.