Changes in / [192466bc:1d7a74e] in mainline


Ignore:
Location:
uspace/drv/usbhub
Files:
3 edited

Legend:

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

    r192466bc r1d7a74e  
    5252        while(true){
    5353                usb_hub_check_hub_changes();
    54                 async_usleep(1000 * 1000 );/// \TODO proper number once
     54                async_usleep(1000 * 1000);
    5555        }
    5656        return 0;
  • uspace/drv/usbhub/usbhub.c

    r192466bc r1d7a74e  
    4646#include "usbhub_private.h"
    4747#include "port_status.h"
    48 #include "usb/usb.h"
    4948
    5049static usb_iface_t hub_usb_iface = {
     
    8685
    8786        // get hub descriptor
     87        usb_target_t target;
     88        target.address = addr;
     89        target.endpoint = 0;
     90        usb_device_request_setup_packet_t request;
     91        //printf("[usb_hub] creating descriptor request\n");
     92        usb_hub_set_descriptor_request(&request);
    8893
    8994        //printf("[usb_hub] creating serialized descriptor\n");
     
    9398        int opResult;
    9499        //printf("[usb_hub] starting control transaction\n");
    95        
    96         opResult = usb_drv_req_get_descriptor(hc, addr,
    97                         USB_REQUEST_TYPE_CLASS,
    98                         USB_DESCTYPE_HUB, 0, 0, serialized_descriptor,
     100        opResult = usb_drv_sync_control_read(
     101                        hc, target, &request, serialized_descriptor,
    99102                        USB_HUB_MAX_DESCRIPTOR_SIZE, &received_size);
    100 
    101103        if (opResult != EOK) {
    102104                dprintf(1,"[usb_hub] failed when receiving hub descriptor, badcode = %d",opResult);
     
    153155        int port;
    154156        int opResult;
     157        usb_device_request_setup_packet_t request;
    155158        usb_target_t target;
    156159        target.address = hub_info->usb_device->address;
     
    170173        if(std_descriptor.configuration_count<1){
    171174                dprintf(1,"[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE");
    172                 //shouldn`t I return?
    173175        }
    174176        /// \TODO check other configurations
     
    182184        }
    183185        //set configuration
    184         opResult = usb_drv_req_set_configuration(hc, target.address,
    185     config_descriptor.configuration_number);
    186 
     186        request.request_type = 0;
     187        request.request = USB_DEVREQ_SET_CONFIGURATION;
     188        request.index=0;
     189        request.length=0;
     190        request.value_high=0;
     191        request.value_low = config_descriptor.configuration_number;
     192        opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0);
    187193        if (opResult != EOK) {
    188194                dprintf(1,"[usb_hub]something went wrong when setting hub`s configuration, %d", opResult);
    189195        }
    190196
    191         usb_device_request_setup_packet_t request;
    192197        for (port = 1; port < hub_info->port_count+1; ++port) {
    193198                usb_hub_set_power_port_request(&request, port);
     
    224229
    225230
     231
    226232//*********************************************
    227233//
     
    231237
    232238/**
    233  * Convenience function for releasing default address and writing debug info
    234  * (these few lines are used too often to be written again and again).
     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)
    235241 * @param hc
    236242 * @return
     
    247253
    248254/**
    249  * Reset the port with new device and reserve the default address.
     255 * reset the port with new device and reserve the default address
    250256 * @param hc
    251257 * @param port
     
    276282
    277283/**
    278  * Finalize adding new device after port reset
     284 * finalize adding new device after port reset
    279285 * @param hc
    280286 * @param port
     
    339345
    340346/**
    341  * Unregister device address in hc
     347 * unregister device address in hc
    342348 * @param hc
    343349 * @param port
     
    349355        int opResult;
    350356       
    351         /** \TODO remove device from device manager - not yet implemented in
    352          * devide manager
    353          */
     357        /// \TODO remove device
    354358
    355359        hub->attached_devs[port].devman_handle=0;
     
    372376
    373377/**
    374  * Process interrupts on given hub port
     378 * process interrupts on given hub port
    375379 * @param hc
    376380 * @param port
     
    430434        usb_port_set_reset_completed(&status, false);
    431435        usb_port_set_dev_connected(&status, false);
    432         if (status>>16) {
    433                 dprintf(1,"[usb_hub]there was some unsupported change on port %d: %X",port,status);
    434 
     436        if (status) {
     437                dprintf(1,"[usb_hub]there was some unsupported change on port %d",port);
    435438        }
    436439        /// \TODO handle other changes
     
    439442}
    440443
    441 /**
    442  * Check changes on all known hubs.
     444/* Check changes on all known hubs.
    443445 */
    444446void usb_hub_check_hub_changes(void) {
  • uspace/drv/usbhub/usbhub_private.h

    r192466bc r1d7a74e  
    3131 */
    3232/** @file
    33  * @brief Hub driver private definitions
     33 * @brief Hub driver.
    3434 */
    3535
     
    6868
    6969/**
    70  * Create hub structure instance
     70 * create hub structure instance
    7171 *
    7272 * Set the address and port count information most importantly.
     
    7878usb_hub_info_t * usb_create_hub_info(device_t * device, int hc);
    7979
    80 /** List of hubs maanged by this driver */
     80/** list of hubs maanged by this driver */
    8181extern usb_general_list_t usb_hub_list;
    8282
    83 /** Lock for hub list*/
     83/** lock for hub list*/
    8484extern futex_t usb_hub_list_lock;
    8585
    8686
    8787/**
    88  * Perform complete control read transaction
     88 * perform complete control read transaction
    8989 *
    90  * Manages all three steps of transaction: setup, read and finalize
     90 * manages all three steps of transaction: setup, read and finalize
    9191 * @param phone
    9292 * @param target
    93  * @param request Request packet
    94  * @param rcvd_buffer Received data
     93 * @param request request for data
     94 * @param rcvd_buffer received data
    9595 * @param rcvd_size
    96  * @param actual_size Actual size of received data
     96 * @param actual_size actual size of received data
    9797 * @return error code
    9898 */
     
    104104
    105105/**
    106  * Perform complete control write transaction
     106 * perform complete control write transaction
    107107 *
    108  * Manages all three steps of transaction: setup, write and finalize
     108 * manages all three steps of transaction: setup, write and finalize
    109109 * @param phone
    110110 * @param target
    111  * @param request Request packet to send data
     111 * @param request request to send data
    112112 * @param sent_buffer
    113113 * @param sent_size
     
    121121
    122122/**
    123  * Set the device request to be a get hub descriptor request.
     123 * set the device request to be a get hub descriptor request.
    124124 * @warning the size is allways set to USB_HUB_MAX_DESCRIPTOR_SIZE
    125125 * @param request
     
    137137}
    138138
    139 /**
    140  * Clear feature on hub port.
    141  *
    142  * @param hc Host controller telephone
    143  * @param address Hub address
    144  * @param port_index Port
    145  * @param feature Feature selector
    146  * @return Operation result
    147  */
    148139static inline int usb_hub_clear_port_feature(int hc, usb_address_t address,
    149140    int port_index,
Note: See TracChangeset for help on using the changeset viewer.