diff options
Diffstat (limited to 'src/device.c')
| -rw-r--r-- | src/device.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c index 29be9d1..0844499 100644 --- a/src/device.c +++ b/src/device.c | |||
| @@ -746,10 +746,15 @@ int device_get_count(int include_hidden) | |||
| 746 | return count; | 746 | return count; |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | int device_get_list(int include_hidden, struct device_info *p) | 749 | int device_get_list(int include_hidden, struct device_info **devices) |
| 750 | { | 750 | { |
| 751 | int count = 0; | 751 | int count = 0; |
| 752 | pthread_mutex_lock(&device_list_mutex); | 752 | pthread_mutex_lock(&device_list_mutex); |
| 753 | |||
| 754 | int total_count = collection_count(&device_list); | ||
| 755 | *devices = malloc(sizeof(struct device_info) * total_count); | ||
| 756 | struct device_info *p = *devices; | ||
| 757 | |||
| 753 | FOREACH(struct mux_device *dev, &device_list) { | 758 | FOREACH(struct mux_device *dev, &device_list) { |
| 754 | if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) { | 759 | if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) { |
| 755 | p->id = dev->id; | 760 | p->id = dev->id; |
