Changeset b3433a2 in mainline


Ignore:
Timestamp:
2011-09-23T10:17:25Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bba0f1fc
Parents:
8d3cd30
Message:

usbhub: Create GET_PORT_STATUS request inline isntead of creation function.

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

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port_status.h

    r8d3cd30 rb3433a2  
    6969
    7070/**
    71  * set values in request to be it a port status request
    72  * @param request
    73  * @param port
    74  */
    75 static inline void usb_hub_set_port_status_request(
    76     usb_device_request_setup_packet_t *request, uint16_t port)
    77 {
    78         request->index = port;
    79         request->request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS;
    80         request->request = USB_HUB_REQUEST_GET_STATUS;
    81         request->value = 0;
    82         request->length = 4;
    83 }
    84 
    85 /**
    86  * create request for usb hub port status
    87  * @param port
    88  * @return
    89  */
    90 static inline usb_device_request_setup_packet_t *
    91     usb_hub_create_port_status_request(uint16_t port)
    92 {
    93         usb_device_request_setup_packet_t *result =
    94             malloc(sizeof(usb_device_request_setup_packet_t));
    95         usb_hub_set_port_status_request(result, port);
    96         return result;
    97 }
    98 
    99 /**
    10071 * set the device request to be a port feature enable request
    10172 * @param request
  • uspace/drv/bus/usb/usbhub/ports.c

    r8d3cd30 rb3433a2  
    9898{
    9999        usb_log_debug("Interrupt at port %zu\n", (size_t) port);
    100         //determine type of change
    101         //usb_pipe_t *pipe = hub->control_pipe;
    102 
    103         int opResult;
    104100
    105101        usb_port_status_t status;
    106         opResult = get_port_status(&hub->usb_device->ctrl_pipe, port, &status);
     102        const int opResult =
     103            get_port_status(&hub->usb_device->ctrl_pipe, port, &status);
    107104        if (opResult != EOK) {
    108105                usb_log_error("Failed to get port %zu status: %s.\n",
     
    119116
    120117                if (device_connected) {
    121                         opResult = create_add_device_fibril(hub, port,
     118                        const int opResult = create_add_device_fibril(hub, port,
    122119                            usb_port_speed(status));
    123120                        if (opResult != EOK) {
     
    300297 */
    301298static int get_port_status(usb_pipe_t *ctrl_pipe, size_t port,
    302     usb_port_status_t *status) {
     299    usb_port_status_t *status)
     300{
    303301        size_t recv_size;
    304         usb_device_request_setup_packet_t request;
    305302        usb_port_status_t status_tmp;
    306 
    307         usb_hub_set_port_status_request(&request, port);
    308         int rc = usb_pipe_control_read(ctrl_pipe,
    309             &request, sizeof (usb_device_request_setup_packet_t),
    310             &status_tmp, sizeof (status_tmp), &recv_size);
     303        /* USB hub specific GET_PORT_STATUS request. See USB Spec 11.16.2.6 */
     304        const usb_device_request_setup_packet_t request = {
     305                .request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS,
     306                .request = USB_HUB_REQUEST_GET_STATUS,
     307                .value = 0,
     308                .index = port,
     309                .length = sizeof(usb_port_status_t),
     310        };
     311
     312        const int rc = usb_pipe_control_read(ctrl_pipe,
     313            &request, sizeof(usb_device_request_setup_packet_t),
     314            &status_tmp, sizeof(status_tmp), &recv_size);
    311315        if (rc != EOK) {
    312316                return rc;
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r8d3cd30 rb3433a2  
    234234 * @return error code
    235235 */
    236 int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info)
     236static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info)
    237237{
    238238        assert(hub_info);
  • uspace/drv/bus/usb/usbhub/utils.h

    r8d3cd30 rb3433a2  
    5555//
    5656//************
    57 
    58 
    59 usb_hub_info_t * usb_create_hub_info(ddf_dev_t * device);
    6057
    6158/**
Note: See TracChangeset for help on using the changeset viewer.