Changeset eb1a2f4 in mainline for uspace/lib/usb/src/recognise.c


Ignore:
Timestamp:
2011-02-22T23:30:56Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b5d1535, a9c674e0
Parents:
dbe25f1 (diff), 664af708 (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 mainline changes (DDF refactoring)

This merge includes DDF refactoring that brought multifunctional devices
(i.e. ddf_dev_t and ddf_fun_t). Please, see ticket #295 at HelenOS
upstream Trac.

The conflicts themselves were easy to solve (merely several renamings).

Changes to USB subsystem:

  • drivers uses ddf_dev_t and ddf_fun_t
  • different signatures of many library functions
  • several hacks around communication with parent device (now the communication is clearer and somehow what we have now is hack about other hacks)
    • will repair and clean later
  • maybe added some extra debugging messages (the diff has about 240K, and I admit I have no energy to double check that)

WARNING:

  • the diff is VERY long, recommended is viewing partial diffs of the merge (i.e. merges in mainline branch that lead to the parent one)
  • merging with your branches might involve huge renamings, sorry, no other way is possible

BUGS:

  • hub driver will not work (no function created)

GOOD NEWS:

  • QEMU keyboard seems to work with QEMU 0.13 and 0.14
  • we are up-to-date with mainline again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/recognise.c

    rdbe25f1 reb1a2f4  
    3434 */
    3535#include <sys/types.h>
     36#include <fibril_synch.h>
    3637#include <usb/pipes.h>
    3738#include <usb/recognise.h>
     
    4142#include <stdio.h>
    4243#include <errno.h>
     44#include <assert.h>
    4345
    4446static size_t device_name_index = 0;
    4547static FIBRIL_MUTEX_INITIALIZE(device_name_index_mutex);
    4648
    47 device_ops_t child_ops = {
     49ddf_dev_ops_t child_ops = {
    4850        .interfaces[USB_DEV_IFACE] = &usb_iface_hub_child_impl
    4951};
     
    326328int usb_device_register_child_in_devman(usb_address_t address,
    327329    devman_handle_t hc_handle,
    328     device_t *parent, devman_handle_t *child_handle)
     330    ddf_dev_t *parent, devman_handle_t *child_handle,
     331    ddf_dev_ops_t *dev_ops, void *dev_data, ddf_fun_t **child_fun)
    329332{
    330333        size_t this_device_name_index;
     
    335338        fibril_mutex_unlock(&device_name_index_mutex);
    336339
    337         device_t *child = NULL;
     340        ddf_fun_t *child = NULL;
    338341        char *child_name = NULL;
    339342        int rc;
     
    352355        }
    353356
    354         child = create_device();
     357        /*
     358         * TODO: Once the device driver framework support persistent
     359         * naming etc., something more descriptive could be created.
     360         */
     361        rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index);
     362        if (rc < 0) {
     363                goto failure;
     364        }
     365
     366        child = ddf_fun_create(parent, fun_inner, child_name);
    355367        if (child == NULL) {
    356368                rc = ENOMEM;
     
    358370        }
    359371
    360         /*
    361          * TODO: Once the device driver framework support persistent
    362          * naming etc., something more descriptive could be created.
    363          */
    364         rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index);
    365         if (rc < 0) {
    366                 goto failure;
    367         }
    368         child->parent = parent;
    369         child->name = child_name;
    370         child->ops = &child_ops;
     372        if (dev_ops != NULL) {
     373                child->ops = dev_ops;
     374        } else {
     375                child->ops = &child_ops;
     376        }
     377
     378        child->driver_data = dev_data;
    371379
    372380        rc = usb_endpoint_pipe_start_session(&ctrl_pipe);
     
    385393        }
    386394
    387         rc = child_device_register(child, parent);
     395        rc = ddf_fun_bind(child);
    388396        if (rc != EOK) {
    389397                goto failure;
     
    392400        if (child_handle != NULL) {
    393401                *child_handle = child->handle;
     402        }
     403
     404        if (child_fun != NULL) {
     405                *child_fun = child;
    394406        }
    395407
     
    400412                child->name = NULL;
    401413                /* This takes care of match_id deallocation as well. */
    402                 delete_device(child);
     414                ddf_fun_destroy(child);
    403415        }
    404416        if (child_name != NULL) {
Note: See TracChangeset for help on using the changeset viewer.