mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-08 07:33:53 +01:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efd15a33fb | ||
|
|
b804e117c1 | ||
|
|
b54d28ec1a | ||
|
|
388dae76bc | ||
|
|
19f87790bb | ||
|
|
9aa8938eb8 | ||
|
|
25094daaed | ||
|
|
39069623f2 | ||
|
|
d5c74682f1 | ||
|
|
6cba2abd8e | ||
|
|
f58b91a9b2 | ||
|
|
de08323609 | ||
|
|
5fcdfab2a6 | ||
|
|
e07839bcee |
13
configure.ac
13
configure.ac
@@ -1,7 +1,7 @@
|
|||||||
AC_PREREQ([2.64])
|
AC_PREREQ([2.64])
|
||||||
|
|
||||||
m4_define([libratbag_major_version], [0])
|
m4_define([libratbag_major_version], [0])
|
||||||
m4_define([libratbag_minor_version], [2])
|
m4_define([libratbag_minor_version], [3])
|
||||||
m4_define([libratbag_micro_version], [0])
|
m4_define([libratbag_micro_version], [0])
|
||||||
m4_define([libratbag_version],
|
m4_define([libratbag_version],
|
||||||
[libratbag_major_version.libratbag_minor_version.libratbag_micro_version])
|
[libratbag_major_version.libratbag_minor_version.libratbag_micro_version])
|
||||||
@@ -22,16 +22,18 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
||||||
|
|
||||||
# Before making a release, the LIBRATBAG_LT_VERSION string should be
|
# Before making a release, the LIBRATBAG_LT_VERSION and LIBLUR_LT_VERSION
|
||||||
# modified.
|
# strings should be modified.
|
||||||
# The string is of the form C:R:A.
|
# The strings are of the form C:R:A.
|
||||||
# a) If binary compatibility has been broken (eg removed or changed interfaces)
|
# a) If binary compatibility has been broken (eg removed or changed interfaces)
|
||||||
# change to C+1:0:0.
|
# change to C+1:0:0.
|
||||||
# b) If interfaces have been changed or added, but binary compatibility has
|
# b) If interfaces have been changed or added, but binary compatibility has
|
||||||
# been preserved, change to C+1:0:A+1
|
# been preserved, change to C+1:0:A+1
|
||||||
# c) If the interface is the same as the previous version, change to C:R+1:A
|
# c) If the interface is the same as the previous version, change to C:R+1:A
|
||||||
LIBRATBAG_LT_VERSION=1:0:0
|
LIBRATBAG_LT_VERSION=2:0:0
|
||||||
|
LIBLUR_LT_VERSION=2:0:0
|
||||||
AC_SUBST(LIBRATBAG_LT_VERSION)
|
AC_SUBST(LIBRATBAG_LT_VERSION)
|
||||||
|
AC_SUBST(LIBLUR_LT_VERSION)
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
@@ -145,6 +147,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/Makefile
|
src/Makefile
|
||||||
src/libratbag.pc
|
src/libratbag.pc
|
||||||
src/libratbag-version.h
|
src/libratbag-version.h
|
||||||
|
src/liblur.pc
|
||||||
test/Makefile
|
test/Makefile
|
||||||
tools/Makefile])
|
tools/Makefile])
|
||||||
AC_CONFIG_FILES([test/symbols-leak-test],
|
AC_CONFIG_FILES([test/symbols-leak-test],
|
||||||
|
|||||||
@@ -44,15 +44,19 @@ liblur_la_LIBADD = \
|
|||||||
liblur_la_CFLAGS = \
|
liblur_la_CFLAGS = \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
$(GCC_CFLAGS)
|
$(GCC_CFLAGS)
|
||||||
liblur_la_LDFLAGS = -shared
|
EXTRA_liblur_la_DEPENDENCIES = $(srcdir)/liblur.sym
|
||||||
|
|
||||||
|
liblur_la_LDFLAGS = -version-info $(LIBLUR_LT_VERSION) -shared \
|
||||||
|
-Wl,--version-script=$(srcdir)/liblur.sym
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libratbag.pc
|
pkgconfig_DATA = libratbag.pc \
|
||||||
|
liblur.pc
|
||||||
|
|
||||||
AM_CFLAGS = $(GCC_CFLAGS)
|
AM_CFLAGS = $(GCC_CFLAGS)
|
||||||
|
|
||||||
DISTCLEANFILES = libratbag-version.h
|
DISTCLEANFILES = libratbag-version.h
|
||||||
EXTRA_DIST = libratbag-version.h.in libratbag.sym
|
EXTRA_DIST = libratbag-version.h.in libratbag.sym liblur.sym
|
||||||
|
|
||||||
# The hidpp libraries are static libraries only for in-tree tools. No API
|
# The hidpp libraries are static libraries only for in-tree tools. No API
|
||||||
# stability is guaranteed here.
|
# stability is guaranteed here.
|
||||||
|
|||||||
@@ -734,6 +734,7 @@ hidpp20drv_20_probe(struct ratbag_device *device)
|
|||||||
struct hidpp20_device *dev = drv_data->dev;
|
struct hidpp20_device *dev = drv_data->dev;
|
||||||
struct hidpp20_feature *feature_list = dev->feature_list;
|
struct hidpp20_feature *feature_list = dev->feature_list;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
int rc;
|
||||||
|
|
||||||
log_raw(device->ratbag,
|
log_raw(device->ratbag,
|
||||||
"'%s' has %d features\n",
|
"'%s' has %d features\n",
|
||||||
@@ -744,7 +745,9 @@ hidpp20drv_20_probe(struct ratbag_device *device)
|
|||||||
log_raw(device->ratbag, "Init feature %s (0x%04x) \n",
|
log_raw(device->ratbag, "Init feature %s (0x%04x) \n",
|
||||||
hidpp20_feature_get_name(feature_list[i].feature),
|
hidpp20_feature_get_name(feature_list[i].feature),
|
||||||
feature_list[i].feature);
|
feature_list[i].feature);
|
||||||
hidpp20drv_init_feature(device, feature_list[i].feature);
|
rc = hidpp20drv_init_feature(device, feature_list[i].feature);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -794,6 +797,7 @@ hidpp20drv_probe(struct ratbag_device *device)
|
|||||||
log_error(device->ratbag,
|
log_error(device->ratbag,
|
||||||
"Failed to get HID++2.0 device for %s\n",
|
"Failed to get HID++2.0 device for %s\n",
|
||||||
device->name);
|
device->name);
|
||||||
|
rc = -ENODEV;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
178
src/hidpp20.c
178
src/hidpp20.c
@@ -907,6 +907,8 @@ int hidpp20_adjustable_dpi_set_sensor_dpi(struct hidpp20_device *device,
|
|||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#define CMD_ONBOARD_PROFILES_GET_PROFILES_DESCR 0x00
|
#define CMD_ONBOARD_PROFILES_GET_PROFILES_DESCR 0x00
|
||||||
|
#define CMD_ONBOARD_PROFILES_SET_ONBOARD_MODE 0x10
|
||||||
|
#define CMD_ONBOARD_PROFILES_GET_ONBOARD_MODE 0x20
|
||||||
#define CMD_ONBOARD_PROFILES_SET_CURRENT_PROFILE 0x30
|
#define CMD_ONBOARD_PROFILES_SET_CURRENT_PROFILE 0x30
|
||||||
#define CMD_ONBOARD_PROFILES_GET_CURRENT_PROFILE 0x40
|
#define CMD_ONBOARD_PROFILES_GET_CURRENT_PROFILE 0x40
|
||||||
#define CMD_ONBOARD_PROFILES_MEMORY_READ 0x50
|
#define CMD_ONBOARD_PROFILES_MEMORY_READ 0x50
|
||||||
@@ -920,6 +922,29 @@ int hidpp20_adjustable_dpi_set_sensor_dpi(struct hidpp20_device *device,
|
|||||||
#define HIDPP20_PROFILE_SIZE HIDPP20_PAGE_SIZE
|
#define HIDPP20_PROFILE_SIZE HIDPP20_PAGE_SIZE
|
||||||
#define HIDPP20_BUTTON_HID 0x80
|
#define HIDPP20_BUTTON_HID 0x80
|
||||||
|
|
||||||
|
#define HIDPP20_MODE_NO_CHANGE 0x00
|
||||||
|
#define HIDPP20_ONBOARD_MODE 0x01
|
||||||
|
#define HIDPP20_HOST_MODE 0x02
|
||||||
|
|
||||||
|
#define HIDPP20_ONBOARD_PROFILES_MEMORY_TYPE_PROTOSS 0x01
|
||||||
|
#define HIDPP20_ONBOARD_PROFILES_PROFILE_TYPE_PROTOSS 0x01
|
||||||
|
#define HIDPP20_ONBOARD_PROFILES_MACRO_TYPE_PROTOSS 0x01
|
||||||
|
|
||||||
|
struct hidpp20_onboard_profiles_info {
|
||||||
|
uint8_t memory_model_id;
|
||||||
|
uint8_t profile_format_id;
|
||||||
|
uint8_t macro_format_id;
|
||||||
|
uint8_t profile_count;
|
||||||
|
uint8_t profile_count_oob;
|
||||||
|
uint8_t button_count;
|
||||||
|
uint8_t sector_count;
|
||||||
|
uint16_t sector_size;
|
||||||
|
uint8_t mechanical_layout;
|
||||||
|
uint8_t various_info;
|
||||||
|
uint8_t reserved[5];
|
||||||
|
} __attribute__((packed));
|
||||||
|
_Static_assert(sizeof(struct hidpp20_onboard_profiles_info) == 16, "Invalid size");
|
||||||
|
|
||||||
int
|
int
|
||||||
hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
|
hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
|
||||||
uint8_t read_rom,
|
uint8_t read_rom,
|
||||||
@@ -1076,6 +1101,58 @@ hidpp20_onboard_profiles_write_page(struct hidpp20_device *device,
|
|||||||
return hidpp20_onboard_profiles_write_data(device, page, 0x00, data, HIDPP20_PAGE_SIZE);
|
return hidpp20_onboard_profiles_write_data(device, page, 0x00, data, HIDPP20_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
hidpp20_onboard_profiles_get_onboard_mode(struct hidpp20_device *device)
|
||||||
|
{
|
||||||
|
uint8_t feature_index;
|
||||||
|
int rc;
|
||||||
|
union hidpp20_message msg = {
|
||||||
|
.msg.report_id = REPORT_ID_SHORT,
|
||||||
|
.msg.device_idx = device->index,
|
||||||
|
.msg.address = CMD_ONBOARD_PROFILES_GET_ONBOARD_MODE,
|
||||||
|
};
|
||||||
|
|
||||||
|
feature_index = hidpp_root_get_feature_idx(device,
|
||||||
|
HIDPP_PAGE_ONBOARD_PROFILES);
|
||||||
|
if (feature_index == 0)
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
|
msg.msg.sub_id = feature_index;
|
||||||
|
|
||||||
|
rc = hidpp20_request_command(device, &msg);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
return msg.msg.parameters[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
hidpp20_onboard_profiles_set_onboard_mode(struct hidpp20_device *device,
|
||||||
|
uint8_t onboard_mode)
|
||||||
|
{
|
||||||
|
uint8_t feature_index;
|
||||||
|
int rc;
|
||||||
|
union hidpp20_message msg = {
|
||||||
|
.msg.report_id = REPORT_ID_SHORT,
|
||||||
|
.msg.device_idx = device->index,
|
||||||
|
.msg.address = CMD_ONBOARD_PROFILES_SET_ONBOARD_MODE,
|
||||||
|
.msg.parameters[1] = onboard_mode,
|
||||||
|
};
|
||||||
|
|
||||||
|
feature_index = hidpp_root_get_feature_idx(device,
|
||||||
|
HIDPP_PAGE_ONBOARD_PROFILES);
|
||||||
|
if (feature_index == 0)
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
|
msg.msg.sub_id = feature_index;
|
||||||
|
|
||||||
|
rc = hidpp20_request_command(device, &msg);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
hidpp20_onboard_profiles_get_current_profile(struct hidpp20_device *device)
|
hidpp20_onboard_profiles_get_current_profile(struct hidpp20_device *device)
|
||||||
{
|
{
|
||||||
@@ -1130,16 +1207,18 @@ hidpp20_onboard_profiles_set_current_profile(struct hidpp20_device *device,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
|
hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
|
||||||
unsigned profile_count,
|
struct hidpp20_profiles **profiles_list)
|
||||||
struct hidpp20_profiles *profiles_list)
|
|
||||||
{
|
{
|
||||||
uint8_t feature_index;
|
uint8_t feature_index;
|
||||||
int rc;
|
int rc;
|
||||||
|
struct hidpp20_profiles *profiles;
|
||||||
union hidpp20_message msg = {
|
union hidpp20_message msg = {
|
||||||
.msg.report_id = REPORT_ID_SHORT,
|
.msg.report_id = REPORT_ID_SHORT,
|
||||||
.msg.device_idx = device->index,
|
.msg.device_idx = device->index,
|
||||||
.msg.address = CMD_ONBOARD_PROFILES_GET_PROFILES_DESCR,
|
.msg.address = CMD_ONBOARD_PROFILES_GET_PROFILES_DESCR,
|
||||||
};
|
};
|
||||||
|
struct hidpp20_onboard_profiles_info *info;
|
||||||
|
int onboard_mode;
|
||||||
|
|
||||||
feature_index = hidpp_root_get_feature_idx(device,
|
feature_index = hidpp_root_get_feature_idx(device,
|
||||||
HIDPP_PAGE_ONBOARD_PROFILES);
|
HIDPP_PAGE_ONBOARD_PROFILES);
|
||||||
@@ -1152,10 +1231,76 @@ hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
|
|||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
profiles_list->num_buttons = msg.msg.parameters[5] <= 16 ? msg.msg.parameters[5] : 16;
|
info = (struct hidpp20_onboard_profiles_info *)msg.msg.parameters;
|
||||||
profiles_list->num_profiles = profile_count;
|
|
||||||
/* FIXME: actually retrieve the correct values */
|
if (info->memory_model_id != HIDPP20_ONBOARD_PROFILES_MEMORY_TYPE_PROTOSS) {
|
||||||
profiles_list->num_modes = 5;
|
hidpp_log_error(&device->base,
|
||||||
|
"Memory layout not supported: 0x%02x.\n",
|
||||||
|
info->memory_model_id);
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->profile_format_id != HIDPP20_ONBOARD_PROFILES_PROFILE_TYPE_PROTOSS) {
|
||||||
|
hidpp_log_error(&device->base,
|
||||||
|
"Profile layout not supported: 0x%02x.\n",
|
||||||
|
info->profile_format_id);
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->macro_format_id != HIDPP20_ONBOARD_PROFILES_MACRO_TYPE_PROTOSS) {
|
||||||
|
hidpp_log_error(&device->base,
|
||||||
|
"Macro format not supported: 0x%02x.\n",
|
||||||
|
info->macro_format_id);
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
info->sector_size = hidpp_be_u16_to_cpu(info->sector_size);
|
||||||
|
if (info->sector_size != HIDPP20_PAGE_SIZE) {
|
||||||
|
hidpp_log_error(&device->base,
|
||||||
|
"Unsupported sector size: %d.\n",
|
||||||
|
info->sector_size);
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = hidpp20_onboard_profiles_get_onboard_mode(device);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
onboard_mode = rc;
|
||||||
|
if (onboard_mode != HIDPP20_ONBOARD_MODE) {
|
||||||
|
hidpp_log_raw(&device->base,
|
||||||
|
"not on the correct mode: %d.\n",
|
||||||
|
onboard_mode);
|
||||||
|
rc = hidpp20_onboard_profiles_set_onboard_mode(device,
|
||||||
|
HIDPP20_ONBOARD_MODE);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
profiles = zalloc(sizeof(struct hidpp20_profiles) +
|
||||||
|
info->profile_count * sizeof(struct hidpp20_profile));
|
||||||
|
|
||||||
|
profiles->num_profiles = info->profile_count;
|
||||||
|
profiles->num_buttons = msg.msg.parameters[5] <= 16 ? msg.msg.parameters[5] : 16;
|
||||||
|
profiles->num_modes = HIDPP20_DPI_COUNT;
|
||||||
|
profiles->has_g_shift = (info->mechanical_layout & 0x03) == 2;
|
||||||
|
profiles->has_dpi_shift = (info->mechanical_layout & 0x0c) == 2;
|
||||||
|
switch(info->various_info & 0x07) {
|
||||||
|
case 1:
|
||||||
|
profiles->corded = 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
profiles->wireless = 1;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
profiles->corded = 1;
|
||||||
|
profiles->wireless = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*profiles_list = profiles;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1327,8 +1472,14 @@ hidpp20_onboard_profiles_allocate(struct hidpp20_device *device,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
int rc;
|
int rc;
|
||||||
uint8_t data[16] = {0};
|
uint8_t data[16] = {0};
|
||||||
struct hidpp20_profiles *profiles;
|
struct hidpp20_profiles *profiles = NULL;
|
||||||
unsigned profile_count = 0;
|
|
||||||
|
rc = hidpp20_onboard_profiles_initialize(device,
|
||||||
|
&profiles);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
assert(profiles);
|
||||||
|
|
||||||
rc = hidpp20_onboard_profiles_read_memory(device,
|
rc = hidpp20_onboard_profiles_read_memory(device,
|
||||||
0x00,
|
0x00,
|
||||||
@@ -1338,26 +1489,19 @@ hidpp20_onboard_profiles_allocate(struct hidpp20_device *device,
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
profiles = zalloc(sizeof(struct hidpp20_profiles));
|
for (i = 0; i < profiles->num_profiles; i++) {
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
uint8_t *d = data + 4 * i;
|
uint8_t *d = data + 4 * i;
|
||||||
|
|
||||||
if (d[0] == 0xFF && d[1] == 0xFF)
|
if (d[0] == 0xFF && d[1] == 0xFF)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
profile_count++;
|
|
||||||
profiles->profiles[i].index = d[1];
|
profiles->profiles[i].index = d[1];
|
||||||
profiles->profiles[i].enabled = d[2];
|
profiles->profiles[i].enabled = d[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
hidpp20_onboard_profiles_initialize(device,
|
|
||||||
profile_count,
|
|
||||||
profiles);
|
|
||||||
|
|
||||||
*profiles_list = profiles;
|
*profiles_list = profiles;
|
||||||
|
|
||||||
return profile_count;
|
return profiles->num_profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ int hidpp20_adjustable_dpi_set_sensor_dpi(struct hidpp20_device *device,
|
|||||||
#define HIDPP20_MODIFIER_KEY_CTRL 0x01
|
#define HIDPP20_MODIFIER_KEY_CTRL 0x01
|
||||||
#define HIDPP20_MODIFIER_KEY_SHIFT 0x02
|
#define HIDPP20_MODIFIER_KEY_SHIFT 0x02
|
||||||
|
|
||||||
|
#define HIDPP20_DPI_COUNT 5
|
||||||
|
|
||||||
union hidpp20_button_binding {
|
union hidpp20_button_binding {
|
||||||
struct {
|
struct {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
@@ -353,7 +355,7 @@ struct hidpp20_profile {
|
|||||||
unsigned report_rate;
|
unsigned report_rate;
|
||||||
unsigned default_dpi;
|
unsigned default_dpi;
|
||||||
unsigned switched_dpi;
|
unsigned switched_dpi;
|
||||||
uint16_t dpi[5];
|
uint16_t dpi[HIDPP20_DPI_COUNT];
|
||||||
union hidpp20_button_binding buttons[32];
|
union hidpp20_button_binding buttons[32];
|
||||||
union hidpp20_macro_data *macros[32];
|
union hidpp20_macro_data *macros[32];
|
||||||
};
|
};
|
||||||
@@ -362,7 +364,11 @@ struct hidpp20_profiles {
|
|||||||
uint8_t num_profiles;
|
uint8_t num_profiles;
|
||||||
uint8_t num_buttons;
|
uint8_t num_buttons;
|
||||||
uint8_t num_modes;
|
uint8_t num_modes;
|
||||||
struct hidpp20_profile profiles[5];
|
uint8_t has_g_shift;
|
||||||
|
uint8_t has_dpi_shift;
|
||||||
|
uint8_t corded;
|
||||||
|
uint8_t wireless;
|
||||||
|
struct hidpp20_profile profiles[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
13
src/liblur.pc.in
Normal file
13
src/liblur.pc.in
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
datarootdir=@datarootdir@
|
||||||
|
pkgdatadir=@datadir@/@PACKAGE@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: Liblur
|
||||||
|
Description: Logitech Unifying Receiver configuration library
|
||||||
|
Version: @LIBRATBAG_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -llur
|
||||||
|
Libs.private: -lm -lrt
|
||||||
25
src/liblur.sym
Normal file
25
src/liblur.sym
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* in alphabetical order! */
|
||||||
|
|
||||||
|
LIBLUR_0.3.0 {
|
||||||
|
global:
|
||||||
|
lur_device_disconnect;
|
||||||
|
lur_device_get_name;
|
||||||
|
lur_device_get_product_id;
|
||||||
|
lur_device_get_serial;
|
||||||
|
lur_device_get_type;
|
||||||
|
lur_device_get_vendor_id;
|
||||||
|
lur_device_ref;
|
||||||
|
lur_device_unref;
|
||||||
|
lur_is_receiver;
|
||||||
|
lur_receiver_close;
|
||||||
|
lur_receiver_enumerate;
|
||||||
|
lur_receiver_get_fd;
|
||||||
|
lur_receiver_get_user_data;
|
||||||
|
lur_receiver_new_from_hidraw;
|
||||||
|
lur_receiver_open;
|
||||||
|
lur_receiver_ref;
|
||||||
|
lur_receiver_set_user_data;
|
||||||
|
lur_receiver_unref;
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
||||||
@@ -314,7 +314,7 @@ ratbag_find_driver(struct ratbag_device *device,
|
|||||||
device->driver = NULL;
|
device->driver = NULL;
|
||||||
|
|
||||||
if (rc != -ENODEV) {
|
if (rc != -ENODEV) {
|
||||||
log_error(ratbag, "%s: no hidraw device found", device->name);
|
log_error(ratbag, "%s: no hidraw device found\n", device->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,6 +952,9 @@ ratbag_button_set_button(struct ratbag_button *button, unsigned int btn)
|
|||||||
|
|
||||||
rc = button->profile->device->driver->write_button(button, &action);
|
rc = button->profile->device->driver->write_button(button, &action);
|
||||||
|
|
||||||
|
if (rc == 0)
|
||||||
|
button->action = action;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,7 +962,7 @@ LIBRATBAG_EXPORT enum ratbag_button_action_special
|
|||||||
ratbag_button_get_special(struct ratbag_button *button)
|
ratbag_button_get_special(struct ratbag_button *button)
|
||||||
{
|
{
|
||||||
if (button->action.type != RATBAG_BUTTON_ACTION_TYPE_SPECIAL)
|
if (button->action.type != RATBAG_BUTTON_ACTION_TYPE_SPECIAL)
|
||||||
return 0;
|
return RATBAG_BUTTON_ACTION_SPECIAL_INVALID;
|
||||||
|
|
||||||
return button->action.action.special;
|
return button->action.action.special;
|
||||||
}
|
}
|
||||||
@@ -981,6 +984,9 @@ ratbag_button_set_special(struct ratbag_button *button,
|
|||||||
|
|
||||||
rc = button->profile->device->driver->write_button(button, &action);
|
rc = button->profile->device->driver->write_button(button, &action);
|
||||||
|
|
||||||
|
if (rc == 0)
|
||||||
|
button->action = action;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1017,6 +1023,9 @@ ratbag_button_set_key(struct ratbag_button *button,
|
|||||||
action.action.key.key = key;
|
action.action.key.key = key;
|
||||||
rc = button->profile->device->driver->write_button(button, &action);
|
rc = button->profile->device->driver->write_button(button, &action);
|
||||||
|
|
||||||
|
if (rc == 0)
|
||||||
|
button->action = action;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1032,6 +1041,9 @@ ratbag_button_disable(struct ratbag_button *button)
|
|||||||
action.type = RATBAG_BUTTON_ACTION_TYPE_NONE;
|
action.type = RATBAG_BUTTON_ACTION_TYPE_NONE;
|
||||||
rc = button->profile->device->driver->write_button(button, &action);
|
rc = button->profile->device->driver->write_button(button, &action);
|
||||||
|
|
||||||
|
if (rc == 0)
|
||||||
|
button->action = action;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -927,7 +927,7 @@ ratbag_resolution_is_default(const struct ratbag_resolution *resolution);
|
|||||||
*
|
*
|
||||||
* @return A button context, or NULL if the button does not exist.
|
* @return A button context, or NULL if the button does not exist.
|
||||||
*
|
*
|
||||||
* @see ratbag_get_num_buttons
|
* @see ratbag_device_get_num_buttons
|
||||||
*/
|
*/
|
||||||
struct ratbag_button*
|
struct ratbag_button*
|
||||||
ratbag_profile_get_button(struct ratbag_profile *profile, unsigned int index);
|
ratbag_profile_get_button(struct ratbag_profile *profile, unsigned int index);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* in alphabetical order! */
|
/* in alphabetical order! */
|
||||||
|
|
||||||
LIBRATBAG_0.1.0 {
|
LIBRATBAG_0.2.0 {
|
||||||
global:
|
global:
|
||||||
ratbag_create_context;
|
ratbag_create_context;
|
||||||
ratbag_button_disable;
|
ratbag_button_disable;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ libshared_la_LIBADD = $(LIBUDEV_CFLAGS) $(LIBEVDEV_LIBS)
|
|||||||
ratbag_command_SOURCES = ratbag-command.c
|
ratbag_command_SOURCES = ratbag-command.c
|
||||||
ratbag_command_LDADD = ../src/libratbag.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
|
ratbag_command_LDADD = ../src/libratbag.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
|
||||||
ratbag_command_CFLAGS = $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS)
|
ratbag_command_CFLAGS = $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS)
|
||||||
|
dist_man1_MANS = ratbag-command.man
|
||||||
|
|
||||||
hidpp10_dump_page_SOURCES = hidpp10-dump-page.c
|
hidpp10_dump_page_SOURCES = hidpp10-dump-page.c
|
||||||
hidpp10_dump_page_LDADD = ../src/libhidpp.la
|
hidpp10_dump_page_LDADD = ../src/libhidpp.la
|
||||||
@@ -28,5 +29,4 @@ hidpp20_dump_page_CFLAGS = -I$(top_srcdir)/src
|
|||||||
|
|
||||||
lur_command_SOURCeS = lur-command.c
|
lur_command_SOURCeS = lur-command.c
|
||||||
lur_command_LDADD = ../src/liblur.la
|
lur_command_LDADD = ../src/liblur.la
|
||||||
lur_command_LDFLAGS = -no-install
|
|
||||||
lur_command_CFLAGS = -I$(top_srcdir)/src
|
lur_command_CFLAGS = -I$(top_srcdir)/src
|
||||||
|
|||||||
141
tools/ratbag-command.man
Normal file
141
tools/ratbag-command.man
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
.TH RATBAG_COMMAND "1"
|
||||||
|
.SH NAME
|
||||||
|
ratbag-command \- Query or change a device's settings
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B ratbag-command [OPTIONS] {COMMAND} ... /path/to/device
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.PP
|
||||||
|
The
|
||||||
|
.I ratbag-commandq
|
||||||
|
tool query or change a device's settings.
|
||||||
|
.PP
|
||||||
|
This tool usually needs to be run as root to have access to the
|
||||||
|
/dev/input/eventX nodes.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP 8
|
||||||
|
.B --verbose
|
||||||
|
Print debugging output
|
||||||
|
.TP 8
|
||||||
|
.B --verbose=raw
|
||||||
|
Print debugging output with protocol output. No guarantees are given regarding
|
||||||
|
the output format when this flag is on.
|
||||||
|
.TP 8
|
||||||
|
.B --help
|
||||||
|
Print the help.
|
||||||
|
.SH General Commands
|
||||||
|
.TP 8
|
||||||
|
.B list
|
||||||
|
List supported devices (does not take a device argument)
|
||||||
|
.SH Device Commands
|
||||||
|
.TP 8
|
||||||
|
.B info
|
||||||
|
Print information about a device
|
||||||
|
.SH Profile Commands
|
||||||
|
.TP 8
|
||||||
|
.B profile active get
|
||||||
|
Print the currently active profile
|
||||||
|
.TP 8
|
||||||
|
.B profile active set N
|
||||||
|
Set profile N as to the active profile
|
||||||
|
.TP 8
|
||||||
|
.B profile N {COMMAND}
|
||||||
|
Use profile N for COMMAND
|
||||||
|
.SH Resolution Commands
|
||||||
|
Resolution commands work on the given profile, or on the active profile if none
|
||||||
|
is given.
|
||||||
|
.TP 8
|
||||||
|
.B resolution active get
|
||||||
|
Print the currently active resolution
|
||||||
|
.TP 8
|
||||||
|
.B resolution active set N
|
||||||
|
Set resolution N as the active resolution
|
||||||
|
.TP 8
|
||||||
|
.B resolution N {COMMAND}
|
||||||
|
Use resolution N for COMMAND
|
||||||
|
.SH DPI Commands
|
||||||
|
DPI commands work on the given profile and resolution, or on the active
|
||||||
|
resolution of the active profile if none are given.
|
||||||
|
.TP 8
|
||||||
|
.B dpi get
|
||||||
|
Print the dpi value
|
||||||
|
.TP 8
|
||||||
|
.B dpi set N
|
||||||
|
Set the dpi value to N
|
||||||
|
.TP 8
|
||||||
|
.B rate get
|
||||||
|
Print the report rate in Hz
|
||||||
|
.TP 8
|
||||||
|
.B rate set N
|
||||||
|
Set the report rate in N Hz
|
||||||
|
.SH Button Commands
|
||||||
|
Button commands work on the given profile, or on the active profile if none is
|
||||||
|
given.
|
||||||
|
.TP 8
|
||||||
|
.B button count
|
||||||
|
Print the number of buttons
|
||||||
|
.TP 8
|
||||||
|
.B button N action get
|
||||||
|
Print the button action
|
||||||
|
.TP 8
|
||||||
|
.B button N action set button B
|
||||||
|
Set the button action to button B
|
||||||
|
.TP 8
|
||||||
|
.B button N action set special S
|
||||||
|
Set the button action to special action S
|
||||||
|
.TP 8
|
||||||
|
.B button N action set macro ...
|
||||||
|
Set the button action to the given macro
|
||||||
|
.PP
|
||||||
|
.B Macro syntax:
|
||||||
|
.HP 8
|
||||||
|
A macro is a series of key events or waiting periods. Keys must be specified
|
||||||
|
in linux/input.h key names.
|
||||||
|
.RS
|
||||||
|
.TP 8
|
||||||
|
.B KEY_A
|
||||||
|
Press and release 'a'
|
||||||
|
.TP 8
|
||||||
|
.B +KEY_A
|
||||||
|
Press 'a'
|
||||||
|
.TP 8
|
||||||
|
.B -KEY_A
|
||||||
|
Release 'a'
|
||||||
|
.TP 8
|
||||||
|
.B t300
|
||||||
|
Wait 300ms
|
||||||
|
.RE
|
||||||
|
.SH Special Commands
|
||||||
|
These commands are for testing purposes and may be removed without notice
|
||||||
|
.TP 8
|
||||||
|
.B switch-etekcity
|
||||||
|
Switch the Etekcity mouse active profile
|
||||||
|
.SH Examples
|
||||||
|
.TP 8
|
||||||
|
ratbag-command profile active get
|
||||||
|
.TP 8
|
||||||
|
ratbag-command profile 0 resolution active set 4
|
||||||
|
.TP 8
|
||||||
|
ratbag-command profile 0 resolution 1 dpi get
|
||||||
|
.TP 8
|
||||||
|
ratbag-command resolution 4 rate get
|
||||||
|
.TP 8
|
||||||
|
ratbag-command dpi set 800
|
||||||
|
.SH Exit codes
|
||||||
|
.TP 8
|
||||||
|
.B 0
|
||||||
|
Success
|
||||||
|
.TP 8
|
||||||
|
.B 1
|
||||||
|
Unsupported feature or index out of available range
|
||||||
|
.TP 8
|
||||||
|
.B 2
|
||||||
|
Commandline arguments are invalid
|
||||||
|
.TP 8
|
||||||
|
.B 3
|
||||||
|
Invalid device or a command failed on the device
|
||||||
|
.SH NOTES
|
||||||
|
.PP
|
||||||
|
There is currently no guarantees that the output format of
|
||||||
|
.B ratbag-command
|
||||||
|
will not change in the future. There should be some stability with the commands
|
||||||
|
mentioned in this man page, but do not expect it to stay the same.
|
||||||
Reference in New Issue
Block a user