/usr/include/libwacom-1.0/libwacom/libwacom.h is in libwacom-dev 0.4-1ubuntu1.
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | /*
* Copyright © 2011 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Authors:
* Peter Hutterer (peter.hutterer@redhat.com)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/** @cond hide_from_doxygen */
#ifndef _LIBWACOM_H_
#define _LIBWACOM_H_
/** @endcond */
/**
@mainpage
@section Introduction
libwacom is a library to identify wacom tablets and their model-specific
features. It provides easy access to information such as "is this a
built-in on-screen tablet", "what is the size of this model", etc.
@section Usage
The usage of libwacom in an application could look like this:
<pre>
WacomDevice *device;
device = libwacom_new_from_path("/dev/input/event0");
if (!device)
return; // should check for error here
if (libwacom_device_is_builtin(device))
printf("This is a built-in device\n");
libwacom_destroy(&device);
</pre>
For a full API reference to see libwacom.h.
@section Database
libwacom comes with a database of models and their features in key-value
format. If you cannot use libwacom, the files may be parsed directly. Note
that the file format may change over time, especially in the beginning.
*/
/**
@file libwacom.h
*/
typedef struct _WacomDevice WacomDevice;
typedef struct _WacomStylus WacomStylus;
typedef struct _WacomError WacomError;
typedef struct _WacomDeviceDatabase WacomDeviceDatabase;
#define WACOM_STYLUS_FALLBACK_ID 0xfffff
#define WACOM_ERASER_FALLBACK_ID 0xffffe
/**
* Possible error codes.
*/
enum WacomErrorCode {
WERROR_NONE, /**< No error has occured */
WERROR_BAD_ALLOC, /**< Allocation error */
WERROR_INVALID_PATH, /**< A path specified is invalid */
WERROR_INVALID_DB, /**< The passed DB is invalid */
WERROR_BAD_ACCESS, /**< Invalid permissions to access the path */
WERROR_UNKNOWN_MODEL, /**< Unsupported/unknown device */
};
/**
* Bus types for tablets.
*/
typedef enum {
WBUSTYPE_UNKNOWN, /**< Unknown/unsupported bus type */
WBUSTYPE_USB, /**< USB tablet */
WBUSTYPE_SERIAL, /**< Serial tablet */
WBUSTYPE_BLUETOOTH /**< Bluetooth tablet */
} WacomBusType;
/**
* Classes of devices.
*/
typedef enum {
WCLASS_UNKNOWN, /**< Unknown/unsupported device class */
WCLASS_INTUOS3, /**< Any Intuos3 series */
WCLASS_INTUOS4, /**< Any Intuos4 series */
WCLASS_INTUOS5, /**< Any Intuos5 series */
WCLASS_CINTIQ, /**< Any Cintiq device */
WCLASS_BAMBOO, /**< Any Bamboo device */
WCLASS_GRAPHIRE, /**< Any Graphire device */
WCLASS_ISDV4, /**< Any serial ISDV4 device */
} WacomClass;
/**
* Class of stylus
*/
typedef enum {
WSTYLUS_UNKNOWN,
WSTYLUS_GENERAL,
WSTYLUS_INKING,
WSTYLUS_AIRBRUSH,
WSTYLUS_CLASSIC,
WSTYLUS_MARKER,
WSTYLUS_STROKE,
WSTYLUS_PUCK
} WacomStylusType;
/**
* Capabilities of the various tablet buttons
*/
typedef enum {
WACOM_BUTTON_NONE = 0,
WACOM_BUTTON_POSITION_LEFT = (1 << 1),
WACOM_BUTTON_POSITION_RIGHT = (1 << 2),
WACOM_BUTTON_POSITION_TOP = (1 << 3),
WACOM_BUTTON_POSITION_BOTTOM = (1 << 4),
WACOM_BUTTON_RING_MODESWITCH = (1 << 5),
WACOM_BUTTON_RING2_MODESWITCH = (1 << 6),
WACOM_BUTTON_TOUCHSTRIP_MODESWITCH = (1 << 7),
WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH = (1 << 8),
WACOM_BUTTON_OLED = (1 << 9),
WACOM_BUTTON_MODESWITCH = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH),
WACOM_BUTTON_DIRECTION = (WACOM_BUTTON_POSITION_LEFT | WACOM_BUTTON_POSITION_RIGHT | WACOM_BUTTON_POSITION_TOP | WACOM_BUTTON_POSITION_BOTTOM),
WACOM_BUTTON_RINGS_MODESWITCH = (WACOM_BUTTON_RING_MODESWITCH | WACOM_BUTTON_RING2_MODESWITCH),
WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH = (WACOM_BUTTON_TOUCHSTRIP_MODESWITCH | WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH),
} WacomButtonFlags;
/**
* Allocate a new structure for error reporting.
*
* @return A newly allocated error structure or NULL if the allocation
* failed.
*/
WacomError* libwacom_error_new(void);
/**
* Free the error and associated memory.
* Resets error to NULL.
*
* @param error A reference to a error struct.
* @see libwacom_error_new
*/
void libwacom_error_free(WacomError **error);
/**
* @return The code for this error.
*/
enum WacomErrorCode libwacom_error_get_code(WacomError *error);
/**
* @return A human-readable message for this error
*/
const char* libwacom_error_get_message(WacomError *error);
/**
* Loads the Tablet and Stylus databases, to be used
* in libwacom_new_*() functions.
*
* @return A new database or NULL on error.
*/
WacomDeviceDatabase* libwacom_database_new(void);
/**
* Loads the Tablet and Stylus databases, to be used
* in libwacom_new_*() functions, from the prefix
* path passes. This is only useful for diagnostics
* applications.
*
* @return A new database or NULL on error.
*/
WacomDeviceDatabase* libwacom_database_new_for_path(const char *datadir);
/**
* Free all memory used by the database.
*
* @param db A Tablet and Stylus database.
*/
void libwacom_database_destroy(WacomDeviceDatabase *db);
/**
* Create a new device reference from the given device path.
* In case of error, NULL is returned and the error is set to the
* appropriate value.
*
* @param db A device database
* @param path A device path in the form of e.g. /dev/input/event0
* @param fallback Whether we should create a generic if model is unknown
* @param error If not NULL, set to the error if any occurs
*
* @return A new reference to this device or NULL on errror.
*/
WacomDevice* libwacom_new_from_path(WacomDeviceDatabase *db, const char *path, int fallback, WacomError *error);
/**
* Create a new device reference from the given vendor/product IDs.
* In case of error, NULL is returned and the error is set to the
* appropriate value.
*
* @param db A device database
* @param vendor_id The vendor ID of the device
* @param product_id The product ID of the device
* @param error If not NULL, set to the error if any occurs
*
* @return A new reference to this device or NULL on errror.
*/
WacomDevice* libwacom_new_from_usbid(WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error);
/**
* Create a new device reference from the given name.
* In case of error, NULL is returned and the error is set to the
* appropriate value.
*
* @param db A device database
* @param name The name identifying the device
* @param error If not NULL, set to the error if any occurs
*
* @return A new reference to this device or NULL on error.
*/
WacomDevice* libwacom_new_from_name(WacomDeviceDatabase *db, const char *name, WacomError *error);
/**
* Returns the list of devices in the given database.
*
* @param db A device database
* @param error If not NULL, set to the error if any occurs
*
* @return A NULL terminated list of pointers to all the devices inside the
* database.
* The content of the list is owned by the database and should not be
* modified of freed. Use free() to free the list.
*/
WacomDevice** libwacom_list_devices_from_database(WacomDeviceDatabase *db, WacomError *error);
/**
* Remove the device and free all memory and references to it.
*
* @param device The device to delete
*/
void libwacom_destroy(WacomDevice *device);
/**
* @param device The tablet to query
* @return The class of the device
*/
WacomClass libwacom_get_class(WacomDevice *device);
/**
* @param device The tablet to query
* @return The human-readable name for this device
*/
const char* libwacom_get_name(WacomDevice *device);
/**
* @param device The tablet to query
* @return The numeric vendor ID for this device
*/
int libwacom_get_vendor_id(WacomDevice *device);
/**
* @param device The tablet to query
* @return The first match for the device in question
*/
const char* libwacom_get_match(WacomDevice *device);
/**
* @param device The tablet to query
* @return The numeric product ID for this device
*/
int libwacom_get_product_id(WacomDevice *device);
/**
* Retrieve the width of the device. This is the width of the usable area as
* advertised, not the total size of the physical tablet. For e.g. an
* Intuos4 6x9 this will return 9.
*
* @param device The tablet to query
* @return The width of this device in inches
*/
int libwacom_get_width(WacomDevice *device);
/**
* Retrieve the height of the device. This is the height of the usable area as
* advertised, not the total size of the physical tablet. For e.g. an
* Intuos4 6x9 this will return 6.
*
* @param device The tablet to query
* @return The width of this device in inches
*/
int libwacom_get_height(WacomDevice *device);
/**
* @param device The tablet to query
* @return non-zero if the device supports styli or zero otherwise
*/
int libwacom_has_stylus(WacomDevice *device);
/**
* @param device The tablet to query
* @return non-zero if the device supports touch or zero otherwise
*/
int libwacom_has_touch(WacomDevice *device);
/**
* @param device The tablet to query
* @return The number of buttons on the tablet
*/
int libwacom_get_num_buttons(WacomDevice *device);
/**
* @param device The tablet to query
* @param num_styli Return location for the number of listed styli
* @return an array of Styli IDs supported by the device
*/
int *libwacom_get_supported_styli(WacomDevice *device, int *num_styli);
/**
* @param device The tablet to query
* @return non-zero if the device has a touch ring or zero otherwise
*/
int libwacom_has_ring(WacomDevice *device);
/**
* @param device The tablet to query
* @return non-zero if the device has a second touch ring or zero otherwise
*/
int libwacom_has_ring2(WacomDevice *device);
/**
* @param device The tablet to query
* @return the number of modes for the touchring if it has a mode switch
*/
int libwacom_get_ring_num_modes(WacomDevice *device);
/**
* @param device The tablet to query
* @return the number of modes for the second touchring if it has a mode switch
*/
int libwacom_get_ring2_num_modes(WacomDevice *device);
/**
* @param device The tablet to query
* @return the number of touch strips on the tablet
* otherwise
*/
int libwacom_get_num_strips(WacomDevice *device);
/**
* @param device The tablet to query
* @return the number of modes for each of the touchstrips if any
*/
int libwacom_get_strips_num_modes(WacomDevice *device);
/**
* @param device The tablet to query
* @return non-zero if the device is built-in or zero if the device is an
* external tablet
*/
int libwacom_is_builtin(WacomDevice *device);
/**
* @param device The tablet to query
* @return non-zero if the device can be used left-handed
* (rotated 180 degrees)
*/
int libwacom_is_reversible(WacomDevice *device);
/**
* @param device The tablet to query
* @return The bustype of this device.
*/
WacomBusType libwacom_get_bustype(WacomDevice *device);
/*
* @param device The tablet to query
* @param button The ID of the button to check for, between 'A' and 'Z'
* @return a WacomButtonFlags with information about the button
*/
WacomButtonFlags libwacom_get_button_flag(WacomDevice *device,
char button);
/**
* Get the WacomStylus for the given tool ID.
*
* @param db A Tablet and Stylus database.
* @param id The Tool ID for this stylus
* @return A WacomStylus representing the stylus. Do not free.
*/
const WacomStylus *libwacom_stylus_get_for_id (WacomDeviceDatabase *db, int id);
/**
* @param stylus The stylus to query
* @return the ID of the tool
*/
int libwacom_stylus_get_id (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return The name of the stylus
*/
const char *libwacom_stylus_get_name (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return The number of buttons on the stylus
*/
int libwacom_stylus_get_num_buttons (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return Whether the stylus has an eraser
*/
int libwacom_stylus_has_eraser (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return Whether the stylus is actually an eraser
*/
int libwacom_stylus_is_eraser (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return Whether the stylus has a lens
*/
int libwacom_stylus_has_lens (const WacomStylus *stylus);
/**
* @param stylus The stylus to query
* @return The type of stylus
*/
WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
#endif /* _LIBWACOM_H_ */
/* vim: set noexpandtab shiftwidth=8: */
|