Changeset 9f0b6cc in mainline for uspace/drv/usbhub/utils.c


Ignore:
Timestamp:
2010-12-12T17:35:02Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f46f8e3
Parents:
8e8289d
Message:

fixes for port count

File:
1 edited

Legend:

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

    r8e8289d r9f0b6cc  
    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);
     
    687687
    688688                // FIXME: count properly
    689                 size_t byte_length = (port_count / 8) + 1;
     689                size_t byte_length = ((port_count+1) / 8) + 1;
    690690
    691691                void *change_bitmap = malloc(byte_length);
     
    707707                }
    708708                unsigned int port;
    709                 for (port = 0; port < port_count; ++port) {
     709                for (port = 1; port < port_count+1; ++port) {
    710710                        bool interrupt = (((uint8_t*) change_bitmap)[port / 8] >> (port % 8)) % 2;
    711711                        if (interrupt) {
Note: See TracChangeset for help on using the changeset viewer.