Ignore:
File:
1 edited

Legend:

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

    r71ed4849 r5097bed4  
    7575        //get some hub info
    7676        usb_address_t addr = usb_drv_get_my_address(hc, device);
    77         dprintf(1,"[usb_hub] addres of newly created hub = %d", addr);
     77        dprintf(1,"[usb_hub] address of newly created hub = %d", addr);
    7878        /*if(addr<0){
    7979                //return result;
     
    174174                dprintf(1,"[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE");
    175175        }
     176        /// \TODO check other configurations
    176177        usb_standard_configuration_descriptor_t config_descriptor;
    177178        opResult = usb_drv_req_get_bare_configuration_descriptor(hc,
     
    194195        }
    195196
    196 
    197197        for (port = 1; port < hub_info->port_count+1; ++port) {
    198198                usb_hub_set_power_port_request(&request, port);
     
    205205        //ports powered, hub seems to be enabled
    206206
    207 
    208207        ipc_hangup(hc);
    209208
    210209        //add the hub to list
     210        futex_down(&usb_hub_list_lock);
    211211        usb_lst_append(&usb_hub_list, hub_info);
     212        futex_up(&usb_hub_list_lock);
     213
    212214        dprintf(1,"[usb_hub] hub info added to list");
    213215        //(void)hub_info;
     
    233235//
    234236//*********************************************
     237
     238/**
     239 * convenience function for releasing default address and writing debug info
     240 * (these few lines are used too often to be written again and again)
     241 * @param hc
     242 * @return
     243 */
     244inline static int usb_hub_release_default_address(int hc){
     245        int opResult;
     246        dprintf(1,"[usb_hub] releasing default address");
     247        opResult = usb_drv_release_default_address(hc);
     248        if (opResult != EOK) {
     249                dprintf(1,"[usb_hub] failed to release default address");
     250        }
     251        return opResult;
     252}
    235253
    236254/**
     
    259277        if (opResult != EOK) {
    260278                dprintf(1,"[usb_hub] something went wrong when reseting a port");
    261         }
    262 }
    263 
    264 /**
    265  * convenience function for releasing default address and writing debug info
    266  * (these few lines are used too often to be written again and again)
    267  * @param hc
    268  * @return
    269  */
    270 inline static int usb_hub_release_default_address(int hc){
    271         int opResult;
    272         dprintf(1,"[usb_hub] releasing default address");
    273         opResult = usb_drv_release_default_address(hc);
    274         if (opResult != EOK) {
    275                 dprintf(1,"[usb_hub] failed to release default address");
    276         }
    277         return opResult;
    278 }
    279 
     279                usb_hub_release_default_address(hc);
     280        }
     281}
    280282
    281283/**
     
    343345
    344346/**
    345  * unregister device address in hc, close the port
     347 * unregister device address in hc
    346348 * @param hc
    347349 * @param port
     
    352354        //usb_device_request_setup_packet_t request;
    353355        int opResult;
    354         //disable port
    355         /*usb_hub_set_disable_port_request(&request, port);
    356         opResult = usb_drv_sync_control_write(
    357                         hc, target,
    358                         &request,
    359                         NULL, 0
    360                         );
    361         if (opResult != EOK) {
    362                 //continue;
    363                 printf("[usb_hub] something went wrong when disabling a port\n");
    364         }*/
     356       
    365357        /// \TODO remove device
    366358
     
    457449         */
    458450        usb_general_list_t * lst_item;
     451        futex_down(&usb_hub_list_lock);
    459452        for (lst_item = usb_hub_list.next;
    460453                        lst_item != &usb_hub_list;
    461454                        lst_item = lst_item->next) {
     455                futex_up(&usb_hub_list_lock);
    462456                usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data);
    463457                /*
     
    510504                        }
    511505                }
     506                free(change_bitmap);
    512507
    513508                ipc_hangup(hc);
    514         }
     509                futex_down(&usb_hub_list_lock);
     510        }
     511        futex_up(&usb_hub_list_lock);
    515512}
    516513
Note: See TracChangeset for help on using the changeset viewer.