application: add load check and update cable check
This commit is contained in:
parent
f93644d127
commit
dfa24b30a8
|
@ -134,6 +134,10 @@ static void command_intra(void* argument)
|
||||||
printf("= intra-connector check =\n");
|
printf("= intra-connector check =\n");
|
||||||
for (uint8_t connector = 0; connector < LENGTH(usb_connectors); connector++) { // test from every connector
|
for (uint8_t connector = 0; connector < LENGTH(usb_connectors); connector++) { // test from every connector
|
||||||
printf("- %s -\n", usb_connectors[connector]->name);
|
printf("- %s -\n", usb_connectors[connector]->name);
|
||||||
|
bool loaded = usb_cables_check_load(usb_connectors[connector]);
|
||||||
|
if (loaded) {
|
||||||
|
printf("there is %s load on the connector\n", loaded ? "a" : "no");
|
||||||
|
}
|
||||||
usb_cables_check_intra(usb_connectors[connector], NULL);
|
usb_cables_check_intra(usb_connectors[connector], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,9 +172,9 @@ static void command_cables(void* argument)
|
||||||
// step 2: check for known cable configuration
|
// step 2: check for known cable configuration
|
||||||
printf("= cable check =\n");
|
printf("= cable check =\n");
|
||||||
for (uint8_t cable = 0; cable < LENGTH(usb_cables); cable++) { // test every cable
|
for (uint8_t cable = 0; cable < LENGTH(usb_cables); cable++) { // test every cable
|
||||||
uint8_t pair_defined, pair_undefined, pair_disconnected, pair_error;
|
uint8_t pair_defined, pair_undefined, pair_disconnected;
|
||||||
bool result = usb_cables_check_cable(&usb_cables[cable], &pair_defined, &pair_undefined, &pair_disconnected, &pair_error);
|
bool result = usb_cables_check_cable(&usb_cables[cable], &pair_defined, &pair_undefined, &pair_disconnected);
|
||||||
printf("%s: %s (defined=%u, undefined=%u, disconnected=%u, error=%u)\n", result ? "OK" : "KO", usb_cables[cable].name, pair_defined, pair_undefined, pair_disconnected, pair_error);
|
printf("%s: %s (defined=%u, undefined=%u, disconnected=%u:)\n", result ? "OK" : "KO", usb_cables[cable].name, pair_defined, pair_undefined, pair_disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_pins_float(); // put all pins back in safe floating state
|
usb_pins_float(); // put all pins back in safe floating state
|
||||||
|
@ -241,8 +245,8 @@ static void command_find(void* argument)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// the connector match
|
// the connector match
|
||||||
uint8_t pair_defined, pair_undefined, pair_disconnected, pair_error;
|
uint8_t pair_defined, pair_undefined, pair_disconnected;
|
||||||
match = usb_cables_check_cable(&usb_cables[cable], &pair_defined, &pair_undefined, &pair_disconnected, &pair_error);
|
match = usb_cables_check_cable(&usb_cables[cable], &pair_defined, &pair_undefined, &pair_disconnected);
|
||||||
if (match) {
|
if (match) {
|
||||||
matches++;
|
matches++;
|
||||||
printf("- %s\n", usb_cables[cable].name);
|
printf("- %s\n", usb_cables[cable].name);
|
||||||
|
@ -441,10 +445,10 @@ static void command_test(void* argument)
|
||||||
}
|
}
|
||||||
bool cable_ok = false; // if the cable is connected
|
bool cable_ok = false; // if the cable is connected
|
||||||
while (!cable_ok) { // wait until all pin pairs of cable are connected
|
while (!cable_ok) { // wait until all pin pairs of cable are connected
|
||||||
uint8_t defined, undefined, disconnected, error; // pair counting variables
|
uint8_t defined, undefined, disconnected; // pair counting variables
|
||||||
cable_ok = usb_cables_check_cable(&test_cables[cable], &defined, &undefined, &disconnected, &error); // test cable
|
cable_ok = usb_cables_check_cable(&test_cables[cable], &defined, &undefined, &disconnected); // test cable
|
||||||
if (!cable_ok && defined > 0) { // not all pairs are connected
|
if (!cable_ok && defined > 0) { // not all pairs are connected
|
||||||
printf("connection issues: defined=%u/%u, undefined=%u, disconnected=%u, error=%u\n", defined, test_cables[cable].pin_pairs_nb, undefined, disconnected, error); // show issue summary
|
printf("connection issues: defined=%u/%u, undefined=%u, disconnected=%u\n", defined, test_cables[cable].pin_pairs_nb, undefined, disconnected); // show issue summary
|
||||||
}
|
}
|
||||||
if (!cable_ok) {
|
if (!cable_ok) {
|
||||||
if (user_input_available) { // user interruption
|
if (user_input_available) { // user interruption
|
||||||
|
|
Loading…
Reference in New Issue