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

Changeset dbb9663 in mainline


Ignore:
Timestamp:
2011-07-11T12:22:56Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
5fd0dc23
Parents:
01bbbb2
Message:

libusb: Fix hub descriptor parsing: USB is little endian.

usbhub: Fix checks for power capabilities.

Location:
uspace/drv/bus/usb/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r01bbbb2 rdbb9663  
    249249        usb_log_debug("setting port count to %d\n", descriptor->ports_count);
    250250        hub_info->port_count = descriptor->ports_count;
    251         bool is_power_switched =
    252             ((descriptor->hub_characteristics & 1) == 0);
    253         bool has_individual_port_powering =
    254             ((descriptor->hub_characteristics & 1) != 0);
     251        const bool is_power_switched =
     252            ((descriptor->hub_characteristics & 0x2) == 0);
    255253        hub_info->ports = malloc(
    256254            sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
     
    264262        if (is_power_switched) {
    265263                usb_log_debug("Hub power switched\n");
     264                const bool has_individual_port_powering =
     265                    descriptor->hub_characteristics & 0x1;
    266266
    267267                if (!has_individual_port_powering) {
  • uspace/drv/bus/usb/usbhub/utils.c

    r01bbbb2 rdbb9663  
    147147        descriptor->ports_count = sdescriptor[2];
    148148        /// @fixme handling of endianness??
    149         descriptor->hub_characteristics = sdescriptor[4] + 256 * sdescriptor[3];
     149        descriptor->hub_characteristics = sdescriptor[3] + 256 * sdescriptor[4];
    150150        descriptor->pwr_on_2_good_time = sdescriptor[5];
    151151        descriptor->current_requirement = sdescriptor[6];
Note: See TracChangeset for help on using the changeset viewer.