Changeset 709e868 in mainline for uspace/drv/usbhub/utils.c


Ignore:
Timestamp:
2011-04-09T18:42:13Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
501e5df, f11c288
Parents:
97e7e8a (diff), b79c31f9 (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:

several fixes for hub drivers (non-removable devices, ohci root hub, power settings) , documentation, refactoring

File:
1 edited

Legend:

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

    r97e7e8a r709e868  
    6060        size_t size = 7;
    6161        //variable size according to port count
    62         size_t var_size = descriptor->ports_count / 8 + ((descriptor->ports_count % 8 > 0) ? 1 : 0);
     62        size_t var_size = (descriptor->ports_count+7)/8;
    6363        size += 2 * var_size;
    64         uint8_t * result = (uint8_t*) malloc(size);
     64        uint8_t * result = malloc(size);
    6565        //size
    6666        result[0] = size;
     
    8484}
    8585
    86 usb_hub_descriptor_t * usb_deserialize_hub_desriptor(void * serialized_descriptor) {
    87         uint8_t * sdescriptor = (uint8_t*) serialized_descriptor;
     86usb_hub_descriptor_t * usb_deserialize_hub_desriptor(
     87void * serialized_descriptor) {
     88        uint8_t * sdescriptor = serialized_descriptor;
    8889
    8990        if (sdescriptor[1] != USB_DESCTYPE_HUB) {
    90                 usb_log_warning("trying to deserialize wrong descriptor %x\n",sdescriptor[1]);
     91                usb_log_warning("trying to deserialize wrong descriptor %x\n",
     92                    sdescriptor[1]);
    9193                return NULL;
    9294        }
    9395
    94         usb_hub_descriptor_t * result = usb_new(usb_hub_descriptor_t);
     96        usb_hub_descriptor_t * result = malloc(sizeof(usb_hub_descriptor_t));
    9597       
    9698
     
    100102        result->pwr_on_2_good_time = sdescriptor[5];
    101103        result->current_requirement = sdescriptor[6];
    102         size_t var_size = result->ports_count / 8 + ((result->ports_count % 8 > 0)
    103                         ? 1 : 0);
     104        size_t var_size = (result->ports_count+7) / 8;
    104105        result->devices_removable = (uint8_t*) malloc(var_size);
    105106
Note: See TracChangeset for help on using the changeset viewer.