Changeset 8b71f3e in mainline for uspace/drv/hid/usbhid/main.c


Ignore:
Timestamp:
2018-01-14T21:16:03Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17c1d9db
Parents:
edc51615
git-author:
Petr Manek <petr.manek@…> (2018-01-14 21:16:00)
git-committer:
Petr Manek <petr.manek@…> (2018-01-14 21:16:03)
Message:

usbdev: refactor polling more

For clarity, the opaque usb_device_polling_t and its complementary
configuration data structure usb_device_polling_config_t have been
merged into usb_polling_t. All related methods have dropped the
"device" from their prefix as well.

The usage semantics have transitioned to malloc-free model, where the
user is entirely responsible for (de)allocation of the polling structure
and its data buffer, and (de)initialization happens in designated
functions during its lifetime in the system.

In addition, the distinction between mandatory / optional / internal
parameters has been documented. Optional parameters now have default
values, which are set to sensible constants in order to allow dropping
some lines in USB driver implementations.

The drivers usbhid and usbhub were refactored to match the API
changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/usbhid/main.c

    redc51615 r8b71f3e  
    8989         * This will create a separate fibril that will query the device
    9090         * for the data continuously. */
    91         const usb_device_polling_config_t config = {
    92                 .debug = 1,
    93                 .auto_clear_halt = true,
    94                 .delay = -1,
    95                 .max_failures = 3,
    96                 .on_data = usb_hid_polling_callback,
    97                 .on_polling_end = usb_hid_polling_ended_callback,
    98                 .on_error = usb_hid_polling_error_callback,
    99                 .arg = hid_dev,
    100         };
    101 
    102         rc = usb_device_poll(dev, hid_dev->poll_pipe_mapping, &config,
    103             hid_dev->poll_pipe_mapping->pipe.desc.max_transfer_size, &hid_dev->polling);
     91        rc = usb_polling_start(&hid_dev->polling);
    10492
    10593        if (rc != EOK) {
     
    122110        assert(hid_dev);
    123111
    124         /* Join polling fibril. */
    125         usb_device_poll_join(hid_dev->polling);
     112        /* Join polling fibril (ignoring error code). */
     113        usb_polling_join(&hid_dev->polling);
    126114
    127115        /* Clean up. */
Note: See TracChangeset for help on using the changeset viewer.