mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Print feature names as we're initializing them
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -177,7 +177,9 @@ unifying_20_probe(struct ratbag_device *device, const struct ratbag_id id)
|
||||
if (rc > 0) {
|
||||
log_debug(device->ratbag, "'%s' has %d features\n", ratbag_device_get_name(device), rc);
|
||||
for (i = 0; i < rc; i++) {
|
||||
log_debug(device->ratbag, "Init feature 0x%04x\n", feature_list[i].feature);
|
||||
log_debug(device->ratbag, "Init feature %s (0x%04x) \n",
|
||||
hidpp20_feature_get_name(feature_list[i].feature),
|
||||
feature_list[i].feature);
|
||||
unifying_init_feature(device, feature_list[i].feature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,30 @@
|
||||
#include "libratbag-util.h"
|
||||
#include "libratbag-private.h"
|
||||
|
||||
const char*
|
||||
hidpp20_feature_get_name(uint16_t feature)
|
||||
{
|
||||
static char numeric[8];
|
||||
const char *str;
|
||||
#define CASE_RETURN_STRING(a) case a: return #a; break
|
||||
|
||||
switch(feature)
|
||||
{
|
||||
CASE_RETURN_STRING(HIDPP_PAGE_ROOT);
|
||||
CASE_RETURN_STRING(HIDPP_PAGE_FEATURE_SET);
|
||||
CASE_RETURN_STRING(HIDPP_PAGE_MOUSE_POINTER_BASIC);
|
||||
CASE_RETURN_STRING(HIDPP_PAGE_ADJUSTABLE_DPI);
|
||||
CASE_RETURN_STRING(HIDPP_PAGE_SPECIAL_KEYS_BUTTONS);
|
||||
default:
|
||||
sprintf(numeric, "%#4x", feature);
|
||||
str = numeric;
|
||||
break;
|
||||
}
|
||||
|
||||
#undef CASE_RETURN_STRING
|
||||
return str;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp20_write_command(struct ratbag_device *device, uint8_t *cmd, int size)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ union hidpp20_message {
|
||||
|
||||
int hidpp20_request_command(struct ratbag_device *device, union hidpp20_message *msg);
|
||||
|
||||
const char *hidpp20_feature_get_name(uint16_t feature);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0x0000: Root */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user