/usr/include/tslib.h is in libts-dev 1.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | #ifndef _TSLIB_H_
#define _TSLIB_H_
/*
* tslib/src/tslib.h
*
* Copyright (C) 2016 Martin Kepplinger <martink@posteo.de>
* Copyright (C) 2001 Russell King.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* SPDX-License-Identifier: LGPL-2.1
*
*
* Touch screen library interface definitions.
*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <stdarg.h>
#include <sys/time.h>
#ifdef WIN32
#define TSIMPORT __declspec(dllimport)
#define TSEXPORT __declspec(dllexport)
#define TSLOCAL
#else
#define TSIMPORT
#ifdef GCC_HASCLASSVISIBILITY
#define TSEXPORT __attribute__ ((visibility("default")))
#define TSLOCAL __attribute__ ((visibility("hidden")))
#else
#define TSEXPORT
#define TSLOCAL
#endif
#endif
#ifdef TSLIB_INTERNAL
#define TSAPI TSEXPORT
#else
#define TSAPI TSIMPORT
#endif /* TSLIB_INTERNAL */
struct tsdev;
struct ts_sample {
int x;
int y;
unsigned int pressure;
struct timeval tv;
};
struct ts_sample_mt {
/* ABS_MT_* event codes. linux/include/uapi/linux/input-event-codes.h
* has the definitions.
*/
int x;
int y;
unsigned int pressure;
int slot;
int tracking_id;
int tool_type;
int tool_x;
int tool_y;
unsigned int touch_major;
unsigned int width_major;
unsigned int touch_minor;
unsigned int width_minor;
int orientation;
int distance;
int blob_id;
struct timeval tv;
/* BTN_TOUCH state */
short pen_down;
/* valid is set != 0 if this sample
* contains new data; see below for the
* bits that get set.
* valid is set to 0 otherwise
*/
short valid;
};
#define TSLIB_MT_VALID (1 << 0) /* any new data */
#define TSLIB_MT_VALID_TOOL (1 << 1) /* new tool_x or tool_y data */
struct ts_lib_version_data {
const char *package_version;
int version_num;
unsigned int features; /* bitmask, see below */
};
#define TSLIB_VERSION_MT (1 << 0) /* multitouch support */
#define TSLIB_VERSION_OPEN_RESTRICTED (1 << 1) /* ts_open_restricted() */
#define TSLIB_VERSION_EVENTPATH (1 << 2) /* ts_get_eventpath() */
enum ts_param {
TS_SCREEN_RES = 0, /* 2 integer args, x and y */
TS_SCREEN_ROT /* 1 integer arg, 1 = rotate */
};
/*
* Close the touchscreen device, free all resources.
*/
TSAPI int ts_close(struct tsdev *);
/*
* Reloads all modules - useful to reload calibration data.
*/
TSAPI int ts_reconfig(struct tsdev *);
/*
* Configure the touchscreen device.
*/
TSAPI int ts_config(struct tsdev *);
/*
* Changes a setting.
*/
TSAPI int ts_option(struct tsdev *, enum ts_param, ...);
/*
* Change this hook to point to your custom error handling function.
*/
extern TSAPI int (*ts_error_fn)(const char *fmt, va_list ap);
/*
* Implement this to override open() for the input device and return the fd.
*/
extern TSAPI int (*ts_open_restricted)(const char *path, int flags, void *user_data);
/*
* Implement this to override close().
*/
extern TSAPI void (*ts_close_restricted)(int fd, void *user_data);
/*
* Returns the file descriptor in use for the touchscreen device.
*/
TSAPI int ts_fd(struct tsdev *);
/*
* Load a filter/scaling module
*/
TSAPI int ts_load_module(struct tsdev *, const char *mod, const char *params);
/*
* Open the touchscreen device.
*/
TSAPI struct tsdev *ts_open(const char *dev_name, int nonblock);
/*
* Find, open and configure the touchscreen device.
*/
TSAPI struct tsdev *ts_setup(const char *dev_name, int nonblock);
/*
* Return a scaled touchscreen sample.
*/
TSAPI int ts_read(struct tsdev *, struct ts_sample *, int);
/*
* Returns a raw, unscaled sample from the touchscreen.
*/
TSAPI int ts_read_raw(struct tsdev *, struct ts_sample *, int);
/*
* Return a scaled touchscreen multitouch sample.
*/
TSAPI int ts_read_mt(struct tsdev *, struct ts_sample_mt **, int slots, int nr);
/*
* Return a raw, unscaled touchscreen multitouch sample.
*/
TSAPI int ts_read_raw_mt(struct tsdev *, struct ts_sample_mt **, int slots, int nr);
/*
* This function returns a pointer to a static copy of the version info struct.
*/
TSAPI struct ts_lib_version_data *ts_libversion(void);
/*
* This function returns the path to the opened touchscreen input device file.
*/
TSAPI char *ts_get_eventpath(struct tsdev *tsdev);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _TSLIB_H_ */
|