Skip to content

Commit

Permalink
Random debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths committed Apr 15, 2024
1 parent dbbec03 commit 15586ef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/platforms/evdev/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ std::string describe(libinput_device* dev)
auto const udev_dev = mir::raii::deleter_for(libinput_device_get_udev_device(dev), &udev_device_unref);
std::string desc(udev_device_get_devnode(udev_dev.get()));

#ifdef ARG_DEBUGGING
for (auto entry = udev_device_get_properties_list_entry(udev_dev.get()); entry; entry = udev_list_entry_get_next(entry))
{
mir::log_debug("{arg} property '%s=%s'", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
}
for (auto entry = udev_device_get_tags_list_entry(udev_dev.get()); entry; entry = udev_list_entry_get_next(entry))
{
mir::log_debug("{arg} tag '%s=%s'", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
}
for (auto entry = udev_device_get_sysattr_list_entry(udev_dev.get()); entry; entry = udev_list_entry_get_next(entry))
{
mir::log_debug("{arg} sysattr '%s=%s'", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
}
#endif

auto const vendor = libinput_device_get_id_vendor(dev);
auto const product = libinput_device_get_id_product(dev);
desc += std::format(" [{:0>4x}:{:0>4x}]", vendor, product);
Expand All @@ -63,13 +78,15 @@ std::string describe(libinput_device* dev)
desc += std::format(" '{:s}'", name);
}

#ifdef ARG_DEBUGGING
for (auto const key : {/*"ID_MODEL", "ID_VENDOR_ID", "ID_MODEL_ID",*/ "ID_PATH"})
{
if (char const *const value = udev_device_get_property_value(udev_dev.get(), key))
{
desc += ": " + std::string(key) + "=" + value;
}
}
#endif

return desc;
}
Expand Down

0 comments on commit 15586ef

Please sign in to comment.