Ignore:
File:
1 edited

Legend:

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

    r5097bed4 rf40a1e2  
    4646#include "usbhub_private.h"
    4747#include "port_status.h"
     48#include "usb/usb.h"
    4849
    4950static usb_iface_t hub_usb_iface = {
     
    8586
    8687        // 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);
    9388
    9489        //printf("[usb_hub] creating serialized descriptor\n");
     
    9893        int opResult;
    9994        //printf("[usb_hub] starting control transaction\n");
    100         opResult = usb_drv_sync_control_read(
    101                         hc, target, &request, serialized_descriptor,
     95       
     96        opResult = usb_drv_req_get_descriptor(hc, addr,
     97                        USB_REQUEST_TYPE_CLASS,
     98                        USB_DESCTYPE_HUB, 0, 0, serialized_descriptor,
    10299                        USB_HUB_MAX_DESCRIPTOR_SIZE, &received_size);
     100
    103101        if (opResult != EOK) {
    104102                dprintf(1,"[usb_hub] failed when receiving hub descriptor, badcode = %d",opResult);
     
    155153        int port;
    156154        int opResult;
    157         usb_device_request_setup_packet_t request;
    158155        usb_target_t target;
    159156        target.address = hub_info->usb_device->address;
     
    173170        if(std_descriptor.configuration_count<1){
    174171                dprintf(1,"[usb_hub] THERE ARE NO CONFIGURATIONS AVAILABLE");
     172                //shouldn`t I return?
    175173        }
    176174        /// \TODO check other configurations
     
    184182        }
    185183        //set configuration
    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);
     184        opResult = usb_drv_req_set_configuration(hc, target.address,
     185    config_descriptor.configuration_number);
     186
    193187        if (opResult != EOK) {
    194188                dprintf(1,"[usb_hub]something went wrong when setting hub`s configuration, %d", opResult);
    195189        }
    196190
     191        usb_device_request_setup_packet_t request;
    197192        for (port = 1; port < hub_info->port_count+1; ++port) {
    198193                usb_hub_set_power_port_request(&request, port);
     
    229224
    230225
    231 
    232226//*********************************************
    233227//
     
    237231
    238232/**
    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)
     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).
    241235 * @param hc
    242236 * @return
     
    253247
    254248/**
    255  * reset the port with new device and reserve the default address
     249 * Reset the port with new device and reserve the default address.
    256250 * @param hc
    257251 * @param port
     
    282276
    283277/**
    284  * finalize adding new device after port reset
     278 * Finalize adding new device after port reset
    285279 * @param hc
    286280 * @param port
     
    345339
    346340/**
    347  * unregister device address in hc
     341 * Unregister device address in hc
    348342 * @param hc
    349343 * @param port
     
    355349        int opResult;
    356350       
    357         /// \TODO remove device
     351        /** \TODO remove device from device manager - not yet implemented in
     352         * devide manager
     353         */
    358354
    359355        hub->attached_devs[port].devman_handle=0;
     
    376372
    377373/**
    378  * process interrupts on given hub port
     374 * Process interrupts on given hub port
    379375 * @param hc
    380376 * @param port
     
    434430        usb_port_set_reset_completed(&status, false);
    435431        usb_port_set_dev_connected(&status, false);
    436         if (status) {
    437                 dprintf(1,"[usb_hub]there was some unsupported change on port %d",port);
     432        if (status>>16) {
     433                dprintf(1,"[usb_hub]there was some unsupported change on port %d: %X",port,status);
     434
    438435        }
    439436        /// \TODO handle other changes
     
    442439}
    443440
    444 /* Check changes on all known hubs.
     441/**
     442 * Check changes on all known hubs.
    445443 */
    446444void usb_hub_check_hub_changes(void) {
Note: See TracChangeset for help on using the changeset viewer.