libwacom
Wacom model identification library
Loading...
Searching...
No Matches
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
28#ifndef _LIBWACOM_H_
29#define _LIBWACOM_H_
32#include <stdint.h>
33#include <stdio.h>
34
35#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
36#define LIBWACOM_DEPRECATED __attribute__((deprecated))
37#else
38#define LIBWACOM_DEPRECATED
39#endif /* __GNUC__ */
40
94typedef struct _WacomDevice WacomDevice;
95
99typedef struct _WacomBuilder WacomBuilder;
100
104typedef struct _WacomMatch WacomMatch;
105
109typedef struct _WacomStylus WacomStylus;
110
114typedef struct _WacomError WacomError;
115
119typedef struct _WacomDeviceDatabase WacomDeviceDatabase;
120
124#define WACOM_STYLUS_FALLBACK_ID 0xfffff
128#define WACOM_ERASER_FALLBACK_ID 0xffffe
129
144
157
184
207
225
239
273
292
297
301typedef enum {
303 WCOMPARE_MATCHES = (1 << 1),
305
318
319typedef enum {
335typedef enum {
341 /* further modes are numerical only */
343
354
364void
366
374
380const char *
382
393
412
420void
422
453 const WacomBuilder *builder,
454 WacomFallbackFlags fallback,
455 WacomError *error);
456
473 const char *path,
474 WacomFallbackFlags fallback,
475 WacomError *error);
476
496 int vendor_id,
497 int product_id,
498 WacomError *error);
499
515 const char *name,
516 WacomError *error);
517
533 WacomError *error);
534
543void
545 const WacomDevice *device);
546
554void
556
568int
570 const WacomDevice *b,
571 WacomCompareFlags flags);
572
585
592const char *
594
602const char *
604
612const char *
614
625int
627
635const char *
637
645const WacomMatch **
647
664const WacomMatch *
666
677int
679
690int
692
703int
705
712int
714
721int
723
732int
734
743int
745
755const int *
757 int *num_styli);
758
772const WacomStylus **
774 int *num_styli);
775
783int
785
793int
795
804int
806
813int
815
822int
824
831int
833
841int
843
850int
852
860int
862
869int
871
878int
880
888const WacomStatusLEDs *
890 int *num_leds);
891
900int
902 char button);
903
912int
914
922int
924
933
942
952 char button);
953
962int
964 char button);
965
983 char button);
984
999const WacomStylus *
1001 int id);
1002
1009int
1011
1019int
1021
1028const char *
1030
1044const int *
1046 int *num_paired_ids);
1047
1060const WacomStylus **
1062 int *num_paired);
1063
1070int
1072
1087int
1089
1105int
1107
1114int
1116
1123int
1125
1134
1143
1152
1161void
1163 const WacomStylus *stylus);
1164
1167const char *
1169const char *
1173uint32_t
1175uint32_t
1177const char *
1187void
1189
1193void
1195 WacomBusType bustype);
1196
1201void
1203 int vendor_id,
1204 int product_id);
1205
1213void
1215 const char *name);
1216
1223void
1225 const char *name);
1226
1230void
1232 const char *uniq);
1233
1235#endif /* _LIBWACOM_H_ */
1238/* 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 datadir giv...
void libwacom_error_free(WacomError **error)
Free the error and associated memory.
struct _WacomDeviceDatabase WacomDeviceDatabase
Definition libwacom.h:119
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:135
struct _WacomError WacomError
Definition libwacom.h:114
void libwacom_database_destroy(WacomDeviceDatabase *db)
Free all memory used by the database.
@ WERROR_NONE
No error has occured.
Definition libwacom.h:136
@ WERROR_BAD_ALLOC
Allocation error.
Definition libwacom.h:137
@ WERROR_UNKNOWN_MODEL
Unsupported/unknown device.
Definition libwacom.h:141
@ WERROR_INVALID_DB
The passed DB is invalid.
Definition libwacom.h:139
@ WERROR_BUG_CALLER
A bug in the caller.
Definition libwacom.h:142
@ WERROR_BAD_ACCESS
Invalid permissions to access the path.
Definition libwacom.h:140
@ WERROR_INVALID_PATH
A path specified is invalid.
Definition libwacom.h:138
int libwacom_get_dial2_num_modes(const WacomDevice *device)
int libwacom_has_ring2(const WacomDevice *device) LIBWACOM_DEPRECATED
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:309
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_get_num_dials(const WacomDevice *device)
int libwacom_has_touch(const WacomDevice *device)
int libwacom_has_ring(const WacomDevice *device) LIBWACOM_DEPRECATED
const WacomMatch * libwacom_get_paired_device(const WacomDevice *device)
Return the match string of the paired device for this device.
WacomDevice * libwacom_new_from_builder(const WacomDeviceDatabase *db, const WacomBuilder *builder, WacomFallbackFlags fallback, WacomError *error)
Create a new device reference for the given builder.
struct _WacomBuilder WacomBuilder
Definition libwacom.h:99
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:245
int libwacom_get_dial_num_modes(const WacomDevice *device)
int libwacom_is_builtin(const WacomDevice *device) LIBWACOM_DEPRECATED
WacomIntegrationFlags libwacom_get_integration_flags(const WacomDevice *device)
WacomIntegrationFlags
Tablet integration.
Definition libwacom.h:163
const char * libwacom_match_get_uniq(const WacomMatch *match)
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)
WacomModeSwitch
Defines the mode a button with WACOM_BUTTON_RING_MODESWITCH, WACOM_BUTTON_RING2_MODESWITCH,...
Definition libwacom.h:335
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:301
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)
WacomModeSwitch libwacom_get_button_modeswitch_mode(const WacomDevice *device, char button)
WacomClass
Classes of devices.
Definition libwacom.h:193
WacomBusType
Bus types for tablets.
Definition libwacom.h:150
WacomFallbackFlags
Definition libwacom.h:296
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_num_keys(const WacomDevice *device)
Tablet keys indices are numbered from zero.
int libwacom_get_ring2_num_modes(const WacomDevice *device)
int libwacom_has_touchswitch(const WacomDevice *device)
struct _WacomMatch WacomMatch
Definition libwacom.h:104
struct _WacomDevice WacomDevice
Definition libwacom.h:94
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.
const WacomStatusLEDs * libwacom_get_status_leds(const WacomDevice *device, int *num_leds)
int libwacom_get_num_rings(const WacomDevice *device)
@ WACOM_STATUS_LED_TOUCHSTRIP2
Definition libwacom.h:314
@ WACOM_STATUS_LED_UNAVAILABLE
Definition libwacom.h:310
@ WACOM_STATUS_LED_RING
Definition libwacom.h:311
@ WACOM_STATUS_LED_DIAL
Definition libwacom.h:315
@ WACOM_STATUS_LED_RING2
Definition libwacom.h:312
@ WACOM_STATUS_LED_TOUCHSTRIP
Definition libwacom.h:313
@ WACOM_STATUS_LED_DIAL2
Definition libwacom.h:316
@ WACOM_BUTTON_POSITION_BOTTOM
Definition libwacom.h:250
@ WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH
Definition libwacom.h:268
@ WACOM_BUTTON_NONE
Definition libwacom.h:246
@ WACOM_BUTTON_RINGS_MODESWITCH
Definition libwacom.h:266
@ WACOM_BUTTON_DIRECTION
Definition libwacom.h:263
@ WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH
Definition libwacom.h:254
@ WACOM_BUTTON_POSITION_TOP
Definition libwacom.h:249
@ WACOM_BUTTON_RING2_MODESWITCH
Definition libwacom.h:252
@ WACOM_BUTTON_DIALS_MODESWITCH
Definition libwacom.h:270
@ WACOM_BUTTON_POSITION_LEFT
Definition libwacom.h:247
@ WACOM_BUTTON_POSITION_RIGHT
Definition libwacom.h:248
@ WACOM_BUTTON_MODESWITCH
Definition libwacom.h:258
@ WACOM_BUTTON_DIAL2_MODESWITCH
Definition libwacom.h:257
@ WACOM_BUTTON_OLED
Definition libwacom.h:255
@ WACOM_BUTTON_TOUCHSTRIP_MODESWITCH
Definition libwacom.h:253
@ WACOM_BUTTON_RING_MODESWITCH
Definition libwacom.h:251
@ WACOM_BUTTON_DIAL_MODESWITCH
Definition libwacom.h:256
@ WACOM_DEVICE_INTEGRATED_REMOTE
The device is an external pad like the Wacom ExpressKey Remote.
Definition libwacom.h:182
@ WACOM_DEVICE_INTEGRATED_DISPLAY
The device is integrated into a display like the Wacom Cintiq series.
Definition libwacom.h:169
@ WACOM_DEVICE_INTEGRATED_NONE
Definition libwacom.h:164
@ WACOM_DEVICE_INTEGRATED_SYSTEM
This flag is almost always used together with WACOM_DEVICE_INTEGRATED_DISPLAY and indicates that the ...
Definition libwacom.h:177
@ WACOM_MODE_SWITCH_NEXT
Definition libwacom.h:336
@ WACOM_MODE_SWITCH_1
Definition libwacom.h:338
@ WACOM_MODE_SWITCH_2
Definition libwacom.h:339
@ WACOM_MODE_SWITCH_0
Definition libwacom.h:337
@ WACOM_MODE_SWITCH_3
Definition libwacom.h:340
@ WCOMPARE_NORMAL
compare the device only
Definition libwacom.h:302
@ WCOMPARE_MATCHES
compare all possible matches too
Definition libwacom.h:303
@ WCLASS_INTUOS3
Any Intuos3 series.
Definition libwacom.h:195
@ WCLASS_REMOTE
Any Wacom Remote.
Definition libwacom.h:205
@ WCLASS_CINTIQ
Any Cintiq device.
Definition libwacom.h:198
@ WCLASS_UNKNOWN
Unknown/unsupported device class.
Definition libwacom.h:194
@ WCLASS_INTUOS2
Any Intuos2 series.
Definition libwacom.h:203
@ WCLASS_GRAPHIRE
Any Graphire device.
Definition libwacom.h:200
@ WCLASS_INTUOS5
Any Intuos5 series.
Definition libwacom.h:197
@ WCLASS_INTUOS
Any Intuos series.
Definition libwacom.h:202
@ WCLASS_PEN_DISPLAYS
Any "interactive pen display".
Definition libwacom.h:204
@ WCLASS_ISDV4
Any serial ISDV4 device.
Definition libwacom.h:201
@ WCLASS_INTUOS4
Any Intuos4 series.
Definition libwacom.h:196
@ WCLASS_BAMBOO
Any Bamboo device.
Definition libwacom.h:199
@ WBUSTYPE_I2C
I2C tablet.
Definition libwacom.h:155
@ WBUSTYPE_USB
USB tablet.
Definition libwacom.h:152
@ WBUSTYPE_UNKNOWN
Unknown/unsupported bus type.
Definition libwacom.h:151
@ WBUSTYPE_SERIAL
Serial tablet.
Definition libwacom.h:153
@ WBUSTYPE_BLUETOOTH
Bluetooth tablet.
Definition libwacom.h:154
@ WFALLBACK_GENERIC
Definition libwacom.h:296
@ WFALLBACK_NONE
Definition libwacom.h:296
WacomStylusType libwacom_stylus_get_type(const WacomStylus *stylus)
const WacomStylus ** libwacom_get_styli(const WacomDevice *device, int *num_styli)
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)
LIBWACOM_DEPRECATED const int * libwacom_get_supported_styli(const WacomDevice *device, int *num_styli)
const char * libwacom_stylus_get_name(const WacomStylus *stylus)
WacomEraserType
Type of eraser on a stylus.
Definition libwacom.h:231
WacomStylusType
Class of stylus.
Definition libwacom.h:213
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.
LIBWACOM_DEPRECATED const WacomStylus * libwacom_stylus_get_for_id(const WacomDeviceDatabase *db, int id)
Get the WacomStylus for the given tool ID.
const WacomStylus ** libwacom_stylus_get_paired_styli(const WacomStylus *stylus, int *num_paired)
int libwacom_stylus_has_eraser(const WacomStylus *stylus)
Check if the given stylus is paired with a separate eraser.
int libwacom_stylus_get_vendor_id(const WacomStylus *stylus)
int libwacom_stylus_get_num_buttons(const WacomStylus *stylus)
LIBWACOM_DEPRECATED const int * libwacom_stylus_get_paired_ids(const WacomStylus *stylus, int *num_paired_ids)
struct _WacomStylus WacomStylus
Definition libwacom.h:109
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:279
@ WACOM_ERASER_UNKNOWN
Definition libwacom.h:232
@ WACOM_ERASER_NONE
No eraser is present on the stylus.
Definition libwacom.h:233
@ WACOM_ERASER_BUTTON
Eraser is a button alongside any other stylus buttons.
Definition libwacom.h:236
@ WACOM_ERASER_INVERT
Eraser is a separate tool on the opposite end of the stylus.
Definition libwacom.h:234
@ WSTYLUS_MARKER
Definition libwacom.h:219
@ WSTYLUS_AIRBRUSH
Definition libwacom.h:217
@ WSTYLUS_3D
Definition libwacom.h:222
@ WSTYLUS_MOBILE
Definition libwacom.h:223
@ WSTYLUS_CLASSIC
Definition libwacom.h:218
@ WSTYLUS_INKING
Definition libwacom.h:216
@ WSTYLUS_GENERAL
Definition libwacom.h:215
@ WSTYLUS_STROKE
Definition libwacom.h:220
@ WSTYLUS_PUCK
Definition libwacom.h:221
@ WSTYLUS_UNKNOWN
Definition libwacom.h:214
@ WACOM_AXIS_TYPE_NONE
Definition libwacom.h:280
@ WACOM_AXIS_TYPE_ROTATION_Z
Rotation in the z-axis.
Definition libwacom.h:284
@ WACOM_AXIS_TYPE_PRESSURE
Tip pressure.
Definition libwacom.h:288
@ WACOM_AXIS_TYPE_SLIDER
A absolute-position slider like the wheel on the airbrush.
Definition libwacom.h:290
@ WACOM_AXIS_TYPE_TILT
Tilt in x and y direction.
Definition libwacom.h:282
@ WACOM_AXIS_TYPE_DISTANCE
Distance to surface.
Definition libwacom.h:286
void libwacom_builder_set_uniq(WacomBuilder *builder, const char *uniq)
Change the uniq to the given uniq, overriding the currently set one (if any).
void libwacom_builder_set_usbid(WacomBuilder *builder, int vendor_id, int product_id)
Change the vendor and product id to the given ids, overriding the currently set ones (if any).
void libwacom_builder_set_bustype(WacomBuilder *builder, WacomBusType bustype)
Change the bustype to the given bustype, overriding the currently set one (if any).
void libwacom_builder_set_match_name(WacomBuilder *builder, const char *name)
Change the match name to the given name, overriding the currently set one (if any).
void libwacom_builder_destroy(WacomBuilder *builder)
void libwacom_builder_set_device_name(WacomBuilder *builder, const char *name)
Change the device name to the given name, overriding the currently set one (if any).
AliasStatus
Definition libwacom.h:319
@ IGNORE_ALIASES
Definition libwacom.h:320
@ ONLY_ALIASES
Definition libwacom.h:321
WacomBuilder * libwacom_builder_new(void)
Create a new builder to be used into libwacom_new_from_builder().
#define LIBWACOM_DEPRECATED
Definition libwacom.h:38