Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2cb6571 in mainline for uspace/lib/usb/src/hubdrv.c


Ignore:
Timestamp:
2010-12-03T15:49:30Z (11 years ago)
Author:
smekideki@…>
Branches:
lfn, master
Children:
36c410e, 54b141a
Parents:
1dd264b (diff), 4144630 (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 with smekideki

File:
1 edited

Legend:

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

    r1dd264b r2cb6571  
    113113        usb_hcd_hub_info_t* result = (usb_hcd_hub_info_t*) malloc(sizeof (usb_hcd_hub_info_t));
    114114        //get parent device
    115         /// @TODO this code is not correct
    116115        device_t * my_hcd = device;
    117116        while (my_hcd->parent)
    118117                my_hcd = my_hcd->parent;
    119118        //dev->
    120         printf("%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
     119        printf("[hcdhubd]%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
    121120        //we add the hub into the first hc
    122121        //link_t *link_hc = hc_list.next;
     
    135134 */
    136135int usb_add_hub_device(device_t *dev) {
    137         usb_hc_device_t *hc = list_get_instance(hc_list.next, usb_hc_device_t, link);
    138         set_hub_address(hc, 5);
     136        //usb_hc_device_t *hc = list_get_instance(hc_list.next, usb_hc_device_t, link);
     137        assert(dev->parent);
     138        usb_hc_device_t *hc = (usb_hc_device_t*)dev->parent->driver_data;
     139        usb_address_t addr =usb_use_free_address(hc);
     140        if(addr<0){
     141                printf("[hcdhubd] ERROR: cannot find an address \n");
     142        }
     143        set_hub_address(hc, addr);
    139144
    140145        check_hub_changes();
     
    151156                my_hcd = my_hcd->parent;
    152157        //dev->
    153         printf("%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
     158        printf("[hcdhubd]%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
    154159        my_hcd = dev;
    155160        while (my_hcd->parent)
     
    157162        //dev->
    158163
    159         printf("%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
     164        printf("[hcdhubd]%s: owner hcd found: %s\n", hc_driver->name, my_hcd->name);
    160165
    161166        //create the hub structure
     
    183188 */
    184189static void set_hub_address(usb_hc_device_t *hc, usb_address_t address) {
    185         printf("%s: setting hub address to %d\n", hc->generic->name, address);
     190        printf("[hcdhubd]%s: setting hub address to %d\n", hc->generic->name, address);
    186191        usb_target_t target = {0, 0};
    187192        usb_handle_t handle;
     
    217222        }
    218223
    219         printf("%s: hub address changed\n", hc->generic->name);
     224        printf("[hcdhubd]%s: hub address changed successfully to %d\n",
     225                        hc->generic->name, address);
    220226}
    221227
Note: See TracChangeset for help on using the changeset viewer.