Skip to content

Commit

Permalink
database: explicitly say in the warnings that we're ignoring that entry
Browse files Browse the repository at this point in the history
If an entry causes a warning, say that it is being ignored instead of
just printing an "invalid stylus" warning. Also warn if our database is
empty.
  • Loading branch information
whot committed Oct 29, 2024
1 parent e4a923c commit 656012f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions libwacom/libwacom-database.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ libwacom_parse_stylus_keyfile(WacomDeviceDatabase *db, const char *path)
char **string_list;

if (!parse_stylus_id(groups[i], &id)) {
g_warning ("Failed to parse stylus ID '%s'", groups[i]);
g_warning ("Failed to parse stylus ID '%s', ignoring entry", groups[i]);
continue;
}
stylus = g_new0 (WacomStylus, 1);
Expand Down Expand Up @@ -402,7 +402,7 @@ libwacom_setup_paired_attributes(WacomDeviceDatabase *db)
WacomStylus *paired = g_hash_table_lookup(db->stylus_ht, id);

if (paired == NULL) {
g_warning ("Invalid paired stylus %04x:%x", id->vid, id->tool_id);
g_warning ("Ignoring paired stylus %04x:%x", id->vid, id->tool_id);
continue;
}

Expand Down Expand Up @@ -756,9 +756,9 @@ libwacom_parse_styli_list(WacomDeviceDatabase *db, WacomDevice *device,
if (stylus)
g_array_append_val (array, stylus);
else
g_warning ("Invalid stylus id for '%s'!", str);
g_warning ("Invalid stylus id for '%s', ignoring stylus", str);
} else {
g_warning ("Invalid stylus id format for '%s'!", str);
g_warning ("Invalid stylus id format for '%s', ignoring stylus", str);
}
} else if (g_str_has_prefix(str, "@")) {
const char *group = &str[1];
Expand All @@ -773,7 +773,7 @@ libwacom_parse_styli_list(WacomDeviceDatabase *db, WacomDevice *device,
}
}
} else {
g_warning ("Invalid prefix for '%s'!", str);
g_warning ("Invalid prefix for '%s', ignoring stylus", str);
}
}
/* Using groups means we don't get the styli in ascending order.
Expand Down Expand Up @@ -929,7 +929,7 @@ libwacom_parse_tablet_keyfile(WacomDeviceDatabase *db,
}
}
if (!found)
g_warning ("Unrecognized integration flag '%s'", string_list[i]);
g_warning ("Unrecognized integration flag '%s', ignoring flag", string_list[i]);
}
g_strfreev (string_list);
}
Expand Down Expand Up @@ -973,8 +973,10 @@ libwacom_parse_tablet_keyfile(WacomDeviceDatabase *db,
g_key_file_free(keyfile);
if (error)
g_error_free(error);
if (!success)
if (!success) {
g_warning("Ignoring invalid .tablet file %s", filename);
device = libwacom_unref(device);
}

return device;
}
Expand Down Expand Up @@ -1159,8 +1161,10 @@ database_new_for_paths (char * const *datadirs)

/* If we couldn't load _anything_ then something's wrong */
if (g_hash_table_size (db->stylus_ht) == 0 ||
g_hash_table_size (db->device_ht) == 0)
g_hash_table_size (db->device_ht) == 0) {
g_warning("Zero tablet or stylus files found in datadirs");
goto error;
}

libwacom_setup_paired_attributes(db);

Expand Down

0 comments on commit 656012f

Please sign in to comment.