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
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 _WacomBuilder WacomBuilder;
101
105typedef struct _WacomMatch WacomMatch;
106
110typedef struct _WacomStylus WacomStylus;
111
115typedef struct _WacomError WacomError;
116
120typedef struct _WacomDeviceDatabase WacomDeviceDatabase;
121
125#define WACOM_STYLUS_FALLBACK_ID 0xfffff
129#define WACOM_ERASER_FALLBACK_ID 0xffffe
130
145
158
185
208
226
238
263
282
290
294typedef enum {
296 WCOMPARE_MATCHES = (1 << 1),
298
311
321
332
339
346
356
374
383
413
429
447WacomDevice* libwacom_new_from_usbid(const WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error);
448
463
478
488
489
498
511
523
530const char* libwacom_get_name(const WacomDevice *device);
531
538const char* libwacom_get_model_name(const WacomDevice *device);
539
547const char* libwacom_get_layout_filename(const WacomDevice *device);
548
560
568const char* libwacom_get_match(const WacomDevice *device);
569
578
596
608
620
632
640
648
658
668
678const int *libwacom_get_supported_styli(const WacomDevice *device, int *num_styli);
679
693const WacomStylus ** libwacom_get_styli(const WacomDevice *device, int *num_styli);
694
703
712
722
730
738
746
755
763
772
780
788
796const WacomStatusLEDs *libwacom_get_status_leds(const WacomDevice *device, int *num_leds);
797
807 char button);
808
818
827
835
843
852 char button);
853
863 char button);
864
880
888
897
904const char *libwacom_stylus_get_name (const WacomStylus *stylus);
905
919const int *libwacom_stylus_get_paired_ids(const WacomStylus *stylus, int *num_paired_ids);
920
933const WacomStylus **libwacom_stylus_get_paired_styli(const WacomStylus *stylus, int *num_paired);
934
942
958
975
983
991
999
1007
1015
1025
1028const char *libwacom_match_get_name(const WacomMatch *match);
1029const char *libwacom_match_get_uniq(const WacomMatch *match);
1043
1048
1052void libwacom_builder_set_usbid(WacomBuilder *builder, int vendor_id, int product_id);
1053
1061void libwacom_builder_set_device_name(WacomBuilder *builder, const char *name);
1062
1069void libwacom_builder_set_match_name(WacomBuilder *builder, const char *name);
1070
1074void libwacom_builder_set_uniq(WacomBuilder *builder, const char *uniq);
1075
1076
1078#endif /* _LIBWACOM_H_ */
1081/* 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:120
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:136
struct _WacomError WacomError
Definition libwacom.h:115
void libwacom_database_destroy(WacomDeviceDatabase *db)
Free all memory used by the database.
@ WERROR_NONE
No error has occured.
Definition libwacom.h:137
@ WERROR_BAD_ALLOC
Allocation error.
Definition libwacom.h:138
@ WERROR_UNKNOWN_MODEL
Unsupported/unknown device.
Definition libwacom.h:142
@ WERROR_INVALID_DB
The passed DB is invalid.
Definition libwacom.h:140
@ WERROR_BUG_CALLER
A bug in the caller.
Definition libwacom.h:143
@ WERROR_BAD_ACCESS
Invalid permissions to access the path.
Definition libwacom.h:141
@ WERROR_INVALID_PATH
A path specified is invalid.
Definition libwacom.h:139
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:302
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:100
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:244
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:164
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)
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:294
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:194
WacomBusType
Bus types for tablets.
Definition libwacom.h:151
WacomFallbackFlags
Definition libwacom.h:286
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:105
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.
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:307
@ WACOM_STATUS_LED_UNAVAILABLE
Definition libwacom.h:303
@ WACOM_STATUS_LED_RING
Definition libwacom.h:304
@ WACOM_STATUS_LED_DIAL
Definition libwacom.h:308
@ WACOM_STATUS_LED_RING2
Definition libwacom.h:305
@ WACOM_STATUS_LED_TOUCHSTRIP
Definition libwacom.h:306
@ WACOM_STATUS_LED_DIAL2
Definition libwacom.h:309
@ WACOM_BUTTON_POSITION_BOTTOM
Definition libwacom.h:249
@ WACOM_BUTTON_TOUCHSTRIPS_MODESWITCH
Definition libwacom.h:260
@ WACOM_BUTTON_NONE
Definition libwacom.h:245
@ WACOM_BUTTON_RINGS_MODESWITCH
Definition libwacom.h:259
@ WACOM_BUTTON_DIRECTION
Definition libwacom.h:258
@ WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH
Definition libwacom.h:253
@ WACOM_BUTTON_POSITION_TOP
Definition libwacom.h:248
@ WACOM_BUTTON_RING2_MODESWITCH
Definition libwacom.h:251
@ WACOM_BUTTON_DIALS_MODESWITCH
Definition libwacom.h:261
@ WACOM_BUTTON_POSITION_LEFT
Definition libwacom.h:246
@ WACOM_BUTTON_POSITION_RIGHT
Definition libwacom.h:247
@ WACOM_BUTTON_MODESWITCH
Definition libwacom.h:257
@ WACOM_BUTTON_DIAL2_MODESWITCH
Definition libwacom.h:256
@ WACOM_BUTTON_OLED
Definition libwacom.h:254
@ WACOM_BUTTON_TOUCHSTRIP_MODESWITCH
Definition libwacom.h:252
@ WACOM_BUTTON_RING_MODESWITCH
Definition libwacom.h:250
@ WACOM_BUTTON_DIAL_MODESWITCH
Definition libwacom.h:255
@ WACOM_DEVICE_INTEGRATED_REMOTE
The device is an external pad like the Wacom ExpressKey Remote.
Definition libwacom.h:183
@ WACOM_DEVICE_INTEGRATED_DISPLAY
The device is integrated into a display like the Wacom Cintiq series.
Definition libwacom.h:170
@ WACOM_DEVICE_INTEGRATED_NONE
Definition libwacom.h:165
@ WACOM_DEVICE_INTEGRATED_SYSTEM
This flag is almost always used together with WACOM_DEVICE_INTEGRATED_DISPLAY and indicates that the ...
Definition libwacom.h:178
@ WCOMPARE_NORMAL
compare the device only
Definition libwacom.h:295
@ WCOMPARE_MATCHES
compare all possible matches too
Definition libwacom.h:296
@ WCLASS_INTUOS3
Any Intuos3 series.
Definition libwacom.h:196
@ WCLASS_REMOTE
Any Wacom Remote.
Definition libwacom.h:206
@ WCLASS_CINTIQ
Any Cintiq device.
Definition libwacom.h:199
@ WCLASS_UNKNOWN
Unknown/unsupported device class.
Definition libwacom.h:195
@ WCLASS_INTUOS2
Any Intuos2 series.
Definition libwacom.h:204
@ WCLASS_GRAPHIRE
Any Graphire device.
Definition libwacom.h:201
@ WCLASS_INTUOS5
Any Intuos5 series.
Definition libwacom.h:198
@ WCLASS_INTUOS
Any Intuos series.
Definition libwacom.h:203
@ WCLASS_PEN_DISPLAYS
Any "interactive pen display".
Definition libwacom.h:205
@ WCLASS_ISDV4
Any serial ISDV4 device.
Definition libwacom.h:202
@ WCLASS_INTUOS4
Any Intuos4 series.
Definition libwacom.h:197
@ WCLASS_BAMBOO
Any Bamboo device.
Definition libwacom.h:200
@ WBUSTYPE_I2C
I2C tablet.
Definition libwacom.h:156
@ WBUSTYPE_USB
USB tablet.
Definition libwacom.h:153
@ WBUSTYPE_UNKNOWN
Unknown/unsupported bus type.
Definition libwacom.h:152
@ WBUSTYPE_SERIAL
Serial tablet.
Definition libwacom.h:154
@ WBUSTYPE_BLUETOOTH
Bluetooth tablet.
Definition libwacom.h:155
@ WFALLBACK_GENERIC
Definition libwacom.h:288
@ WFALLBACK_NONE
Definition libwacom.h:287
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:232
WacomStylusType
Class of stylus.
Definition libwacom.h:214
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:110
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:269
@ WACOM_ERASER_UNKNOWN
Definition libwacom.h:233
@ WACOM_ERASER_NONE
No eraser is present on the stylus.
Definition libwacom.h:234
@ 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:235
@ WSTYLUS_MARKER
Definition libwacom.h:220
@ WSTYLUS_AIRBRUSH
Definition libwacom.h:218
@ WSTYLUS_3D
Definition libwacom.h:223
@ WSTYLUS_MOBILE
Definition libwacom.h:224
@ WSTYLUS_CLASSIC
Definition libwacom.h:219
@ WSTYLUS_INKING
Definition libwacom.h:217
@ WSTYLUS_GENERAL
Definition libwacom.h:216
@ WSTYLUS_STROKE
Definition libwacom.h:221
@ WSTYLUS_PUCK
Definition libwacom.h:222
@ WSTYLUS_UNKNOWN
Definition libwacom.h:215
@ WACOM_AXIS_TYPE_NONE
Definition libwacom.h:270
@ WACOM_AXIS_TYPE_ROTATION_Z
Rotation in the z-axis.
Definition libwacom.h:274
@ WACOM_AXIS_TYPE_PRESSURE
Tip pressure.
Definition libwacom.h:278
@ WACOM_AXIS_TYPE_SLIDER
A absolute-position slider like the wheel on the airbrush.
Definition libwacom.h:280
@ WACOM_AXIS_TYPE_TILT
Tilt in x and y direction.
Definition libwacom.h:272
@ WACOM_AXIS_TYPE_DISTANCE
Distance to surface.
Definition libwacom.h:276
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).
WacomBuilder * libwacom_builder_new(void)
Create a new builder to be used into libwacom_new_from_builder().
#define LIBWACOM_DEPRECATED
Definition libwacom.h:39