Report whether other devices are sharing the USB bus.

This commit is contained in:
Martin Ling
2024-09-26 10:56:37 +01:00
parent 390837715b
commit b3bf7a1b70
3 changed files with 53 additions and 0 deletions

View File

@@ -254,6 +254,23 @@ int main(void)
hackrf_error_name(result),
result);
}
result = hackrf_device_list_bus_sharing(list, i);
if (result < 0) {
fprintf(stderr,
"hackrf_device_list_bus_sharing() failed: %s (%d)\n",
hackrf_error_name(result),
result);
} else if (result == 0) {
printf("This device is on its own USB bus.\n");
} else if (result == 1) {
printf("There is 1 other device on the same USB bus.\n"
"You may have problems at high sample rates.\n");
} else {
printf("There are %d other devices on the same USB bus.\n"
"You may have problems at high sample rates.\n",
result);
}
}
hackrf_device_list_free(list);