Changeset 60c0573 in mainline for uspace/drv/usbhid/mouse/mousedev.c


Ignore:
Timestamp:
2011-04-10T15:17:22Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba358ed
Parents:
dc4c19e
Message:

Preparation for HID subdrivers.

  • Preparation for registering subdriver callbacks based on some device identifiers.
  • HID driver now uses one general callback which calls all the registered subdriver callbacks.
  • Other callbacks for init, deinit and polling ended.
  • Setting boot keyboard and mouse callbacks separately (special cases).

TODO maybe also functions and function classes may be per-subdriver

(so a hybrid keyboard/pointing device may register itself as

both keyboard and mouse).

TODO the current keyboard and mouse subdrivers should fall back to the

booot protocol by default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/mouse/mousedev.c

    rdc4c19e r60c0573  
    231231/*----------------------------------------------------------------------------*/
    232232
    233 int usb_mouse_init(struct usb_hid_dev_t *hid_dev)
     233int usb_mouse_init(usb_hid_dev_t *hid_dev)
    234234{
    235235        usb_log_debug("Initializing HID/Mouse structure...\n");
     
    252252       
    253253        // set handler for incoming calls
    254         // TODO: now does this behave when we have more such handlers in
    255         //       one actual driver??
    256254        hid_dev->ops.default_handler = default_connection_handler;
    257255       
    258256        // TODO: how to know if the device supports the request???
    259 //      usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
    260 //          hid_dev->usb_dev->interface_no, IDLE_RATE);
     257        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
     258            hid_dev->usb_dev->interface_no, IDLE_RATE);
    261259       
    262260        return EOK;
     
    265263/*----------------------------------------------------------------------------*/
    266264
    267 bool usb_mouse_polling_callback(usb_device_t *dev, uint8_t *buffer,
    268      size_t buffer_size, void *arg)
     265bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, uint8_t *buffer,
     266     size_t buffer_size)
    269267{
    270268        usb_log_debug("usb_mouse_polling_callback()\n");
    271269        usb_debug_str_buffer(buffer, buffer_size, 0);
    272270       
    273         if (arg == NULL) {
     271        if (hid_dev == NULL) {
    274272                usb_log_error("Missing argument to the mouse polling callback."
    275273                    "\n");
     
    277275        }
    278276       
    279         usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
    280277        if (hid_dev->data == NULL) {
    281278                usb_log_error("Wrong argument to the mouse polling callback."
     
    290287/*----------------------------------------------------------------------------*/
    291288
    292 void usb_mouse_deinit(struct usb_hid_dev_t *hid_dev)
     289void usb_mouse_deinit(usb_hid_dev_t *hid_dev)
    293290{
    294291        usb_mouse_free((usb_mouse_t **)&hid_dev->data);
     
    297294/*----------------------------------------------------------------------------*/
    298295
    299 int usb_mouse_set_boot_protocol(struct usb_hid_dev_t *hid_dev)
     296int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
    300297{
    301298        int rc = usb_hid_parse_report_descriptor(hid_dev->parser,
Note: See TracChangeset for help on using the changeset viewer.