1/*
2 * Copyright © 2013-2019 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#pragma once
25
26#include "config.h"
27
28#include <linux/input.h>
29#include <stdbool.h>
30#include <stddef.h>
31#include <stdint.h>
32
33struct input_prop {
34	unsigned int prop;
35	bool enabled;
36};
37
38int parse_mouse_dpi_property(const char *prop);
39int parse_mouse_wheel_click_angle_property(const char *prop);
40int parse_mouse_wheel_click_count_property(const char *prop);
41bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
42bool parse_calibration_property(const char *prop, float calibration[6]);
43bool parse_range_property(const char *prop, int *hi, int *lo);
44bool parse_boolean_property(const char *prop, bool *b);
45#define EVENT_CODE_UNDEFINED 0xffff
46bool parse_evcode_property(const char *prop, struct input_event *events, size_t *nevents);
47bool parse_input_prop_property(const char *prop, struct input_prop *props_out, size_t *nprops);
48
49enum tpkbcombo_layout {
50	TPKBCOMBO_LAYOUT_UNKNOWN,
51	TPKBCOMBO_LAYOUT_BELOW,
52};
53bool parse_tpkbcombo_layout_poperty(const char *prop,
54				    enum tpkbcombo_layout *layout);
55
56enum switch_reliability {
57	RELIABILITY_RELIABLE,
58	RELIABILITY_UNRELIABLE,
59	RELIABILITY_WRITE_OPEN,
60};
61
62bool
63parse_switch_reliability_property(const char *prop,
64				  enum switch_reliability *reliability);
65
66enum {
67	ABS_MASK_MIN = 0x1,
68	ABS_MASK_MAX = 0x2,
69	ABS_MASK_RES = 0x4,
70	ABS_MASK_FUZZ = 0x8,
71	ABS_MASK_FLAT = 0x10,
72};
73
74uint32_t parse_evdev_abs_prop(const char *prop, struct input_absinfo *abs);
75