Skip to content

Commit

Permalink
Added comment to find_devices(), moved DeviceListNode to device.h
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola02nb committed Dec 10, 2024
1 parent 3ddc516 commit 0a7fb6c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions src/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,14 @@ struct device {
*/
int (*send_bluetooth_call_volume)(hid_device* hid_device, uint8_t num);
};

/**
* @brief Node structure for a linked list of devices.
*
* This structure represents a node in a linked list where each node contains a pointer to a device
* and a pointer to the next node in the list.
*/
typedef struct DeviceListNode {
struct device* element;
struct DeviceListNode* next;
} DeviceListNode;
15 changes: 10 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ int test_profile = 0;

int hsc_device_timeout = 5000;

typedef struct DeviceListNode {
struct device* element;
struct DeviceListNode* next;
} DeviceListNode;

/**
* @brief Finds and initializes a list of devices.
*
* This function allocates a list of devices.
* If the test_device flag is set, it attempts to add a test device to the list.
*
* @param device_list A pointer to the list of devices to be populated.
* @param test_device A flag indicating whether to add a test device to the list.
* @return The number of devices found and added to the list.
*/
static int find_devices(DeviceList** device_list, int test_device)
{
DeviceListNode* devices_found = malloc(sizeof(DeviceListNode));
Expand Down

0 comments on commit 0a7fb6c

Please sign in to comment.