linux: Don't throw debug errors unless needed

It's really confusing seeing "not a switch [...]" when we actually
managed to find a switch, so throw 2 errors in the debug when both
checks fail, rather than as things are being tested.
This commit is contained in:
Bastien Nocera 2020-11-05 16:13:43 +01:00
parent 47481f3a57
commit 522fb6fff2

View file

@ -182,13 +182,16 @@ up_input_coldplug (UpInput *input, GUdevDevice *d)
/* is a switch */
path = g_build_filename (native_path, "../capabilities/sw", NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
g_debug ("not a switch [%s]", path);
g_free (path);
path = g_build_filename (native_path, "capabilities/sw", NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
char *path2;
path2 = g_build_filename (native_path, "capabilities/sw", NULL);
if (!g_file_test (path2, G_FILE_TEST_EXISTS)) {
g_debug ("not a switch [%s]", path);
g_debug ("not a switch [%s]", path2);
g_free (path2);
goto out;
}
g_free (path);
path = path2;
}
/* get caps */