libwacom
Wacom model identification library
libwacom.h
Go to the documentation of this file.
1/*
2 * Copyright © 2011 Red Hat, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of Red Hat
9 * not be used in advertising or publicity pertaining to distribution
10 * of the software without specific, written prior permission. Red
11 * Hat makes no representations about the suitability of this software
12 * for any purpose. It is provided "as is" without express or implied
13 * warranty.
14 *
15 * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authors:
24 * Peter Hutterer (peter.hutterer@redhat.com)
25 */
26
27
29#ifndef _LIBWACOM_H_
30#define _LIBWACOM_H_
33#include <stdint.h>
34#include <stdio.h>
35
36#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
37#define LIBWACOM_DEPRECATED __attribute__((deprecated))
38#else
39#define LIBWACOM_DEPRECATED
40#endif /* __GNUC__ */
41
95typedef struct _WacomDevice WacomDevice;
96
100typedef struct _WacomMatch WacomMatch;
101
105typedef struct _WacomStylus WacomStylus;
106
110typedef struct _WacomError WacomError;
111
115typedef struct _WacomDeviceDatabase WacomDeviceDatabase;
116
120#define WACOM_STYLUS_FALLBACK_ID 0xfffff
124#define WACOM_ERASER_FALLBACK_ID 0xffffe
125
139};
140
146typedef enum {
153
159typedef enum {
164
173typedef enum {
186} WacomClass;
187
193typedef enum {
205
211typedef enum {
217
223typedef enum {
239
245typedef enum {
258
262typedef enum {
266
270typedef enum {
272 WCOMPARE_MATCHES = (1 << 1),
274
278typedef enum {
285
295
306
313
320
330
342
351
367
385WacomDevice* libwacom_new_from_usbid(const WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error);
386
401
416
426
427
436
449
461
468const char* libwacom_get_name(const WacomDevice *device);
469
476const char* libwacom_get_model_name(const WacomDevice *device);
477
485const char* libwacom_get_layout_filename(const WacomDevice *device);
486
498
506const char* libwacom_get_match(const WacomDevice *device);
507
516
534
546
558
570
578
586
596
604const int *libwacom_get_supported_styli(const WacomDevice *device, int *num_styli);
605
613
621
629
637
645
654
662
670const WacomStatusLEDs *libwacom_get_status_leds(const WacomDevice *device, int *num_leds);
671
681 char button);
682
692
701
709
717
726 char button);
727
737 char button);
738
749
757
764const char *libwacom_stylus_get_name (const WacomStylus *stylus);
765
773const int *libwacom_stylus_get_paired_ids(const WacomStylus *stylus, int *num_paired_ids);
774
782
798
815
823
831
839
847
855
865
868const char *libwacom_match_get_name(const WacomMatch *match);
876#endif /* _LIBWACOM_H_ */
879/* vim: set noexpandtab tabstop=8 shiftwidth=8: */
WacomError * libwacom_error_new(void)
Allocate a new structure for error reporting.
const char * libwacom_error_get_message(WacomError *error)
WacomDeviceDatabase * libwacom_database_new_for_path(const char *datadir)
Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions, from the prefix path...
void libwacom_error_free(WacomError **error)
Free the error and associated memory.
struct _WacomDeviceDatabase WacomDeviceDatabase
Definition: libwacom.h:115
enum WacomErrorCode libwacom_error_get_code(WacomError *error)
WacomDeviceDatabase * libwacom_database_new(void)
Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions.
WacomErrorCode
Possible error codes.
Definition: libwacom.h:131
struct _WacomError WacomError
Definition: libwacom.h:110
void libwacom_database_destroy(WacomDeviceDatabase *db)
Free all memory used by the database.
@ WERROR_NONE
No error has occured.
Definition: libwacom.h:132
@ WERROR_BAD_ALLOC
Allocation error.
Definition: libwacom.h:133
@ WERROR_UNKNOWN_MODEL
Unsupported/unknown device.
Definition: libwacom.h:137
@ WERROR_INVALID_DB
The passed DB is invalid.
Definition: libwacom.h:135
@ WERROR_BUG_CALLER
A bug in the caller.
Definition: libwacom.h:138
@ WERROR_BAD_ACCESS
Invalid permissions to access the path.
Definition: libwacom.h:136
@ WERROR_INVALID_PATH
A path specified is invalid.
Definition: libwacom.h:134
int libwacom_has_stylus(const WacomDevice *device)
const char * libwacom_get_layout_filename(const WacomDevice *device)
int libwacom_get_num_strips(const WacomDevice *device)
WacomDevice * libwacom_new_from_usbid(const WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error)
Create a new device reference from the given vendor/product IDs.
WacomStatusLEDs
Definition: libwacom.h:278
int libwacom_get_strips_num_modes(const WacomDevice *device)
int libwacom_get_width(const WacomDevice *device)
Retrieve the width of the device.
int libwacom_get_ring_num_modes(const WacomDevice *device)
int libwacom_has_touch(const WacomDevice *device)
const WacomMatch * libwacom_get_paired_device(const WacomDevice *device)
Return the match string of the paired device for this device.
const char * libwacom_get_match(const WacomDevice *device)
int libwacom_get_product_id(const WacomDevice *device)
int libwacom_get_button_led_group(const WacomDevice *device, char button)
const char * libwacom_get_name(const WacomDevice *device)
void libwacom_print_device_description(int fd, const WacomDevice *device)
Print the description of this device to the given file.
int libwacom_get_vendor_id(const WacomDevice *device)
void libwacom_destroy(WacomDevice *device)
Remove the device and free all memory and references to it.
WacomButtonFlags
Capabilities of the various tablet buttons.
Definition: libwacom.h:223
int libwacom_is_builtin(const WacomDevice *device) LIBWACOM_DEPRECATED
WacomIntegrationFlags libwacom_get_integration_flags(const WacomDevice *device)
WacomIntegrationFlags
Tablet integration.
Definition: libwacom.h:159
int libwacom_has_ring2(const WacomDevice *device)
WacomBusType libwacom_match_get_bustype(const WacomMatch *match)
const char * libwacom_match_get_name(const WacomMatch *match)
int libwacom_get_button_evdev_code(const WacomDevice *device, char button)
int libwacom_compare(const WacomDevice *a, const WacomDevice *b, WacomCompareFlags flags)
Compare the two devices for equal-ness.
uint32_t libwacom_match_get_vendor_id(const WacomMatch *match)
const WacomMatch ** libwacom_get_matches(const WacomDevice *device)
WacomCompareFlags
Definition: libwacom.h:270
uint32_t libwacom_match_get_product_id(const WacomMatch *match)
int libwacom_is_reversible(const WacomDevice *device)
const char * libwacom_get_model_name(const WacomDevice *device)
WacomDevice ** libwacom_list_devices_from_database(const WacomDeviceDatabase *db, WacomError *error)
Returns the list of devices in the given database.
WacomBusType libwacom_get_bustype(const WacomDevice *device)
WacomButtonFlags libwacom_get_button_flag(const WacomDevice *device, char button)
WacomClass
Classes of devices.
Definition: libwacom.h:173
WacomBusType
Bus types for tablets.
Definition: libwacom.h:146
WacomFallbackFlags
Definition: libwacom.h:262
WacomDevice * libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFallbackFlags fallback, WacomError *error)
Create a new device reference from the given device path.
int libwacom_get_num_buttons(const WacomDevice *device)
Tablet buttons are numbered 'A' through to 'A' + number of buttons.
int libwacom_get_height(const WacomDevice *device)
Retrieve the height of the device.
LIBWACOM_DEPRECATED WacomClass libwacom_get_class(const WacomDevice *device)
int libwacom_get_ring2_num_modes(const WacomDevice *device)
int libwacom_has_touchswitch(const WacomDevice *device)
struct _WacomMatch WacomMatch
Definition: libwacom.h:100
struct _WacomDevice WacomDevice
Definition: libwacom.h:95
const char * libwacom_match_get_match_string(const WacomMatch *match)
WacomDevice * libwacom_new_from_name(const WacomDeviceDatabase *db, const char *name, WacomError *error)
Create a new device reference from the given name.
int libwacom_has_ring(const WacomDevice *device)
const WacomStatusLEDs * libwacom_get_status_leds(const WacomDevice *device, int *num_leds)
@ WACOM_STATUS_LED_TOUCHSTRIP2
Definition: libwacom.h:283
@ WACOM_STATUS_LED_UNAVAILABLE
Definition: libwacom.h:279
@ WACOM_STATUS_LED_RING
Definition: libwacom.h:280
@ WACOM_STATUS_LED_RING2
Definition: libwacom.h:281
@ WACOM_STATUS_LED_TOUCHSTRIP
Definition: libwacom.h:282
@ WACOM_BUTTON_POSITION_BOTTOM
Definition: libwacom.h:228
@ WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH
Definition: libwacom.h:237
@ WACOM_BUTTON_NONE
Definition: libwacom.h:224
@ WACOM_BUTTON_RINGS_MODESWITCH
Definition: libwacom.h:236
@ WACOM_BUTTON_DIRECTION
Definition: libwacom.h:235
@ WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH
Definition: libwacom.h:232
@ WACOM_BUTTON_POSITION_TOP
Definition: libwacom.h:227
@ WACOM_BUTTON_RING2_MODESWITCH
Definition: libwacom.h:230
@ WACOM_BUTTON_POSITION_LEFT
Definition: libwacom.h:225
@ WACOM_BUTTON_POSITION_RIGHT
Definition: libwacom.h:226
@ WACOM_BUTTON_MODESWITCH
Definition: libwacom.h:234
@ WACOM_BUTTON_OLED
Definition: libwacom.h:233
@ WACOM_BUTTON_TOUCHSTRIP_MODESWITCH
Definition: libwacom.h:231
@ WACOM_BUTTON_RING_MODESWITCH
Definition: libwacom.h:229
@ WACOM_DEVICE_INTEGRATED_DISPLAY
Definition: libwacom.h:161
@ WACOM_DEVICE_INTEGRATED_NONE
Definition: libwacom.h:160
@ WACOM_DEVICE_INTEGRATED_SYSTEM
Definition: libwacom.h:162
@ WCOMPARE_NORMAL
compare the device only
Definition: libwacom.h:271
@ WCOMPARE_MATCHES
compare all possible matches too
Definition: libwacom.h:272
@ WCLASS_INTUOS3
Any Intuos3 series.
Definition: libwacom.h:175
@ WCLASS_REMOTE
Any Wacom Remote.
Definition: libwacom.h:185
@ WCLASS_CINTIQ
Any Cintiq device.
Definition: libwacom.h:178
@ WCLASS_UNKNOWN
Unknown/unsupported device class.
Definition: libwacom.h:174
@ WCLASS_INTUOS2
Any Intuos2 series.
Definition: libwacom.h:183
@ WCLASS_GRAPHIRE
Any Graphire device.
Definition: libwacom.h:180
@ WCLASS_INTUOS5
Any Intuos5 series.
Definition: libwacom.h:177
@ WCLASS_INTUOS
Any Intuos series.
Definition: libwacom.h:182
@ WCLASS_PEN_DISPLAYS
Any "interactive pen display".
Definition: libwacom.h:184
@ WCLASS_ISDV4
Any serial ISDV4 device.
Definition: libwacom.h:181
@ WCLASS_INTUOS4
Any Intuos4 series.
Definition: libwacom.h:176
@ WCLASS_BAMBOO
Any Bamboo device.
Definition: libwacom.h:179
@ WBUSTYPE_I2C
I2C tablet.
Definition: libwacom.h:151
@ WBUSTYPE_USB
USB tablet.
Definition: libwacom.h:148
@ WBUSTYPE_UNKNOWN
Unknown/unsupported bus type.
Definition: libwacom.h:147
@ WBUSTYPE_SERIAL
Serial tablet.
Definition: libwacom.h:149
@ WBUSTYPE_BLUETOOTH
Bluetooth tablet.
Definition: libwacom.h:150
@ WFALLBACK_GENERIC
Definition: libwacom.h:264
@ WFALLBACK_NONE
Definition: libwacom.h:263
const int * libwacom_stylus_get_paired_ids(const WacomStylus *stylus, int *num_paired_ids)
WacomStylusType libwacom_stylus_get_type(const WacomStylus *stylus)
int libwacom_stylus_has_wheel(const WacomStylus *stylus)
WacomAxisTypeFlags libwacom_stylus_get_axes(const WacomStylus *stylus)
int libwacom_stylus_has_lens(const WacomStylus *stylus)
int libwacom_stylus_get_id(const WacomStylus *stylus)
const char * libwacom_stylus_get_name(const WacomStylus *stylus)
WacomEraserType
Type of eraser on a stylus.
Definition: libwacom.h:211
WacomStylusType
Class of stylus.
Definition: libwacom.h:193
WacomEraserType libwacom_stylus_get_eraser_type(const WacomStylus *stylus)
void libwacom_print_stylus_description(int fd, const WacomStylus *stylus)
Print the description of this stylus to the given file.
int libwacom_stylus_has_eraser(const WacomStylus *stylus)
Check if the given stylus is paired with a separate eraser.
const int * libwacom_get_supported_styli(const WacomDevice *device, int *num_styli)
const WacomStylus * libwacom_stylus_get_for_id(const WacomDeviceDatabase *db, int id)
Get the WacomStylus for the given tool ID.
int libwacom_stylus_get_num_buttons(const WacomStylus *stylus)
struct _WacomStylus WacomStylus
Definition: libwacom.h:105
int libwacom_stylus_is_eraser(const WacomStylus *stylus)
Check if the given stylus may act like an eraser.
WacomAxisTypeFlags
Axis type for a stylus.
Definition: libwacom.h:245
@ WACOM_ERASER_UNKNOWN
Definition: libwacom.h:212
@ WACOM_ERASER_NONE
No eraser is present on the stylus.
Definition: libwacom.h:213
@ WACOM_ERASER_BUTTON
Eraser is a button alongside any other stylus buttons.
Definition: libwacom.h:215
@ WACOM_ERASER_INVERT
Eraser is a separate tool on the opposite end of the stylus.
Definition: libwacom.h:214
@ WSTYLUS_MARKER
Definition: libwacom.h:199
@ WSTYLUS_AIRBRUSH
Definition: libwacom.h:197
@ WSTYLUS_3D
Definition: libwacom.h:202
@ WSTYLUS_MOBILE
Definition: libwacom.h:203
@ WSTYLUS_CLASSIC
Definition: libwacom.h:198
@ WSTYLUS_INKING
Definition: libwacom.h:196
@ WSTYLUS_GENERAL
Definition: libwacom.h:195
@ WSTYLUS_STROKE
Definition: libwacom.h:200
@ WSTYLUS_PUCK
Definition: libwacom.h:201
@ WSTYLUS_UNKNOWN
Definition: libwacom.h:194
@ WACOM_AXIS_TYPE_NONE
Definition: libwacom.h:246
@ WACOM_AXIS_TYPE_ROTATION_Z
Rotation in the z-axis.
Definition: libwacom.h:250
@ WACOM_AXIS_TYPE_PRESSURE
Tip pressure.
Definition: libwacom.h:254
@ WACOM_AXIS_TYPE_SLIDER
A absolute-position slider like the wheel on the airbrush.
Definition: libwacom.h:256
@ WACOM_AXIS_TYPE_TILT
Tilt in x and y direction.
Definition: libwacom.h:248
@ WACOM_AXIS_TYPE_DISTANCE
Distance to surface.
Definition: libwacom.h:252
#define LIBWACOM_DEPRECATED
Definition: libwacom.h:39