Changeset f5246b6 in mainline for uspace/drv


Ignore:
Timestamp:
2011-03-04T22:48:24Z (15 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0e06a14
Parents:
3c775adb (diff), 03f7952 (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:

Development branch changes

Location:
uspace/drv
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/hiddev.c

    r3c775adb rf5246b6  
    206206        assert(endpoint_mapping[0].interface != NULL);
    207207       
     208        /*
     209         * Save polling interval
     210         */
     211        hid_dev->poll_interval = endpoint_mapping[0].descriptor->poll_interval;
     212        assert(hid_dev->poll_interval > 0);
     213       
    208214        rc = usbhid_dev_get_report_descriptor(hid_dev,
    209215            descriptors, descriptors_size,
  • uspace/drv/usbhid/hiddev.h

    r3c775adb rf5246b6  
    5757        usb_endpoint_pipe_t poll_pipe;
    5858       
     59        short poll_interval;
     60       
    5961        uint16_t iface;
    6062       
  • uspace/drv/usbhid/kbddev.c

    r3c775adb rf5246b6  
    593593
    594594        while (true) {
    595                 async_usleep(1000 * 10);
    596 
    597595                sess_rc = usb_endpoint_pipe_start_session(
    598596                    &kbd_dev->hid_dev->poll_pipe);
     
    635633                usb_log_debug("Calling usbhid_kbd_process_data()\n");
    636634                usbhid_kbd_process_data(kbd_dev, buffer, actual_size);
     635               
     636                async_usleep(kbd_dev->hid_dev->poll_interval);
    637637        }
    638638
  • uspace/drv/usbhub/usbhub.c

    r3c775adb rf5246b6  
    233233        dprintf(USB_LOG_LEVEL_DEBUG, "starting control transaction");
    234234        usb_endpoint_pipe_start_session(&result->endpoints.control);
     235        opResult = usb_request_set_configuration(&result->endpoints.control, 1);
     236        assert(opResult == EOK);
     237
    235238        opResult = usb_request_get_descriptor(&result->endpoints.control,
    236239                        USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE,
     
    243246                dprintf(USB_LOG_LEVEL_ERROR, "failed when receiving hub descriptor, badcode = %d",opResult);
    244247                free(serialized_descriptor);
    245                 return result;
     248                free(result);
     249                return NULL;
    246250        }
    247251        dprintf(USB_LOG_LEVEL_DEBUG2, "deserializing descriptor");
     
    249253        if(descriptor==NULL){
    250254                dprintf(USB_LOG_LEVEL_WARNING, "could not deserialize descriptor ");
    251                 result->port_count = 1;///\TODO this code is only for debug!!!
    252                 return result;
     255                free(result);
     256                return NULL;
    253257        }
    254258
     
    286290
    287291        usb_hub_info_t * hub_info = usb_create_hub_info(dev);
     292        if(!hub_info){
     293                return EINTR;
     294        }
    288295
    289296        int opResult;
     
    294301        opResult = usb_hub_process_configuration_descriptors(hub_info);
    295302        if(opResult != EOK){
    296                 dprintf(USB_LOG_LEVEL_ERROR,"could not get condiguration descriptors, %d",
     303                dprintf(USB_LOG_LEVEL_ERROR,"could not get configuration descriptors, %d",
    297304                                opResult);
    298305                return opResult;
  • uspace/drv/usbmouse/main.c

    r3c775adb rf5246b6  
    7474int main(int argc, char *argv[])
    7575{
    76         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     76        usb_log_enable(USB_LOG_LEVEL_DEBUG2, NAME);
    7777
    7878        return ddf_driver_main(&mouse_driver);
  • uspace/drv/usbmouse/mouse.c

    r3c775adb rf5246b6  
    3737#include <usb/debug.h>
    3838#include <errno.h>
     39#include <str_error.h>
    3940#include <ipc/mouse.h>
    4041
     
    6465
    6566                size_t actual_size;
     67                int rc;
    6668
    67                 /* FIXME: check for errors. */
    68                 usb_endpoint_pipe_start_session(&mouse->poll_pipe);
     69                /*
     70                 * Error checking note:
     71                 * - failure when starting a session is considered
     72                 *   temporary (e.g. out of phones, next try might succeed)
     73                 * - failure of transfer considered fatal (probably the
     74                 *   device was unplugged)
     75                 * - session closing not checked (shall not fail anyway)
     76                 */
    6977
    70                 usb_endpoint_pipe_read(&mouse->poll_pipe,
     78                rc = usb_endpoint_pipe_start_session(&mouse->poll_pipe);
     79                if (rc != EOK) {
     80                        usb_log_warning("Failed to start session, will try again: %s.\n",
     81                            str_error(rc));
     82                        continue;
     83                }
     84
     85                rc = usb_endpoint_pipe_read(&mouse->poll_pipe,
    7186                    buffer, buffer_size, &actual_size);
    7287
    7388                usb_endpoint_pipe_end_session(&mouse->poll_pipe);
     89
     90                if (rc != EOK) {
     91                        usb_log_error("Failed reading mouse input: %s.\n",
     92                            str_error(rc));
     93                        break;
     94                }
     95
     96                usb_log_debug2("got buffer: %s.\n",
     97                    usb_debug_str_buffer(buffer, buffer_size, 0));
    7498
    7599                uint8_t butt = buffer[0];
     
    115139        }
    116140
     141        /*
     142         * Device was probably unplugged.
     143         * Hang-up the phone to the console.
     144         * FIXME: release allocated memory.
     145         */
     146        async_hangup(mouse->console_phone);
     147        mouse->console_phone = -1;
     148
     149        usb_log_error("Mouse polling fibril terminated.\n");
     150
    117151        return EOK;
    118152}
Note: See TracChangeset for help on using the changeset viewer.