Ignore:
File:
1 edited

Legend:

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

    radfe5ec ra6add7a  
    4444 * @return Error code.
    4545 */
    46 static int usbmouse_add_device(usb_device_t *dev)
     46static int usbmouse_add_device(ddf_dev_t *dev)
    4747{
    4848        int rc = usb_mouse_create(dev);
     
    5353        }
    5454
    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;
     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;
    6560        }
    6661
     62        fibril_add_ready(poll_fibril);
     63
    6764        usb_log_info("controlling new mouse (handle %llu).\n",
    68             dev->ddf_dev->handle);
     65            dev->handle);
    6966
    7067        return EOK;
     
    7269
    7370/** USB mouse driver ops. */
    74 static usb_driver_ops_t mouse_driver_ops = {
     71static driver_ops_t mouse_driver_ops = {
    7572        .add_device = usbmouse_add_device,
    7673};
    7774
    78 static usb_endpoint_description_t *endpoints[] = {
    79         &poll_endpoint_description,
    80         NULL
    81 };
    82 
    8375/** USB mouse driver. */
    84 static usb_driver_t mouse_driver = {
     76static driver_t mouse_driver = {
    8577        .name = NAME,
    86         .ops = &mouse_driver_ops,
    87         .endpoints = endpoints
     78        .driver_ops = &mouse_driver_ops
    8879};
    8980
     
    9283        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    9384
    94         return usb_driver_main(&mouse_driver);
     85        return ddf_driver_main(&mouse_driver);
    9586}
    9687
Note: See TracChangeset for help on using the changeset viewer.