Ignore:
File:
1 edited

Legend:

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

    ra6add7a radfe5ec  
    4444 * @return Error code.
    4545 */
    46 static int usbmouse_add_device(ddf_dev_t *dev)
     46static int usbmouse_add_device(usb_device_t *dev)
    4747{
    4848        int rc = usb_mouse_create(dev);
     
    5353        }
    5454
    55         fid_t poll_fibril = fibril_create(usb_mouse_polling_fibril, dev);
    56         if (poll_fibril == 0) {
    57                 usb_log_error("Failed to initialize polling fibril.\n");
    58                 /* FIXME: free allocated resources. */
    59                 return ENOMEM;
     55        usb_log_debug("Polling pipe at endpoint %d.\n", dev->pipes[0].pipe->endpoint_no);
     56
     57        rc = usb_device_auto_poll(dev, 0,
     58            usb_mouse_polling_callback, dev->pipes[0].pipe->max_packet_size,
     59            usb_mouse_polling_ended_callback, dev->driver_data);
     60
     61        if (rc != EOK) {
     62                usb_log_error("Failed to start polling fibril: %s.\n",
     63                    str_error(rc));
     64                return rc;
    6065        }
    6166
    62         fibril_add_ready(poll_fibril);
    63 
    6467        usb_log_info("controlling new mouse (handle %llu).\n",
    65             dev->handle);
     68            dev->ddf_dev->handle);
    6669
    6770        return EOK;
     
    6972
    7073/** USB mouse driver ops. */
    71 static driver_ops_t mouse_driver_ops = {
     74static usb_driver_ops_t mouse_driver_ops = {
    7275        .add_device = usbmouse_add_device,
    7376};
    7477
     78static usb_endpoint_description_t *endpoints[] = {
     79        &poll_endpoint_description,
     80        NULL
     81};
     82
    7583/** USB mouse driver. */
    76 static driver_t mouse_driver = {
     84static usb_driver_t mouse_driver = {
    7785        .name = NAME,
    78         .driver_ops = &mouse_driver_ops
     86        .ops = &mouse_driver_ops,
     87        .endpoints = endpoints
    7988};
    8089
     
    8392        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    8493
    85         return ddf_driver_main(&mouse_driver);
     94        return usb_driver_main(&mouse_driver);
    8695}
    8796
Note: See TracChangeset for help on using the changeset viewer.