Changeset 7c169ce in mainline for uspace/drv


Ignore:
Timestamp:
2011-01-21T13:01:58Z (15 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2b1548
Parents:
6336b6e (diff), a1d12f4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged development

Location:
uspace/drv
Files:
9 edited

Legend:

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

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

    r6336b6e r7c169ce  
    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) {
  • uspace/drv/usbhub/usbhub_private.h

    r6336b6e r7c169ce  
    3131 */
    3232/** @file
    33  * @brief Hub driver.
     33 * @brief Hub driver private definitions
    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 for data
    94  * @param rcvd_buffer received data
     93 * @param request Request packet
     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 to send data
     111 * @param request Request packet 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 */
    139148static inline int usb_hub_clear_port_feature(int hc, usb_address_t address,
    140149    int port_index,
  • uspace/drv/usbkbd/Makefile

    r6336b6e r7c169ce  
    3636        descparser.c \
    3737        descdump.c \
    38         conv.c
     38        conv.c \
     39        us_qwerty.c
    3940
    4041include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/usbkbd/descparser.c

    r6336b6e r7c169ce  
    187187                case USB_DESCTYPE_HID:
    188188                        if (desc_size < sizeof(usb_standard_hid_descriptor_t)) {
    189                                 printf("Wrong size of descriptor: %d (should be %d)\n",
     189                                printf("Wrong size of descriptor: %d (should be %zu)\n",
    190190                                    desc_size, sizeof(usb_standard_hid_descriptor_t));
    191191                                ret = EINVAL;
  • uspace/drv/usbkbd/main.c

    r6336b6e r7c169ce  
    4242#include "descdump.h"
    4343#include "conv.h"
     44#include "layout.h"
    4445
    4546#define BUFFER_SIZE 32
     
    125126static unsigned lock_keys;
    126127
     128#define NUM_LAYOUTS 3
     129
     130static layout_op_t *layout[NUM_LAYOUTS] = {
     131        &us_qwerty_op,
     132        &us_dvorak_op,
     133        &cz_op
     134};
     135
    127136// TODO: put to device?
    128 //static int active_layout = 0;
     137static int active_layout = 0;
    129138
    130139static void kbd_push_ev(int type, unsigned int key)
     
    206215        ev.mods = mods;
    207216
    208         //ev.c = layout[active_layout]->parse_ev(&ev);
     217        ev.c = layout[active_layout]->parse_ev(&ev);
    209218
    210219        printf("Sending key %d to the console\n", ev.key);
    211220        assert(console_callback_phone != -1);
    212         async_msg_4(console_callback_phone, KBD_EVENT, ev.type, ev.key, ev.mods, 0);
     221        async_msg_4(console_callback_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
    213222}
    214223/*
     
    405414        //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks,
    406415        //    NULL);
    407 //      printf("Calling usb_hid_boot_keyboard_input_report() with size %d\n",
    408 //          actual_size);
    409 //      dump_buffer("bufffer: ", buffer, actual_size);
     416        printf("Calling usb_hid_boot_keyboard_input_report() with size %d\n",
     417            actual_size);
     418        //dump_buffer("bufffer: ", buffer, actual_size);
    410419        int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size, callbacks,
    411420            NULL);
     
    457466                 */
    458467                if (actual_size == 0) {
    459                         printf("Keyboar returned NAK\n");
     468                        printf("Keyboard returned NAK\n");
    460469                        continue;
    461470                }
     
    465474                 */
    466475                printf("Calling usbkbd_process_interrupt_in()\n");
    467                 // actual_size is not set, workaround...
    468                 usbkbd_process_interrupt_in(kbd_dev, buffer, /*actual_size*/8);
     476                usbkbd_process_interrupt_in(kbd_dev, buffer, actual_size);
    469477        }
    470478
  • uspace/drv/vhc/devices.c

    r6336b6e r7c169ce  
    138138                } else {
    139139                        async_wait_for(req, &answer_rc);
     140                        transaction->actual_len = IPC_GET_ARG1(answer_data);
    140141                        rc = (int)answer_rc;
    141142                }
  • uspace/drv/vhc/hc.c

    r6336b6e r7c169ce  
    9696            usb_str_transaction_outcome(outcome));
    9797       
    98         transaction->callback(transaction->buffer, transaction->len, outcome,
    99             transaction->callback_arg);
     98        transaction->callback(transaction->buffer, transaction->actual_len,
     99            outcome, transaction->callback_arg);
    100100}
    101101
     
    169169        transaction->buffer = buffer;
    170170        transaction->len = len;
     171        transaction->actual_len = len;
    171172        transaction->callback = callback;
    172173        transaction->callback_arg = arg;
  • uspace/drv/vhc/hc.h

    r6336b6e r7c169ce  
    6565        /** Transaction data length. */
    6666        size_t len;
     67        /** Data length actually transfered. */
     68        size_t actual_len;
    6769        /** Callback after transaction is done. */
    6870        hc_transaction_done_callback_t callback;
Note: See TracChangeset for help on using the changeset viewer.