Changeset 92574f4 in mainline for uspace/drv/vhc/hub.c


Ignore:
Timestamp:
2011-02-24T12:03:27Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7b7ebd5
Parents:
4837092 (diff), a80849c (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:

Merged development (changes in DDF, etc.).

Conflicts in uspace/drv/usbkbd/main.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/hub.c

    r4837092 r92574f4  
    3939#include <str_error.h>
    4040#include <stdlib.h>
    41 #include <driver.h>
    42 #include <usb/usbdrv.h>
     41#include <ddf/driver.h>
     42#include <devman.h>
     43#include <usb/hub.h>
     44#include <usb/recognise.h>
    4345
    4446#include "hub.h"
    4547#include "hub/virthub.h"
    4648#include "vhcd.h"
     49#include "conn.h"
    4750
    4851usbvirt_device_t virtual_hub_device;
     52static ddf_dev_ops_t rh_ops = {
     53        .interfaces[USB_DEV_IFACE] = &rh_usb_iface,
     54};
    4955
    5056static int hub_register_in_devman_fibril(void *arg);
    5157
    52 void virtual_hub_device_init(device_t *hc_dev)
     58void virtual_hub_device_init(ddf_fun_t *hc_dev)
    5359{
    5460        virthub_init(&virtual_hub_device);
     
    7076}
    7177
     78static int pretend_port_rest(int unused, void *unused2)
     79{
     80        return EOK;
     81}
     82
    7283/** Register root hub in devman.
    7384 *
     
    7788int hub_register_in_devman_fibril(void *arg)
    7889{
    79         device_t *hc_dev = (device_t *) arg;
     90        ddf_fun_t *hc_dev = (ddf_fun_t *) arg;
    8091
    81         int hc;
     92        /*
     93         * Wait until parent device is properly initialized.
     94         */
     95        int phone;
    8296        do {
    83                 hc = usb_drv_hc_connect(hc_dev, hc_dev->handle,
    84                     IPC_FLAG_BLOCKING);
    85         } while (hc < 0);
     97                phone = devman_device_connect(hc_dev->handle, 0);
     98        } while (phone < 0);
     99        async_hangup(phone);
    86100
    87         usb_drv_reserve_default_address(hc);
     101        int rc;
    88102
    89         usb_address_t hub_address = usb_drv_request_address(hc);
    90         usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, hub_address);
     103        usb_hc_connection_t hc_conn;
     104        rc = usb_hc_connection_initialize(&hc_conn, hc_dev->handle);
     105        assert(rc == EOK);
    91106
    92         usb_drv_release_default_address(hc);
     107        rc = usb_hc_connection_open(&hc_conn);
     108        assert(rc == EOK);
    93109
    94         devman_handle_t hub_handle;
    95         usb_drv_register_child_in_devman(hc, hc_dev, hub_address, &hub_handle);
    96         usb_drv_bind_address(hc, hub_address, hub_handle);
     110        ddf_fun_t *hub_dev;
     111        rc = usb_hc_new_device_wrapper(hc_dev->dev, &hc_conn,
     112            USB_SPEED_FULL,
     113            pretend_port_rest, 0, NULL,
     114            NULL, NULL, &rh_ops, hc_dev, &hub_dev);
     115        if (rc != EOK) {
     116                usb_log_fatal("Failed to create root hub: %s.\n",
     117                    str_error(rc));
     118        }
    97119
    98         return EOK;
     120        usb_hc_connection_close(&hc_conn);
     121
     122        usb_log_info("Created root hub function (handle %zu).\n",
     123            (size_t) hub_dev->handle);
     124
     125        return 0;
    99126}
    100127       
Note: See TracChangeset for help on using the changeset viewer.