summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/libinput-debug-events.man10
-rw-r--r--tools/libinput-list-devices.c6
-rw-r--r--tools/ptraccel-debug.c29
-rw-r--r--tools/shared.c21
-rw-r--r--tools/shared.h7
5 files changed, 66 insertions, 7 deletions
diff --git a/tools/libinput-debug-events.man b/tools/libinput-debug-events.man
index 8a63821e..07674990 100644
--- a/tools/libinput-debug-events.man
+++ b/tools/libinput-debug-events.man
@@ -68,6 +68,11 @@ Enable or disable middle button emulation
.B \-\-enable\-dwt|\-\-disable\-dwt
Enable or disable disable-while-typing
.TP 8
+.B \-\-set\-accel-curve-points="x1:y1;x2:y2"
+Sets the curve points for the \fIcustom-speed\fR acceleration profile. The
+set of curve points is a semicolon-separate lists of key-value pairs, each
+separated by a colon. Each value is a non-negative double.
+.TP 8
.B \-\-set\-click\-method=[none|clickfinger|buttonareas]
Set the desired click method
.TP 8
@@ -77,8 +82,9 @@ Set the desired scroll method
.B \-\-set\-scroll\-button=BTN_MIDDLE
Set the button to the given button code
.TP 8
-.B \-\-set\-profile=[adaptive|flat]
-Set pointer acceleration profile
+.B \-\-set\-profile=[adaptive|flat|custom-speed]
+Set pointer acceleration profile. If the \fIcustom-speed\fR profile is
+selected, use \fB\-\-set-accel-curve-points\fR to specify the curve points.
.TP 8
.B \-\-set\-speed=<value>
Set pointer acceleration speed. The allowed range is [-1, 1].
diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c
index aa225ca0..060d4b29 100644
--- a/tools/libinput-list-devices.c
+++ b/tools/libinput-list-devices.c
@@ -205,11 +205,13 @@ accel_profiles(struct libinput_device *device)
profile = libinput_device_config_accel_get_default_profile(device);
xasprintf(&str,
- "%s%s %s%s",
+ "%s%s %s%s %s%s",
(profile == LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "*" : "",
(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "flat" : "",
(profile == LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "*" : "",
- (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "adaptive" : "");
+ (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "adaptive" : "",
+ (profile == LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) ? "*" : "",
+ (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) ? "custom-speed" : "");
return str;
}
diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c
index 93be523f..ab7bc13e 100644
--- a/tools/ptraccel-debug.c
+++ b/tools/ptraccel-debug.c
@@ -161,11 +161,12 @@ print_accel_func(struct motion_filter *filter,
printf("# set style data lines\n");
printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n");
printf("#\n");
- printf("# data: velocity(mm/s) factor velocity(units/us)\n");
+ printf("# data: velocity(mm/s) factor velocity(units/us) velocity(units/ms)\n");
for (mmps = 0.0; mmps < 1000.0; mmps += 1) {
double units_per_us = mmps_to_upus(mmps, dpi);
+ double units_per_ms = units_per_us * 1000;
double result = profile(filter, NULL, units_per_us, 0 /* time */);
- printf("%.8f\t%.4f\t%.8f\n", mmps, result, units_per_us);
+ printf("%.8f\t%.4f\t%.8f\t%.8f\n", mmps, result, units_per_us, units_per_ms);
}
}
@@ -239,6 +240,7 @@ main(int argc, char **argv)
const char *filter_type = "linear";
accel_profile_func_t profile = NULL;
int tp_range_max = 20;
+ const char *curve_points = NULL;
enum {
OPT_HELP = 1,
@@ -250,6 +252,7 @@ main(int argc, char **argv)
OPT_DPI,
OPT_FILTER,
OPT_TRACKPOINT_RANGE,
+ OPT_CURVE_POINTS,
};
while (1) {
@@ -265,6 +268,7 @@ main(int argc, char **argv)
{"dpi", 1, 0, OPT_DPI },
{"filter", 1, 0, OPT_FILTER },
{"trackpoint-range", 1, 0, OPT_TRACKPOINT_RANGE },
+ {"curve-points", 1, 0, OPT_CURVE_POINTS },
{0, 0, 0, 0}
};
@@ -325,6 +329,9 @@ main(int argc, char **argv)
case OPT_TRACKPOINT_RANGE:
tp_range_max = strtod(optarg, NULL);
break;
+ case OPT_CURVE_POINTS:
+ curve_points = optarg;
+ break;
default:
usage();
exit(1);
@@ -347,6 +354,24 @@ main(int argc, char **argv)
} else if (streq(filter_type, "trackpoint")) {
filter = create_pointer_accelerator_filter_trackpoint(tp_range_max);
profile = NULL; /* trackpoint is special */
+ } else if (streq(filter_type, "custom-speed")) {
+ struct key_value_double *points;
+ ssize_t npoints;
+
+ filter = create_pointer_accelerator_filter_custom_device_speed();
+ profile = custom_accel_profile;
+
+ npoints = kv_double_from_string(curve_points, ";", ":", &points);
+ if (npoints <= 0)
+ return 1;
+
+ for (ssize_t idx = 0; idx < npoints; idx++){
+ filter_set_curve_point(filter,
+ points[idx].key,
+ points[idx].value);
+ }
+
+ free(points);
} else {
fprintf(stderr, "Invalid filter type %s\n", filter_type);
return 1;
diff --git a/tools/shared.c b/tools/shared.c
index c1ce6473..85c0d739 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -218,6 +218,17 @@ tools_parse_option(int option,
"%s",
optarg);
break;
+ case OPT_CURVE_POINTS:
+ if (!optarg)
+ return 1;
+
+ options->ncurve_points = kv_double_from_string(
+ optarg,
+ ";", ":",
+ &options->curve_points);
+ if (options->ncurve_points < 0)
+ return 1;
+ break;
}
return 0;
@@ -386,6 +397,16 @@ tools_device_apply_config(struct libinput_device *device,
libinput_device_config_send_events_set_mode(device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
}
+
+ if (libinput_device_config_accel_get_profile(device) ==
+ LIBINPUT_CONFIG_ACCEL_PROFILE_DEVICE_SPEED_CURVE) {
+ for (ssize_t idx = 0; idx < options->ncurve_points; idx++) {
+ double x = options->curve_points[idx].key,
+ fx = options->curve_points[idx].value;
+
+ libinput_device_config_accel_set_curve_point(device, x, fx);
+ }
+ }
}
static char*
diff --git a/tools/shared.h b/tools/shared.h
index 55e15409..dc61b5b7 100644
--- a/tools/shared.h
+++ b/tools/shared.h
@@ -50,6 +50,7 @@ enum configuration_options {
OPT_SPEED,
OPT_PROFILE,
OPT_DISABLE_SENDEVENTS,
+ OPT_CURVE_POINTS,
};
#define CONFIGURATION_OPTIONS \
@@ -73,7 +74,8 @@ enum configuration_options {
{ "set-scroll-button", required_argument, 0, OPT_SCROLL_BUTTON }, \
{ "set-profile", required_argument, 0, OPT_PROFILE }, \
{ "set-tap-map", required_argument, 0, OPT_TAP_MAP }, \
- { "set-speed", required_argument, 0, OPT_SPEED }
+ { "set-speed", required_argument, 0, OPT_SPEED }, \
+ { "set-accel-curve-points", required_argument, 0, OPT_CURVE_POINTS }
enum tools_backend {
BACKEND_DEVICE,
@@ -95,6 +97,9 @@ struct tools_options {
int dwt;
enum libinput_config_accel_profile profile;
char disable_pattern[64];
+
+ struct key_value_double *curve_points;
+ ssize_t ncurve_points;
};
void tools_init_options(struct tools_options *options);