Changeset 682b697 in mainline for uspace/drv/usbhub/utils.c


Ignore:
Timestamp:
2010-12-12T18:05:19Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
37f7cfe, ecf52c4b
Parents:
5d4eb2df (diff), 9223dc5c (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 from smekideki

File:
1 edited

Legend:

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

    r5d4eb2df r682b697  
    352352        result->port_count = descriptor->ports_count;
    353353        result->attached_devs = (usb_hub_attached_device_t*)
    354             malloc(result->port_count * sizeof(usb_hub_attached_device_t));
     354            malloc((result->port_count+1) * sizeof(usb_hub_attached_device_t));
    355355        int i;
    356         for(i=0;i<result->port_count;++i){
     356        for(i=0;i<result->port_count+1;++i){
    357357                result->attached_devs[i].devman_handle=0;
    358358                result->attached_devs[i].address=0;
     
    428428
    429429
    430         for (port = 0; port < hub_info->port_count; ++port) {
     430        for (port = 1; port < hub_info->port_count+1; ++port) {
    431431                usb_hub_set_power_port_request(&request, port);
    432432                opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
     433                printf("[usb_hub] powering port %d\n",port);
    433434                if (opResult != EOK) {
    434435                        printf("[usb_hub]something went wrong when setting hub`s %dth port\n", port);
     
    540541                return;
    541542        }
     543        printf("[usb_hub] new device address %d, handle %d\n",
     544            new_device_address, child_handle);
     545        sleep(60);
    542546       
    543547}
     
    638642        usb_port_set_dev_connected(&status, false);
    639643        if (status) {
    640                 printf("[usb_hub]there was some unsupported change on port\n");
     644                printf("[usb_hub]there was some unsupported change on port %d\n",port);
    641645        }
    642646        /// \TODO handle other changes
     
    675679                target.address = hub_info->usb_device->address;
    676680                target.endpoint = 1;/// \TODO get from endpoint descriptor
     681                printf("checking changes for hub at addr %d \n",target.address);
    677682
    678683                size_t port_count = hub_info->port_count;
     
    687692
    688693                // FIXME: count properly
    689                 size_t byte_length = (port_count / 8) + 1;
     694                size_t byte_length = ((port_count+1) / 8) + 1;
    690695
    691696                void *change_bitmap = malloc(byte_length);
     
    707712                }
    708713                unsigned int port;
    709                 for (port = 0; port < port_count; ++port) {
     714                for (port = 1; port < port_count+1; ++port) {
    710715                        bool interrupt = (((uint8_t*) change_bitmap)[port / 8] >> (port % 8)) % 2;
    711716                        if (interrupt) {
Note: See TracChangeset for help on using the changeset viewer.