Changeset d7f3040 in mainline


Ignore:
Timestamp:
2011-04-07T07:44:21Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1c89f74
Parents:
e5ccfd1
Message:

fix attempt #2

Location:
uspace/drv/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/port_status.h

    re5ccfd1 rd7f3040  
    257257 */
    258258static inline bool usb_port_get_bit(usb_port_status_t * status, int idx) {
    259         return (*status)&(1 << idx);
     259        return ((*status)&(1 << idx))!=0;
    260260}
    261261
  • uspace/drv/usbhub/usbhub.c

    re5ccfd1 rd7f3040  
    229229        {
    230230                unsigned int port;
    231                 for (port = 1; port <= port_count; ++port) {
     231                for (port = 0; port < port_count; ++port) {
    232232                        bool is_non_removable =
    233233                                hub_info->not_initialized_non_removables[port/8]
    234                                 & (1 << (port % 8));
     234                                & (1 << (port-1 % 8));
    235235                        if (is_non_removable) {
    236236                                opResult = initialize_non_removable(hub_info,
    237                                         port);
     237                                        port+1);
    238238                        }
    239239                }
     
    470470        usb_speed_t speed) {
    471471        //if this hub already uses default address, it cannot request it once more
    472         if (hub->is_default_address_used) return EREFUSED;
     472        if (hub->is_default_address_used) {
     473                usb_log_info("default address used, another time\n");
     474                return EREFUSED;
     475        }
    473476        usb_log_debug("some connection changed\n");
    474477        assert(hub->control_pipe->hc_phone);
     
    710713                usb_log_debug("connection change on port\n");
    711714                if (usb_port_dev_connected(&status)) {
    712                         usb_log_debug("some connection changed\n");
    713715                        usb_hub_init_add_device(hub, port,
    714716                                usb_port_speed(&status));
     
    743745        /// \TODO what about port power change?
    744746        if (status >> 16) {
    745                 usb_log_info("there was some unsupported change on port %d: %X\n",
     747                usb_log_info("there was unsupported change on port %d: %X\n",
    746748                        port, status);
    747749
     
    898900        if (usb_port_dev_connected(&status)) {
    899901                usb_log_debug("there is connected device on this port\n");
     902                opResult = usb_hub_init_add_device(hub_info, port,
     903                        usb_port_speed(&status));
    900904        }else{
    901905                usb_log_debug("the non-removable device is not connected\n");
    902         }
    903         if (!hub_info->is_default_address_used)
    904                 usb_hub_init_add_device(hub_info, port,
    905                         usb_port_speed(&status));
     906                opResult = EINVAL;
     907        }
     908       
    906909        return opResult;
    907910}
     
    10211024        for (port = 1; port <= descriptor->ports_count; ++port) {
    10221025                bool is_non_removable =
    1023                         ((non_removable_dev_bitmap[port / 8]) >> (port % 8)) % 2;
     1026                        ((non_removable_dev_bitmap[(port-1) / 8]) >> ((port-1) % 8)) % 2;
    10241027                if (is_non_removable) {
    10251028                        usb_log_debug("CHECKING port %d is non-removable\n",
Note: See TracChangeset for help on using the changeset viewer.