Changeset 36c410e in mainline for uspace/drv/usbhub/utils.c


Ignore:
Timestamp:
2010-12-04T15:52:12Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6f04905
Parents:
4317827 (diff), 2cb6571 (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 development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/utils.c

    r4317827 r36c410e  
    109109//*********************************************
    110110
    111 static void set_hub_address(device_t *dev, usb_address_t address);
    112 
    113111usb_hcd_hub_info_t * usb_create_hub_info(device_t * device) {
    114112        usb_hcd_hub_info_t* result = (usb_hcd_hub_info_t*) malloc(sizeof (usb_hcd_hub_info_t));
     
    124122int usb_add_hub_device(device_t *dev) {
    125123        printf(NAME ": add_hub_device(handle=%d)\n", (int) dev->handle);
    126         set_hub_address(dev, 5);
    127124
    128125        check_hub_changes();
     
    142139}
    143140
    144 /** Sample usage of usb_hc_async functions.
    145  * This function sets hub address using standard SET_ADDRESS request.
    146  *
    147  * @warning This function shall be removed once you are familiar with
    148  * the usb_hc_ API.
    149  *
    150  * @param hc Host controller the hub belongs to.
    151  * @param address New hub address.
    152  */
    153 static void set_hub_address(device_t *dev, usb_address_t address) {
    154         printf(NAME ": setting hub address to %d\n", address);
    155         usb_target_t target = {0, 0};
    156         usb_handle_t handle;
    157         int rc;
    158 
    159         usb_device_request_setup_packet_t setup_packet = {
    160                 .request_type = 0,
    161                 .request = USB_DEVREQ_SET_ADDRESS,
    162                 .index = 0,
    163                 .length = 0,
    164         };
    165         setup_packet.value = address;
    166 
    167         int hc = usb_drv_hc_connect(dev, 0);
    168 
    169         rc = usb_drv_async_control_write_setup(hc, target,
    170                         &setup_packet, sizeof (setup_packet), &handle);
    171         if (rc != EOK) {
    172                 return;
    173         }
    174 
    175         rc = usb_drv_async_wait_for(handle);
    176         if (rc != EOK) {
    177                 return;
    178         }
    179 
    180         rc = usb_drv_async_control_write_status(hc, target, &handle);
    181         if (rc != EOK) {
    182                 return;
    183         }
    184 
    185         rc = usb_drv_async_wait_for(handle);
    186         if (rc != EOK) {
    187                 return;
    188         }
    189 
    190         printf(NAME ": hub address changed\n");
    191 }
    192141
    193142/** Check changes on all known hubs.
Note: See TracChangeset for help on using the changeset viewer.