Skip to content

Commit

Permalink
Set the device name in new_from_path() to override the fallback name
Browse files Browse the repository at this point in the history
Otherwise our fallback device is just called "Generic".
  • Loading branch information
whot committed Jun 19, 2024
1 parent 6a802c1 commit 76ab3e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions libwacom/libwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal

builder = libwacom_builder_new();
libwacom_builder_set_match_name(builder, name);
libwacom_builder_set_device_name(builder, name);
libwacom_builder_set_bustype(builder, bus);
libwacom_builder_set_uniq(builder, uniq);
libwacom_builder_set_usbid(builder, vendor_id, product_id);
Expand Down
5 changes: 4 additions & 1 deletion test/test_libwacom.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ def test_new_unknown_device_with_fallback(custom_datadir, fallback, bustype):
USBID = (0x1234, 0x5678)
NAME = "nameval"
db = WacomDatabase(path=custom_datadir)
builder = WacomBuilder.create(usbid=USBID, bus=bustype, match_name=NAME)
builder = WacomBuilder.create(
usbid=USBID, bus=bustype, match_name=NAME, device_name=NAME
)

device = db.new_from_builder(builder, fallback=fallback)
if fallback:
Expand All @@ -397,5 +399,6 @@ def test_new_unknown_device_with_fallback(custom_datadir, fallback, bustype):
assert device.bustype == WacomBustype.UNKNOWN
assert device.vendor_id == 0
assert device.product_id == 0
assert device.name == NAME
else:
assert device is None

0 comments on commit 76ab3e2

Please sign in to comment.