forked from drath/libratbag
hidpp10: Add support for the HID++1.0 Notifications request
They're off by default, but I have to start testing somewhere... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -224,6 +224,7 @@ static int hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_
|
||||
union hidpp10_message device_name = CMD_PAIRING_INFORMATION(idx, DEVICE_NAME);
|
||||
union hidpp10_message firmware_information = CMD_DEVICE_FIRMWARE_INFORMATION(idx, FIRMWARE_INFO_ITEM_FW_NAME_AND_VERSION(1));
|
||||
union hidpp10_message build_information = CMD_DEVICE_FIRMWARE_INFORMATION(idx, FIRMWARE_INFO_ITEM_FW_BUILD_NUMBER(1));
|
||||
union hidpp10_message notifications = CMD_HIDPP_NOTIFICATIONS(idx, GET_REGISTER_REQ);
|
||||
size_t name_size;
|
||||
int res;
|
||||
|
||||
@@ -249,19 +250,21 @@ static int hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_
|
||||
* => we can not retrieve their FW version through HID++ 1.0.
|
||||
*/
|
||||
res = hidpp10_request_command(device, &firmware_information);
|
||||
if (res)
|
||||
return 0;
|
||||
|
||||
dev->fw_major = firmware_information.msg.string[1];
|
||||
dev->fw_minor = firmware_information.msg.string[2];
|
||||
if (res == 0) {
|
||||
dev->fw_major = firmware_information.msg.string[1];
|
||||
dev->fw_minor = firmware_information.msg.string[2];
|
||||
}
|
||||
|
||||
res = hidpp10_request_command(device, &build_information);
|
||||
if (res == 0) {
|
||||
dev->build = (build_information.msg.string[1] << 8) |
|
||||
build_information.msg.string[2];
|
||||
}
|
||||
|
||||
res = hidpp10_request_command(device, ¬ifications);
|
||||
if (res)
|
||||
return 0;
|
||||
|
||||
dev->build = (build_information.msg.string[1] << 8) |
|
||||
build_information.msg.string[2];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,17 @@
|
||||
#define GET_LONG_REGISTER_RSP 0x83
|
||||
#define __ERROR_MSG 0x8F
|
||||
|
||||
#define __CMD_HIDPP_NOTIFICATIONS 0x00
|
||||
#define FEATURE_BIT_R0_CONSUMER_SPECIFIC_CONTROL 0
|
||||
#define FEATURE_BIT_R0_POWER_KEYS 1
|
||||
#define FEATURE_BIT_R0_VERTICAL_SCROLL 2
|
||||
#define FEATURE_BIT_R0_MOUSE_EXTRA_BUTTONS 3
|
||||
#define FEATURE_BIT_R0_BATTERY_STATUS 4
|
||||
#define FEATURE_BIT_R0_HORIZONTAL_SCROLL 5
|
||||
#define FEATURE_BIT_R0_F_LOCK_STATUS 6
|
||||
#define FEATURE_BIT_R0_NUMPAD_NUMERIC_KEYS 7
|
||||
#define FEATURE_BIT_R2_3D_GESTURES 0
|
||||
|
||||
#define __CMD_ENABLE_INDIVIDUAL_FEATURES 0x01
|
||||
#define FEATURE_BIT_R0_SPECIAL_BUTTON_FUNCTION 1
|
||||
#define FEATURE_BIT_R0_ENHANCED_KEY_USAGE 2
|
||||
@@ -96,6 +107,16 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define CMD_HIDPP_NOTIFICATIONS(idx, sub) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
.device_idx = idx + 1, \
|
||||
.sub_id = sub, \
|
||||
.address = __CMD_HIDPP_NOTIFICATIONS, \
|
||||
.parameters = {0x00, 0x00, 0x00 }, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CMD_ENABLE_INDIVIDUAL_FEATURES(idx, sub) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
|
||||
Reference in New Issue
Block a user