Changeset cb0ab9e in mainline for uspace/drv/usbhub/ports.c


Ignore:
Timestamp:
2011-05-07T14:40:46Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6985b4e
Parents:
df0bbe1 (diff), 7205209 (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 development/ changes

File:
1 edited

Legend:

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

    rdf0bbe1 rcb0ab9e  
    5353        size_t port;
    5454        usb_speed_t speed;
     55};
     56
     57/**
     58 * count of port status changes that are not explicitly handled by
     59 * any function here and must be cleared by hand
     60 */
     61static const unsigned int non_handled_changes_count = 2;
     62
     63/**
     64 * port status changes that are not explicitly handled by
     65 * any function here and must be cleared by hand
     66 */
     67static const int non_handled_changes[] =  {
     68        USB_HUB_FEATURE_C_PORT_ENABLE,
     69        USB_HUB_FEATURE_C_PORT_SUSPEND
    5570};
    5671
     
    131146            &status, USB_HUB_FEATURE_C_PORT_CONNECTION,false);
    132147        usb_port_status_set_bit(
    133             &status, USB_HUB_FEATURE_PORT_RESET,false);
    134         usb_port_status_set_bit(
    135148            &status, USB_HUB_FEATURE_C_PORT_RESET,false);
    136149        usb_port_status_set_bit(
    137150            &status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT,false);
    138         /// \TODO what about port power change?
    139         if (status >> 16) {
    140                 usb_log_info("there was unsupported change on port %d: %X\n",
    141                         port, status);
    142 
     151       
     152        //clearing not yet handled changes     
     153        unsigned int feature_idx;
     154        for(feature_idx = 0;feature_idx<non_handled_changes_count;
     155            ++feature_idx){
     156                unsigned int bit_idx = non_handled_changes[feature_idx];
     157                if(status & (1<<bit_idx)){
     158                        usb_log_info(
     159                            "there was not yet handled change on port %d: %d"
     160                            ";clearing it\n",
     161                        port, bit_idx);
     162                        int opResult = usb_hub_clear_port_feature(
     163                            hub->control_pipe,
     164                            port, bit_idx);
     165                        if (opResult != EOK) {
     166                                usb_log_warning(
     167                                    "could not clear port flag %d: %d\n",
     168                                    bit_idx, opResult
     169                                    );
     170                        }
     171                        usb_port_status_set_bit(
     172                            &status, bit_idx,false);
     173                }
     174        }
     175        if(status>>16){
     176                usb_log_info("there is still some unhandled change %X\n",
     177                    status);
    143178        }
    144179}
     
    222257                    "Port %zu reset complete but port not enabled.\n",
    223258                    (size_t) port);
     259        }
     260        /* Clear the port reset change. */
     261        int rc = usb_hub_clear_port_feature(hub->control_pipe,
     262            port, USB_HUB_FEATURE_C_PORT_RESET);
     263        if (rc != EOK) {
     264                usb_log_error("Failed to clear port %d reset feature: %s.\n",
     265                    port, str_error(rc));
    224266        }
    225267}
     
    319361        fibril_mutex_unlock(&my_port->reset_mutex);
    320362
    321         /* Clear the port reset change. */
    322         rc = usb_hub_clear_port_feature(hub->control_pipe,
    323             port_no, USB_HUB_FEATURE_C_PORT_RESET);
    324         if (rc != EOK) {
    325                 usb_log_error("Failed to clear port %d reset feature: %s.\n",
    326                     port_no, str_error(rc));
    327                 return rc;
    328         }
    329 
    330363        if (my_port->reset_okay) {
    331364                return EOK;
Note: See TracChangeset for help on using the changeset viewer.