Ignore:
File:
1 edited

Legend:

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

    r192ba25 r361fcec  
    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  */
    61 static 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  */
    67 static const int non_handled_changes[] =  {
    68         USB_HUB_FEATURE_C_PORT_ENABLE,
    69         USB_HUB_FEATURE_C_PORT_SUSPEND
    7055};
    7156
     
    146131            &status, USB_HUB_FEATURE_C_PORT_CONNECTION,false);
    147132        usb_port_status_set_bit(
     133            &status, USB_HUB_FEATURE_PORT_RESET,false);
     134        usb_port_status_set_bit(
    148135            &status, USB_HUB_FEATURE_C_PORT_RESET,false);
    149136        usb_port_status_set_bit(
    150137            &status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT,false);
    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);
     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
    178143        }
    179144}
     
    257222                    "Port %zu reset complete but port not enabled.\n",
    258223                    (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));
    266224        }
    267225}
     
    361319        fibril_mutex_unlock(&my_port->reset_mutex);
    362320
     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
    363330        if (my_port->reset_okay) {
    364331                return EOK;
Note: See TracChangeset for help on using the changeset viewer.