Skip to content

Commit

Permalink
Allow to match by uniq without name
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseExposito committed Apr 21, 2024
1 parent 37b105e commit 4904fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libwacom/libwacom-database.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ bus_to_str (WacomBusType bus)
char *
make_match_string (const char *name, const char *uniq, WacomBusType bus, int vendor_id, int product_id)
{
return g_strdup_printf("%s|%04x|%04x%s%s%s%s",
return g_strdup_printf("%s|%04x|%04x%s%s%s%s%s",
bus_to_str (bus),
vendor_id, product_id,
name ? "|" : "",
name ? name : "",
!name && uniq ? "|" : "",
uniq ? "|" : "",
uniq ? uniq : "");
}
Expand Down
4 changes: 4 additions & 0 deletions libwacom/libwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
if (device == NULL) {
match_name = NULL;
device = libwacom_new (db, match_name, match_uniq, vendor_id, product_id, bus, error);
if (device == NULL) {
match_uniq = uniq;
device = libwacom_new (db, match_name, match_uniq, vendor_id, product_id, bus, error);
}
}
}

Expand Down

0 comments on commit 4904fb8

Please sign in to comment.