forked from drath/libratbag
hidpp10: add more debugging information
To make it easier to find what failed in the wall of hexcodes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -208,6 +208,8 @@ hidpp10_get_hidpp_notifications(struct hidpp10_device *dev,
|
||||
union hidpp10_message notifications = CMD_HIDPP_NOTIFICATIONS(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching HID++ notifications\n");
|
||||
|
||||
res = hidpp10_request_command(dev, ¬ifications);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -227,6 +229,8 @@ hidpp10_set_hidpp_notifications(struct hidpp10_device *dev,
|
||||
union hidpp10_message notifications = CMD_HIDPP_NOTIFICATIONS(idx, SET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Setting HID++ notifications\n");
|
||||
|
||||
notifications.msg.parameters[0] = reporting_flags_r0;
|
||||
notifications.msg.parameters[2] = reporting_flags_r2;
|
||||
|
||||
@@ -260,6 +264,8 @@ hidpp10_get_individual_features(struct hidpp10_device *dev,
|
||||
union hidpp10_message features = CMD_ENABLE_INDIVIDUAL_FEATURES(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching individual features\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &features);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -279,6 +285,8 @@ hidpp10_set_individual_feature(struct hidpp10_device *dev,
|
||||
union hidpp10_message mode = CMD_ENABLE_INDIVIDUAL_FEATURES(idx, SET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Setting individual features\n");
|
||||
|
||||
if (dev)
|
||||
mode.msg.device_idx = dev->index;
|
||||
|
||||
@@ -374,6 +382,8 @@ hidpp10_get_current_profile(struct hidpp10_device *dev, int8_t *current_profile)
|
||||
int res;
|
||||
int8_t page;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching current profile\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &profile);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -400,6 +410,8 @@ hidpp10_get_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr
|
||||
/* FIXME: profile offset appears to be 3, 1 and 2 are garbage */
|
||||
number += 3;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching profile %d\n", number);
|
||||
|
||||
for (i = 0; i < sizeof(data); i += 16) {
|
||||
res = hidpp10_read_memory(dev, number, i, &data.data[i]);
|
||||
if (res)
|
||||
@@ -538,6 +550,8 @@ hidpp10_get_led_status(struct hidpp10_device *dev,
|
||||
union hidpp10_message led_status = CMD_LED_STATUS(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching LED status\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &led_status);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -559,6 +573,7 @@ hidpp10_set_led_status(struct hidpp10_device *dev,
|
||||
union hidpp10_message led_status = CMD_LED_STATUS(idx, SET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Setting LED status\n");
|
||||
|
||||
/* each led is 4-bits, 0x1 == off, 0x2 == on */
|
||||
led_status.msg.parameters[0] |= led[0] ? 0x02 : 0x01; /* running man logo */
|
||||
@@ -593,6 +608,8 @@ hidpp10_get_optical_sensor_settings(struct hidpp10_device *dev,
|
||||
union hidpp10_message sensor = CMD_OPTICAL_SENSOR_SETTINGS(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching optical sensor settings\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &sensor);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -628,6 +645,8 @@ hidpp10_get_current_resolution(struct hidpp10_device *dev,
|
||||
union hidpp10_message resolution = CMD_CURRENT_RESOLUTION(idx, GET_LONG_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching current resolution\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &resolution);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -662,6 +681,8 @@ hidpp10_get_usb_refresh_rate(struct hidpp10_device *dev,
|
||||
union hidpp10_message refresh = CMD_USB_REFRESH_RATE(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching USB refresh rate\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &refresh);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -694,6 +715,10 @@ hidpp10_read_memory(struct hidpp10_device *dev, uint8_t page, uint16_t offset,
|
||||
union hidpp10_message readmem = CMD_READ_MEMORY(idx, page, offset/2);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag,
|
||||
"Reading memory page %d, offset %#x\n",
|
||||
page, offset);
|
||||
|
||||
res = hidpp10_request_command(dev, &readmem);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -765,6 +790,8 @@ hidpp10_get_pairing_information(struct hidpp10_device *dev,
|
||||
union hidpp10_message pairing_information = CMD_PAIRING_INFORMATION(idx, DEVICE_PAIRING_INFORMATION);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching pairing information\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &pairing_information);
|
||||
if (res)
|
||||
return -1;
|
||||
@@ -785,6 +812,7 @@ hidpp10_get_pairing_information_device_name(struct hidpp10_device *dev,
|
||||
union hidpp10_message device_name = CMD_PAIRING_INFORMATION(idx, DEVICE_NAME);
|
||||
int res;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching device name\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &device_name);
|
||||
if (res)
|
||||
@@ -827,6 +855,8 @@ hidpp10_get_firmare_information(struct hidpp10_device *dev,
|
||||
int res;
|
||||
uint8_t maj, min, build;
|
||||
|
||||
log_debug(dev->ratbag_device->ratbag, "Fetching firmware information\n");
|
||||
|
||||
/*
|
||||
* This may fail on some devices
|
||||
* => we can not retrieve their FW version through HID++ 1.0.
|
||||
|
||||
Reference in New Issue
Block a user