Changeset b4b534ac in mainline for uspace/drv/bus/usb/vhc/hub


Ignore:
Timestamp:
2016-07-22T08:24:47Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f76d2c2
Parents:
5b18137 (diff), 8351f9a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jan.vesely/helenos/usb

Location:
uspace/drv/bus/usb/vhc/hub
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/hub/virthub.c

    r5b18137 rb4b534ac  
    3434 */
    3535#include <usb/classes/classes.h>
     36#include <usb/classes/hub.h>
    3637#include <usbvirt/device.h>
    3738#include <assert.h>
    3839#include <errno.h>
    3940#include <str_error.h>
     41#include <stdio.h>
    4042#include <stdlib.h>
    4143#include <ddf/driver.h>
     
    7577        .type = USB_DESCTYPE_HUB,
    7678        .port_count = HUB_PORT_COUNT,
    77         .characteristics = 0,
     79        .characteristics = HUB_CHAR_NO_POWER_SWITCH_FLAG | HUB_CHAR_NO_OC_FLAG,
    7880        .power_on_warm_up = 50, /* Huh? */
    7981        .max_current = 100, /* Huh again. */
     
    9698        .length = sizeof(usb_standard_configuration_descriptor_t),
    9799        .descriptor_type = USB_DESCTYPE_CONFIGURATION,
    98         .total_length = 
     100        .total_length =
    99101                sizeof(usb_standard_configuration_descriptor_t)
    100102                + sizeof(std_interface_descriptor)
     
    144146 * @return Error code.
    145147 */
    146 int virthub_init(usbvirt_device_t *dev)
     148int virthub_init(usbvirt_device_t *dev, const char* name)
    147149{
    148150        if (dev == NULL) {
     
    151153        dev->ops = &hub_ops;
    152154        dev->descriptors = &descriptors;
     155        dev->address = 0;
     156        dev->name = str_dup(name);
     157        if (!dev->name)
     158                return ENOMEM;
    153159
    154160        hub_t *hub = malloc(sizeof(hub_t));
    155161        if (hub == NULL) {
     162                free(dev->name);
    156163                return ENOMEM;
    157164        }
  • uspace/drv/bus/usb/vhc/hub/virthub.h

    r5b18137 rb4b534ac  
    7979extern hub_descriptor_t hub_descriptor;
    8080
    81 int virthub_init(usbvirt_device_t *);
     81int virthub_init(usbvirt_device_t *, const char *name);
    8282int virthub_connect_device(usbvirt_device_t *, vhc_virtdev_t *);
    8383int virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
  • uspace/drv/bus/usb/vhc/hub/virthubops.c

    r5b18137 rb4b534ac  
    340340
    341341
    342 /** IN class request. */
    343 #define CLASS_REQ_IN(recipient) \
    344         USBVIRT_MAKE_CONTROL_REQUEST_TYPE(USB_DIRECTION_IN, \
    345         USBVIRT_REQUEST_TYPE_CLASS, recipient)
    346 /** OUT class request. */
    347 #define CLASS_REQ_OUT(recipient) \
    348         USBVIRT_MAKE_CONTROL_REQUEST_TYPE(USB_DIRECTION_OUT, \
    349         USBVIRT_REQUEST_TYPE_CLASS, recipient)
    350342
    351343/** Recipient: other. */
     
    353345/** Recipient: device. */
    354346#define REC_DEVICE USB_REQUEST_RECIPIENT_DEVICE
    355 /** Direction: in. */
    356 #define DIR_IN USB_DIRECTION_IN
    357 /** Direction: out. */
    358 #define DIR_OUT USB_DIRECTION_OUT
    359 
    360 
    361 /** Create a class request.
    362  *
    363  * @param direction Request direction.
    364  * @param recipient Request recipient.
    365  * @param req Request code.
    366  */
    367 #define CLASS_REQ(direction, recipient, req) \
    368         .req_direction = direction, \
    369         .req_recipient = recipient, \
    370         .req_type = USB_REQUEST_TYPE_CLASS, \
    371         .request = req
    372 
    373 /** Create a standard request.
    374  *
    375  * @param direction Request direction.
    376  * @param recipient Request recipient.
    377  * @param req Request code.
    378  */
    379 #define STD_REQ(direction, recipient, req) \
    380         .req_direction = direction, \
    381         .req_recipient = recipient, \
    382         .req_type = USB_REQUEST_TYPE_STANDARD, \
    383         .request = req
     347
    384348
    385349/** Hub operations on control endpoint zero. */
    386350static usbvirt_control_request_handler_t endpoint_zero_handlers[] = {
    387351        {
    388                 STD_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    389                 .name = "GetDescriptor",
     352                STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     353                .name = "GetStdDescriptor",
    390354                .callback = req_get_descriptor
    391355        },
    392356        {
    393                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    394                 .name = "GetDescriptor",
     357                CLASS_REQ_IN(REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     358                .name = "GetClassDescriptor",
    395359                .callback = req_get_descriptor
    396360        },
    397361        {
    398                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
     362                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
    399363                .name = "GetPortStatus",
    400364                .callback = req_get_port_status
    401365        },
    402366        {
    403                 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
     367                CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
    404368                .name = "ClearHubFeature",
    405369                .callback = req_clear_hub_feature
    406370        },
    407371        {
    408                 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
     372                CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
    409373                .name = "ClearPortFeature",
    410374                .callback = req_clear_port_feature
    411375        },
    412376        {
    413                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATE),
     377                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATE),
    414378                .name = "GetBusState",
    415379                .callback = req_get_bus_state
    416380        },
    417381        {
    418                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
     382                CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
    419383                .name = "GetHubDescriptor",
    420384                .callback = req_get_descriptor
    421385        },
    422386        {
    423                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),
     387                CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),
    424388                .name = "GetHubStatus",
    425389                .callback = req_get_hub_status
    426390        },
    427391        {
    428                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
     392                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
    429393                .name = "GetPortStatus",
    430394                .callback = req_get_port_status
    431395        },
    432396        {
    433                 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
     397                CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
    434398                .name = "SetHubFeature",
    435399                .callback = req_set_hub_feature
    436400        },
    437401        {
    438                 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),
     402                CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),
    439403                .name = "SetPortFeature",
    440404                .callback = req_set_port_feature
Note: See TracChangeset for help on using the changeset viewer.