Changeset bd575647 in mainline for uspace/lib/usbdev/src/hub.c


Ignore:
Timestamp:
2011-12-11T16:30:42Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d5ef94
Parents:
2c202c5
Message:

libusbdev: Use shared hc_connection for pipes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/hub.c

    r2c202c5 rbd575647  
    6363        } while (false)
    6464
    65 /** Ask host controller for free address assignment.
    66  *
    67  * @param connection Opened connection to host controller.
    68  * @param preferred Preferred SUB address.
    69  * @param strict Fail if the preferred address is not avialable.
    70  * @param speed Speed of the new device (device that will be assigned
    71  *    the returned address).
    72  * @return Assigned USB address or negative error code.
    73  */
    74 usb_address_t usb_hc_request_address(usb_hc_connection_t *connection,
    75     usb_address_t preferred, bool strict, usb_speed_t speed)
    76 {
    77         CHECK_CONNECTION(connection);
    78 
    79         async_exch_t *exch = async_exchange_begin(connection->hc_sess);
    80         if (!exch)
    81                 return (usb_address_t)ENOMEM;
    82 
    83         usb_address_t address = preferred;
    84         const int ret = usbhc_request_address(exch, &address, strict, speed);
    85 
    86         async_exchange_end(exch);
    87         return ret == EOK ? address : ret;
    88 }
    8965
    9066/** Inform host controller about new device.
     
    9773    const usb_hub_attached_device_t *attached_device)
    9874{
    99         CHECK_CONNECTION(connection);
     75//      CHECK_CONNECTION(connection);
    10076        if (attached_device == NULL || attached_device->fun == NULL)
    10177                return EINVAL;
     
    12096    usb_address_t address)
    12197{
    122         CHECK_CONNECTION(connection);
     98//      CHECK_CONNECTION(connection);
    12399
    124100        async_exch_t *exch = async_exchange_begin(connection->hc_sess);
     
    166142
    167143        /* TODO: prevent others from accessing the wire now. */
    168         if (usb_pipe_unregister(pipe, hc_conn) != EOK) {
     144        if (usb_pipe_unregister(pipe) != EOK) {
    169145                usb_log_warning(
    170146                    "Failed to unregister the old pipe on address change.\n");
     
    172148        /* The address is already changed so set it in the wire */
    173149        pipe->wire->address = new_address;
    174         rc = usb_pipe_register(pipe, 0, hc_conn);
     150        rc = usb_pipe_register(pipe, 0);
    175151        if (rc != EOK)
    176152                return EADDRNOTAVAIL;
     
    288264
    289265        /* Register control pipe on default address. */
    290         rc = usb_pipe_register(&ctrl_pipe, 0, &hc_conn);
     266        rc = usb_pipe_register(&ctrl_pipe, 0);
    291267        if (rc != EOK) {
    292268                rc = ENOTCONN;
     
    385361leave_release_free_address:
    386362        /* This might be either 0:0 or dev_addr:0 */
    387         if (usb_pipe_unregister(&ctrl_pipe, &hc_conn) != EOK)
     363        if (usb_pipe_unregister(&ctrl_pipe) != EOK)
    388364                usb_log_warning("%s: Failed to unregister default pipe.\n",
    389365                    __FUNCTION__);
Note: See TracChangeset for help on using the changeset viewer.