application: add ground check to find cable
This commit is contained in:
parent
eaed513dec
commit
d7223dd518
|
@ -584,6 +584,25 @@ static void command_find(void* argument)
|
|||
|
||||
printf("= finding cable =\n");
|
||||
|
||||
bool ground_connectors[LENGTH(usb_connectors)];
|
||||
bool ground_connected = usb_cables_test_ground(usb_connectors, LENGTH(usb_connectors), ground_connectors);
|
||||
if (ground_connected) {
|
||||
puts("connectors connected by ground:\n");
|
||||
for (uint8_t i = 0; i < LENGTH(ground_connectors) && i < LENGTH(usb_connectors); i++) {
|
||||
if (!ground_connectors[i]) {
|
||||
continue;
|
||||
}
|
||||
const struct usb_connector_t* connector = usb_connectors[i];
|
||||
printf("- %s", connector->name);
|
||||
if (connector->variant) {
|
||||
printf(" (%s)", connector->variant);
|
||||
}
|
||||
putc('\n');
|
||||
}
|
||||
} else {
|
||||
puts("no ground connection found between connectors\n");
|
||||
}
|
||||
|
||||
struct cable_t* cable = calloc(1, sizeof(struct cable_t)); // structure to store cable information
|
||||
if (NULL == cable) { // not enough memory for allocation
|
||||
return;
|
||||
|
@ -601,7 +620,7 @@ static void command_find(void* argument)
|
|||
|
||||
// find connected connectors
|
||||
cable_connectors(cable);
|
||||
printf("%u connectors connected:\n", cable->connectors_nb);
|
||||
puts("connectors connected by any signal:\n");
|
||||
for (uint8_t i = 0; i < LENGTH(cable->connectors) && i < LENGTH(usb_connectors); i++) {
|
||||
if (cable->connectors[i]) {
|
||||
printf("- %s", usb_connectors[i]->name);
|
||||
|
@ -655,7 +674,7 @@ static void command_find(void* argument)
|
|||
goto end;
|
||||
}
|
||||
printf("closest matching cable: %s\n", usb_cable->name);
|
||||
printf("%u connection issue(s) (%u unconnected, %u unspecified)\n", issues, cable->unconnected_nb[cable->cable_best], cable->unspecified_nb[cable->cable_best]);
|
||||
printf("connection issue(s): %u (%u unconnected, %u unspecified)\n", issues, cable->unconnected_nb[cable->cable_best], cable->unspecified_nb[cable->cable_best]);
|
||||
if (cable->unconnected_nb[cable->cable_best] > 0) {
|
||||
printf("unconnected pins:\n");
|
||||
for (uint16_t i = 0; i < cable->unconnected_nb[cable->cable_best]; i++) {
|
||||
|
|
Loading…
Reference in New Issue