Changeset e9f0348 in mainline


Ignore:
Timestamp:
2011-04-08T09:16:33Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c32a585a
Parents:
74a1ba9
Message:

Mouse driver integrated into the general HID driver.

Location:
uspace/drv/usbhid
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/Makefile

    r74a1ba9 re9f0348  
    4444        kbd/kbdrepeat.c \
    4545        generic/hiddev.c \
     46        mouse/mousedev.c \
    4647        $(STOLEN_LAYOUT_SOURCES)
    4748
  • uspace/drv/usbhid/usbhid.c

    r74a1ba9 re9f0348  
    4747#include "kbd/kbddev.h"
    4848#include "generic/hiddev.h"
    49 
    50 /*----------------------------------------------------------------------------*/
    51 
    52 /** Mouse polling endpoint description for boot protocol class. */
    53 static usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
    54         .transfer_type = USB_TRANSFER_INTERRUPT,
    55         .direction = USB_DIRECTION_IN,
    56         .interface_class = USB_CLASS_HID,
    57         .interface_subclass = USB_HID_SUBCLASS_BOOT,
    58         .interface_protocol = USB_HID_PROTOCOL_MOUSE,
    59         .flags = 0
    60 };
     49#include "mouse/mousedev.h"
     50
     51/*----------------------------------------------------------------------------*/
    6152
    6253/* Array of endpoints expected on the device, NULL terminated. */
     
    6859};
    6960
    70 static const char *HID_MOUSE_FUN_NAME = "mouse";
    71 static const char *HID_MOUSE_CLASS_NAME = "mouse";
    72 
    7361/*----------------------------------------------------------------------------*/
    7462
     
    9684/*----------------------------------------------------------------------------*/
    9785
    98 static bool usb_dummy_polling_callback(usb_device_t *dev, uint8_t *buffer,
    99      size_t buffer_size, void *arg)
    100 {
    101         usb_log_debug("Dummy polling callback.\n");
    102         return false;
    103 }
    104 
    105 /*----------------------------------------------------------------------------*/
    106 
    10786static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev)
    10887{
     
    125104               
    126105                // set the polling callback
    127                 hid_dev->poll_callback = usb_dummy_polling_callback;
     106                hid_dev->poll_callback = usb_mouse_polling_callback;
    128107               
    129108        } else if (dev->pipes[USB_HID_GENERIC_POLL_EP_NO].present) {
     
    161140            hid_dev->parser);
    162141       
    163         if (rc != EOK) {
     142        if (rc != EOK || hid_dev->device_type == USB_HID_PROTOCOL_MOUSE) {
    164143                usb_log_warning("Could not process report descriptor.\n");
    165144               
    166145                if (hid_dev->device_type == USB_HID_PROTOCOL_KEYBOARD) {
    167146                        usb_log_warning("Falling back to boot protocol.\n");
    168                        
    169147                        rc = usb_kbd_set_boot_protocol(hid_dev);
    170                        
    171148                } else if (hid_dev->device_type == USB_HID_PROTOCOL_MOUSE) {
    172                         usb_log_warning("No boot protocol for mouse yet.\n");
    173                         rc = ENOTSUP;
     149                        usb_log_warning("Falling back to boot protocol.\n");
     150                        rc = usb_mouse_set_boot_protocol(hid_dev);
    174151                }
    175152        }
     
    222199                break;
    223200        case USB_HID_PROTOCOL_MOUSE:
    224                 break;
    225         default:
    226 //              usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
    227 //                  hid_dev->usb_dev->interface_no, 0);
     201                rc = usb_mouse_init(hid_dev);
     202                if (rc != EOK) {
     203                        usb_log_warning("Failed to initialize Mouse structure."
     204                            "\n");
     205                }
     206                break;
     207        default:
    228208                break;
    229209        }
     
    291271                break;
    292272        case USB_HID_PROTOCOL_MOUSE:
     273                usb_mouse_deinit(*hid_dev);
    293274                break;
    294275        default:
  • uspace/drv/usbhid/usbhid.ma

    r74a1ba9 re9f0348  
    11100 usb&interface&class=HID&subclass=0x01&protocol=0x01
    2 100 usb&interface&class=HID&subclass=0x01&protocol=0x02
     21000 usb&interface&class=HID&subclass=0x01&protocol=0x02
    33100 usb&interface&class=HID
Note: See TracChangeset for help on using the changeset viewer.