• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
33 int parse_mouse_dpi_property(const char *prop);
34 int parse_mouse_wheel_click_angle_property(const char *prop);
35 int parse_mouse_wheel_click_count_property(const char *prop);
36 bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
37 bool parse_calibration_property(const char *prop, float calibration[6]);
38 bool parse_range_property(const char *prop, int *hi, int *lo);
39 bool parse_boolean_property(const char *prop, bool *b);
40 #define EVENT_CODE_UNDEFINED 0xffff
41 bool parse_evcode_property(const char *prop, struct input_event *events, size_t *nevents);
42 bool parse_input_prop_property(const char *prop, unsigned int *props_out, size_t *nprops);
43 
44 enum tpkbcombo_layout {
45 	TPKBCOMBO_LAYOUT_UNKNOWN,
46 	TPKBCOMBO_LAYOUT_BELOW,
47 };
48 bool parse_tpkbcombo_layout_poperty(const char *prop,
49 				    enum tpkbcombo_layout *layout);
50 
51 enum switch_reliability {
52 	RELIABILITY_UNKNOWN,
53 	RELIABILITY_RELIABLE,
54 	RELIABILITY_WRITE_OPEN,
55 };
56 
57 bool
58 parse_switch_reliability_property(const char *prop,
59 				  enum switch_reliability *reliability);
60 
61 enum {
62 	ABS_MASK_MIN = 0x1,
63 	ABS_MASK_MAX = 0x2,
64 	ABS_MASK_RES = 0x4,
65 	ABS_MASK_FUZZ = 0x8,
66 	ABS_MASK_FLAT = 0x10,
67 };
68 
69 uint32_t parse_evdev_abs_prop(const char *prop, struct input_absinfo *abs);
70