mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Namespace the receiver/wired device idx defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -234,7 +234,7 @@ hidpp10drv_probe(struct ratbag_device *device)
|
||||
* so even for unifying receiver devices we can just 0x00 as device
|
||||
* index.
|
||||
*/
|
||||
dev = hidpp10_device_new(&base, WIRED_DEVICE_IDX);
|
||||
dev = hidpp10_device_new(&base, HIDPP_WIRED_DEVICE_IDX);
|
||||
|
||||
if (!dev) {
|
||||
log_error(device->ratbag,
|
||||
|
||||
@@ -682,7 +682,7 @@ hidpp20drv_probe(struct ratbag_device *device)
|
||||
hidpp_device_init(&base, device->hidraw.fd);
|
||||
hidpp_device_set_log_handler(&base, hidpp20_log, HIDPP_LOG_PRIORITY_RAW, device);
|
||||
|
||||
dev = hidpp20_device_new(&base, RECEIVER_IDX);
|
||||
dev = hidpp20_device_new(&base, HIDPP_RECEIVER_IDX);
|
||||
if (!dev) {
|
||||
log_error(device->ratbag,
|
||||
"Failed to get HID++2.0 device for %s\n",
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#ifndef HIDPP_GENERIC_H
|
||||
#define HIDPP_GENERIC_H
|
||||
|
||||
#define RECEIVER_IDX 0xFF
|
||||
#define WIRED_DEVICE_IDX 0x00
|
||||
#define HIDPP_RECEIVER_IDX 0xFF
|
||||
#define HIDPP_WIRED_DEVICE_IDX 0x00
|
||||
|
||||
#define REPORT_ID_SHORT 0x10
|
||||
#define REPORT_ID_LONG 0x11
|
||||
|
||||
@@ -164,7 +164,7 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg)
|
||||
hidpp_err = read_buffer.msg.parameters[1];
|
||||
hidpp_log_raw(&dev->base,
|
||||
" HID++ error from the %s (%d): %s (%02x)\n",
|
||||
read_buffer.msg.device_idx == RECEIVER_IDX ? "receiver" : "device",
|
||||
read_buffer.msg.device_idx == HIDPP_RECEIVER_IDX ? "receiver" : "device",
|
||||
read_buffer.msg.device_idx,
|
||||
hidpp_errors[hidpp_err] ? hidpp_errors[hidpp_err] : "Undocumented error code",
|
||||
hidpp_err);
|
||||
@@ -292,7 +292,7 @@ int
|
||||
hidpp10_set_individual_features(struct hidpp10_device *dev,
|
||||
uint32_t feature_mask)
|
||||
{
|
||||
unsigned idx = RECEIVER_IDX;
|
||||
unsigned idx = HIDPP_RECEIVER_IDX;
|
||||
union hidpp10_message mode = CMD_ENABLE_INDIVIDUAL_FEATURES(idx, SET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ hidpp10_read_memory(struct hidpp10_device *dev, uint8_t page, uint16_t offset,
|
||||
#define CMD_DEVICE_CONNECTION_DISCONNECTION(idx, cmd, timeout) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
.device_idx = RECEIVER_IDX, \
|
||||
.device_idx = HIDPP_RECEIVER_IDX, \
|
||||
.sub_id = SET_REGISTER_REQ, \
|
||||
.address = __CMD_DEVICE_CONNECTION_DISCONNECTION, \
|
||||
.parameters = {cmd, idx - 1, timeout }, \
|
||||
@@ -1084,7 +1084,7 @@ int hidpp10_disconnect(struct hidpp10_device *device, int idx) {
|
||||
#define CMD_PAIRING_INFORMATION(idx, type) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
.device_idx = RECEIVER_IDX, \
|
||||
.device_idx = HIDPP_RECEIVER_IDX, \
|
||||
.sub_id = GET_LONG_REGISTER_REQ, \
|
||||
.address = __CMD_PAIRING_INFORMATION, \
|
||||
.parameters = {type + idx - 1, 0x00, 0x00 }, \
|
||||
|
||||
@@ -98,7 +98,7 @@ main(int argc, char **argv)
|
||||
error(1, errno, "Failed to open path %s", path);
|
||||
|
||||
hidpp_device_init(&base, fd);
|
||||
dev = hidpp10_device_new(&base, WIRED_DEVICE_IDX);
|
||||
dev = hidpp10_device_new(&base, HIDPP_WIRED_DEVICE_IDX);
|
||||
|
||||
if (argc == 2)
|
||||
rc = dump_all_pages(dev);
|
||||
|
||||
Reference in New Issue
Block a user