Changeset bba0f1fc in mainline


Ignore:
Timestamp:
2011-09-23T11:50:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6e2938
Parents:
b3433a2
Message:

usbhub: Use generic device requests for hub device features.

According to the specs. ClearHubFeature is equivalent to class specific device request ClearFeature.
Remove unused code.

Location:
uspace/drv/bus/usb/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/usbhub.c

    rb3433a2 rbba0f1fc  
    5959/** Standard get hub global status request */
    6060static const usb_device_request_setup_packet_t get_hub_status_request = {
    61         .index = 0,
    6261        .request_type = USB_HUB_REQ_TYPE_GET_HUB_STATUS,
    6362        .request = USB_HUB_REQUEST_GET_STATUS,
     63        .index = 0,
    6464        .value = 0,
    6565        .length = sizeof(usb_hub_status_t),
     
    441441                 * Just ACK the change.
    442442                 */
    443                 const int opResult = usb_hub_clear_feature(
    444                     control_pipe, USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
     443                const int opResult = usb_request_clear_feature(
     444                    control_pipe, USB_REQUEST_TYPE_CLASS,
     445                    USB_REQUEST_RECIPIENT_DEVICE,
     446                    USB_HUB_FEATURE_C_HUB_LOCAL_POWER, 0);
    445447                if (opResult != EOK) {
    446                         usb_log_error("Cannot clear hub power change flag: "
    447                             "%s\n",
     448                        usb_log_error(
     449                            "Failed to clear hub power change flag: %s.\n",
    448450                            str_error(opResult));
    449451                }
  • uspace/drv/bus/usb/usbhub/utils.h

    rb3433a2 rbba0f1fc  
    5050#include "usbhub.h"
    5151
    52 //************
    53 //
    54 // convenience define for malloc
    55 //
    56 //************
    57 
    58 /**
    59  * Set the device request to be a get hub descriptor request.
    60  * @warning the size is allways set to USB_HUB_MAX_DESCRIPTOR_SIZE
    61  * @param request
    62  * @param addr
    63  */
    64 static inline void usb_hub_set_descriptor_request(
    65     usb_device_request_setup_packet_t *request )
    66 {
    67         request->index = 0;
    68         request->request_type = USB_HUB_REQ_TYPE_GET_DESCRIPTOR;
    69         request->request = USB_HUB_REQUEST_GET_DESCRIPTOR;
    70         request->value_high = USB_DESCTYPE_HUB;
    71         request->value_low = 0;
    72         request->length = USB_HUB_MAX_DESCRIPTOR_SIZE;
    73 }
    74 
    7552/**
    7653 * Clear feature on hub port.
     
    12198}
    12299
    123 /**
    124  * Clear feature on hub port.
    125  *
    126  * @param pipe pipe to hub control endpoint
    127  * @param feature Feature selector
    128  * @return Operation result
    129  */
    130 static inline int usb_hub_clear_feature(usb_pipe_t *pipe,
    131     usb_hub_class_feature_t feature) {
    132 
    133         usb_device_request_setup_packet_t clear_request = {
    134                 .request_type = USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE,
    135                 .request = USB_DEVREQ_CLEAR_FEATURE,
    136                 .length = 0,
    137                 .index = 0
    138         };
    139         clear_request.value = feature;
    140         return usb_pipe_control_write(pipe, &clear_request,
    141             sizeof (clear_request), NULL, 0);
    142 }
    143 
    144 /**
    145  * Clear feature on hub port.
    146  *
    147  * @param pipe pipe to hub control endpoint
    148  * @param feature Feature selector
    149  * @return Operation result
    150  */
    151 static inline int usb_hub_set_feature(usb_pipe_t *pipe,
    152     usb_hub_class_feature_t feature)
    153 {
    154 
    155         usb_device_request_setup_packet_t clear_request = {
    156                 .request_type = USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE,
    157                 .request = USB_DEVREQ_SET_FEATURE,
    158                 .length = 0,
    159                 .index = 0
    160         };
    161         clear_request.value = feature;
    162         return usb_pipe_control_write(pipe, &clear_request,
    163             sizeof (clear_request), NULL, 0);
    164 }
    165 
    166100void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor);
    167101
Note: See TracChangeset for help on using the changeset viewer.