Skip to content

Class task functions might not be called in standalone mode with multiple classes #235

@porkfreezer

Description

@porkfreezer

Describe the bug
In standalone mode with multiple classes, the task functions for later classes in the class array are not called unless all preceding classes have task functions defined.

class_instance = _ux_system_slave -> ux_system_slave_class_array;
for (class_index = 0; class_index < UX_SYSTEM_DEVICE_MAX_CLASS_GET(); class_index++)
{
/* Skip classes not used. */
if (class_instance -> ux_slave_class_status == UX_UNUSED)
continue;
/* Skip classes has no task function. */
if (class_instance -> ux_slave_class_task_function == UX_NULL)
continue;
/* Invoke task function. */
status |= class_instance -> ux_slave_class_task_function(class_instance -> ux_slave_class_instance);
/* Move to the next class. */
class_instance ++;
}

If the first instance doesn't have a task function, the following class instances are not checked, since class_instance isn't incremented unless the task function was actually called. I moved class_instance++ into the for loop on L90 to fix this.

To Reproduce
Steps to reproduce the behavior:

  1. Use standalone mode.
  2. Use a class without a task function (e.g. CDC-ACM) followed by a class with a task function (e.g. Audio).
  3. Audio class task function is never called, so audio class does not work.

Expected behavior
Task functions are called for all class instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions