Changeset dff940f8 in mainline for uspace/drv/usbhub/usbhub.c


Ignore:
Timestamp:
2011-02-25T16:56:52Z (14 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c877b2, b8622e2
Parents:
cc34f32f
Message:

codelifting of latest hub driver changes

File:
1 edited

Legend:

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

    rcc34f32f rdff940f8  
    150150
    151151        //configuration descriptor
    152         /// \TODO check other configurations
     152        /// \TODO check other configurations?
    153153        usb_standard_configuration_descriptor_t config_descriptor;
    154154        opResult = usb_request_get_bare_configuration_descriptor(
     
    194194        }
    195195
    196         /**
    197          * Initialize the interrupt in endpoint.
    198          * \TODO this code should be checked...
    199          */
    200196        usb_endpoint_mapping_t endpoint_mapping[1] = {
    201197                {
     
    225221        return EOK;
    226222       
    227 
    228         // Initialize the interrupt(=status change) endpoint.
    229         /*usb_endpoint_pipe_initialize(
    230                 &result->endpoints->status_change,
    231                 &result->device_connection, );USB_TRANSFER_INTERRUPT
    232         USB_DIRECTION_IN*/
    233 
    234223}
    235224
     
    282271        }
    283272
    284        
    285273        dprintf(USB_LOG_LEVEL_INFO, "setting port count to %d",descriptor->ports_count);
    286274        result->port_count = descriptor->ports_count;
     
    581569        //determine type of change
    582570        usb_endpoint_pipe_t *pipe = &hub->endpoints.control;
    583         //int opResult = usb_endpoint_pipe_start_session(pipe);
    584571       
    585         /*if(opResult != EOK){
    586                 dprintf(USB_LOG_LEVEL_ERROR, "cannot open pipe %d", opResult);
    587         }*/
    588         int opResult;
    589 
    590         /*
    591         usb_target_t target;
    592         target.address=address;
    593         target.endpoint=0;
    594         */
     572        int opResult;
    595573
    596574        usb_port_status_t status;
     
    655633        }
    656634        /// \TODO handle other changes
    657         /// \TODO debug log for various situations
    658         //usb_endpoint_pipe_end_session(pipe);
    659 
    660 
    661635}
    662636
     
    674648        }
    675649
    676         /*
    677          * Check status change pipe of this hub.
    678          */
    679         /*
    680         usb_target_t target;
    681         target.address = hub_info->address;
    682         target.endpoint = 1;/// \TODO get from endpoint descriptor
    683         dprintf(USB_LOG_LEVEL_INFO, "checking changes for hub at addr %d",
    684             target.address);
    685         */
    686650        size_t port_count = hub_info->port_count;
    687 
    688         /*
    689          * Connect to respective HC.
    690          *
    691         int hc = usb_drv_hc_connect_auto(hub_info->device, 0);
    692         if (hc < 0) {
    693         continue;
    694         }*/
    695651
    696652        /// FIXME: count properly
     
    699655        size_t actual_size;
    700656
    701         //usb_handle_t handle;
    702657        /*
    703658         * Send the request.
     
    708663                        );
    709664
    710         //usb_drv_async_wait_for(handle);
    711 
    712665        if (opResult != EOK) {
    713666                free(change_bitmap);
    714667                dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub");
     668                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
    715669                return;
    716670        }
    717671        unsigned int port;
    718672        opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.control);
    719         usb_hc_connection_open(&hub_info->connection);
     673        if(opResult!=EOK){
     674                dprintf(USB_LOG_LEVEL_ERROR, "could not start control pipe session %d",
     675                                opResult);
     676                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
     677                return;
     678        }
     679        opResult = usb_hc_connection_open(&hub_info->connection);
     680        if(opResult!=EOK){
     681                dprintf(USB_LOG_LEVEL_ERROR, "could not start host controller session %d",
     682                                opResult);
     683                usb_endpoint_pipe_end_session(&hub_info->endpoints.control);
     684                usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change);
     685                return;
     686        }
    720687
    721688        ///todo, opresult check, pre obe konekce
     
    734701}
    735702
    736 /**
    737  * Check changes on all known hubs.
    738  */
    739 /*
    740 void usb_hub_check_hub_changes(void) {
    741         // Iterate through all hubs.
    742          
    743         usb_general_list_t * lst_item;
    744         fibril_mutex_lock(&usb_hub_list_lock);
    745         for (lst_item = usb_hub_list.next;
    746                         lst_item != &usb_hub_list;
    747                         lst_item = lst_item->next) {
    748                 fibril_mutex_unlock(&usb_hub_list_lock);
    749                 usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data);
    750                 usb_hub_check_hub_changes(hub_info);
    751                 fibril_mutex_lock(&usb_hub_list_lock);
    752         }
    753         fibril_mutex_unlock(&usb_hub_list_lock);
    754 }
    755 */
    756 
    757 
    758703
    759704
Note: See TracChangeset for help on using the changeset viewer.