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
|
/*
* 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
#ifndef _LIBWACOMINT_H_
#define _LIBWACOMINT_H_
#include "libwacom.h"
#include <stdint.h>
#include <glib.h>
#define LIBWACOM_EXPORT __attribute__ ((visibility("default")))
#define DBG(...) \
printf(__VA_ARGS__)
#define GENERIC_DEVICE_MATCH "generic"
#define WACOM_DEVICE_INTEGRATED_UNSET (WACOM_DEVICE_INTEGRATED_NONE - 1U)
enum WacomFeature {
FEATURE_STYLUS = (1 << 0),
FEATURE_TOUCH = (1 << 1),
FEATURE_RING = (1 << 2),
FEATURE_RING2 = (1 << 3),
FEATURE_REVERSIBLE = (1 << 4),
FEATURE_TOUCHSWITCH = (1 << 5)
};
/* WARNING: When adding new members to this struct
* make sure to update libwacom_copy_match() ! */
struct _WacomMatch {
gint refcnt;
char *match;
char *name;
WacomBusType bus;
uint32_t vendor_id;
uint32_t product_id;
};
/* WARNING: When adding new members to this struct
* make sure to update libwacom_copy() and
* libwacom_print_device_description() ! */
struct _WacomDevice {
char *name;
char *model_name;
int width;
int height;
int match; /* used match or first match by default */
WacomMatch **matches; /* NULL-terminated */
int nmatches; /* not counting NULL-terminated element */
WacomMatch *paired;
WacomClass cls;
int num_strips;
uint32_t features;
uint32_t integration_flags;
int strips_num_modes;
int ring_num_modes;
int ring2_num_modes;
gsize num_styli;
int *supported_styli;
int num_buttons;
WacomButtonFlags *buttons;
int *button_codes;
int num_leds;
WacomStatusLEDs *status_leds;
char *layout;
gint refcnt; /* for the db hashtable */
};
struct _WacomStylus {
gint refcnt;
int id;
char *name;
char *group;
int num_buttons;
gboolean has_eraser;
int num_ids;
int *paired_ids;
WacomEraserType eraser_type;
gboolean has_lens;
gboolean has_wheel;
WacomStylusType type;
WacomAxisTypeFlags axes;
};
struct _WacomDeviceDatabase {
GHashTable *device_ht; /* key = DeviceMatch (str), value = WacomDeviceData * */
GHashTable *stylus_ht; /* key = ID (int), value = WacomStylus * */
};
struct _WacomError {
enum WacomErrorCode code;
char *msg;
};
WacomDevice* libwacom_ref(WacomDevice *device);
WacomDevice* libwacom_unref(WacomDevice *device);
WacomStylus* libwacom_stylus_ref(WacomStylus *stylus);
WacomStylus* libwacom_stylus_unref(WacomStylus *stylus);
WacomMatch* libwacom_match_ref(WacomMatch *match);
WacomMatch* libwacom_match_unref(WacomMatch *match);
void libwacom_error_set(WacomError *error, enum WacomErrorCode code, const char *msg, ...);
void libwacom_add_match(WacomDevice *device, WacomMatch *newmatch);
WacomMatch* libwacom_match_new(const char *name, WacomBusType bus,
int vendor_id, int product_id);
WacomBusType bus_from_str (const char *str);
const char *bus_to_str (WacomBusType bus);
char *make_match_string(const char *name, WacomBusType bus, int vendor_id, int product_id);
#define streq(s1, s2) (strcmp((s1), (s2)) == 0)
#define strneq(s1, s2, n) (strncmp((s1), (s2), (n)) == 0)
#endif /* _LIBWACOMINT_H_ */
/* vim: set noexpandtab shiftwidth=8: */
|