util: remove now-unused helper functions

Obsolete with the switch to the device quirks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-08-02 15:02:18 +10:00
parent 548e0eb98b
commit a508097e98
3 changed files with 0 additions and 159 deletions

View file

@ -251,28 +251,6 @@ parse_mouse_wheel_click_angle_property(const char *prop)
return angle;
}
/**
* Helper function to parse the TRACKPOINT_CONST_ACCEL property from udev.
* Property is of the form:
* TRACKPOINT_CONST_ACCEL=<float>
*
* @param prop The value of the udev property (without the TRACKPOINT_CONST_ACCEL=)
* @return The acceleration, or 0.0 on error.
*/
double
parse_trackpoint_accel_property(const char *prop)
{
double accel;
if (!prop)
return 0.0;
if (!safe_atod(prop, &accel))
accel = 0.0;
return accel;
}
/**
* Parses a simple dimension string in the form of "10x40". The two
* numbers must be positive integers in decimal notation.
@ -420,81 +398,6 @@ parse_range_property(const char *prop, int *hi, int *lo)
return true;
}
/**
* Helper function to parse the LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD
* property from udev. Property is of the form:
* LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD=<integer>
* Where the number indicates the minimum threshold to consider a touch to
* be a palm.
*
* @param prop The value of the udev property (without the *
* LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD=)
* @return The pressure threshold or 0 on error
*/
int
parse_palm_pressure_property(const char *prop)
{
int threshold = 0;
if (!prop)
return 0;
if (!safe_atoi(prop, &threshold) || threshold < 0)
return 0;
return threshold;
}
/**
* Helper function to parse the LIBINPUT_ATTR_PALM_SIZE_THRESHOLD property
* from udev. Property is of the form:
* LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=<integer>
* Where the number indicates the minimum threshold to consider a touch to
* be a palm.
*
* @param prop The value of the udev property (without the
* LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=)
* @return The pressure threshold or 0 on error
*/
int
parse_palm_size_property(const char *prop)
{
int thr = 0;
if (!prop)
return 0;
if (!safe_atoi(prop, &thr) || thr < 0 || thr > 2028)
return 0;
return thr;
}
/**
* Helper function to parse the LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD
* property from udev. Property is of the form:
* LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD=<integer>
* Where the number indicates the minimum threshold to consider a touch to
* be a thumb.
*
* @param prop The value of the udev property (without the
* LIBINPUT_ATTR_THUMB_PRESSURE_THRESHOLD=)
* @return The pressure threshold or 0 on error
*/
int
parse_thumb_pressure_property(const char *prop)
{
int threshold = 0;
if (!prop)
return 0;
if (!safe_atoi(prop, &threshold) || threshold < 0)
return 0;
return threshold;
}
/**
* Return the next word in a string pointed to by state before the first
* separator character. Call repeatedly to tokenize a whole string.

View file

@ -422,13 +422,9 @@ enum ratelimit_state ratelimit_test(struct ratelimit *r);
int parse_mouse_dpi_property(const char *prop);
int parse_mouse_wheel_click_angle_property(const char *prop);
int parse_mouse_wheel_click_count_property(const char *prop);
double parse_trackpoint_accel_property(const char *prop);
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
bool parse_calibration_property(const char *prop, float calibration[6]);
bool parse_range_property(const char *prop, int *hi, int *lo);
int parse_palm_pressure_property(const char *prop);
int parse_palm_size_property(const char *prop);
int parse_thumb_pressure_property(const char *prop);
enum tpkbcombo_layout {
TPKBCOMBO_LAYOUT_UNKNOWN,

View file

@ -838,35 +838,6 @@ START_TEST(wheel_click_count_parser)
}
END_TEST
struct parser_test_float {
char *tag;
double expected_value;
};
START_TEST(trackpoint_accel_parser)
{
struct parser_test_float tests[] = {
{ "0.5", 0.5 },
{ "1.0", 1.0 },
{ "2.0", 2.0 },
{ "fail1.0", 0.0 },
{ "1.0fail", 0.0 },
{ "0,5", 0.0 },
{ NULL, 0.0 }
};
int i;
double accel;
for (i = 0; tests[i].tag != NULL; i++) {
accel = parse_trackpoint_accel_property(tests[i].tag);
ck_assert(accel == tests[i].expected_value);
}
accel = parse_trackpoint_accel_property(NULL);
ck_assert_double_eq(accel, 0.0);
}
END_TEST
struct parser_test_dimension {
char *tag;
bool success;
@ -1051,33 +1022,6 @@ START_TEST(range_prop_parser)
}
END_TEST
START_TEST(palm_pressure_parser)
{
struct parser_test tests[] = {
{ "1", 1 },
{ "10", 10 },
{ "255", 255 },
{ "360", 360 },
{ "-12", 0 },
{ "0", 0 },
{ "-0", 0 },
{ "a", 0 },
{ "10a", 0 },
{ "10-", 0 },
{ "sadfasfd", 0 },
{ NULL, 0 }
};
int i, angle;
for (i = 0; tests[i].tag != NULL; i++) {
angle = parse_palm_pressure_property(tests[i].tag);
ck_assert_int_eq(angle, tests[i].expected_value);
}
}
END_TEST
START_TEST(time_conversion)
{
ck_assert_int_eq(us(10), 10);
@ -1798,12 +1742,10 @@ TEST_COLLECTION(misc)
litest_add_deviceless("misc:parser", dpi_parser);
litest_add_deviceless("misc:parser", wheel_click_parser);
litest_add_deviceless("misc:parser", wheel_click_count_parser);
litest_add_deviceless("misc:parser", trackpoint_accel_parser);
litest_add_deviceless("misc:parser", dimension_prop_parser);
litest_add_deviceless("misc:parser", reliability_prop_parser);
litest_add_deviceless("misc:parser", calibration_prop_parser);
litest_add_deviceless("misc:parser", range_prop_parser);
litest_add_deviceless("misc:parser", palm_pressure_parser);
litest_add_deviceless("misc:parser", safe_atoi_test);
litest_add_deviceless("misc:parser", safe_atoi_base_16_test);
litest_add_deviceless("misc:parser", safe_atoi_base_8_test);