Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/root_hub.c

    r687efaa rc56dbe0  
    3535#include <errno.h>
    3636#include <stdio.h>
     37
    3738#include <usb_iface.h>
     39
    3840#include <usb/debug.h>
    3941
    4042#include "root_hub.h"
     43/*----------------------------------------------------------------------------*/
     44static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
     45{
     46  assert(dev);
     47  assert(dev->parent != NULL);
    4148
    42 extern device_ops_t child_ops;
     49  device_t *parent = dev->parent;
     50
     51  if (parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) {
     52    usb_iface_t *usb_iface
     53        = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE];
     54    assert(usb_iface != NULL);
     55    if (usb_iface->get_hc_handle) {
     56      int rc = usb_iface->get_hc_handle(parent, handle);
     57      return rc;
     58    }
     59  }
     60
     61  return ENOTSUP;
     62}
    4363/*----------------------------------------------------------------------------*/
     64static usb_iface_t usb_iface = {
     65  .get_hc_handle = usb_iface_get_hc_handle
     66};
     67
     68static device_ops_t rh_ops = {
     69        .interfaces[USB_DEV_IFACE] = &usb_iface
     70};
     71
    4472int setup_root_hub(device_t **device, device_t *hc)
    4573{
     
    80108        hub->name = name;
    81109        hub->parent = hc;
    82         hub->ops = &child_ops;
     110        hub->ops = &rh_ops;
    83111
    84112        *device = hub;
Note: See TracChangeset for help on using the changeset viewer.