2
* Copyright © 2012 Red Hat, Inc.
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
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.
24
* Olivier Fourdan (ofourdan@redhat.com)
35
static void print_udev_header (void)
37
printf ("# udev rules for libwacom supported devices\n");
39
printf ("ACTION!=\"add|change\", GOTO=\"libwacom_end\"\n");
40
printf ("KERNEL!=\"event[0-9]*\", GOTO=\"libwacom_end\"\n");
44
static void print_udev_entry (WacomDevice *device)
46
WacomBusType type = libwacom_get_bustype (device);
47
int vendor = libwacom_get_vendor_id (device);
48
int product = libwacom_get_product_id (device);
49
int has_touch = libwacom_has_touch (device);
50
static char *touchpad;
53
touchpad = ", ENV{ID_INPUT_TOUCHPAD}=\"1\"";
59
printf ("ENV{ID_BUS}==\"usb\", ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad);
61
case WBUSTYPE_BLUETOOTH:
62
printf ("ENV{ID_BUS}==\"bluetooth\", ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad);
65
/* Not sure how to deal with serials */
70
static void print_udev_trailer (void)
73
printf ("# Match all serial wacom tablets with a serial ID starting with WACf\n");
74
printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"WACf*\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n");
75
printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"FUJ*\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n");
77
printf ("LABEL=\"libwacom_end\"\n");
81
int main(int argc, char **argv)
83
WacomDeviceDatabase *db;
84
WacomDevice **list, **p;
86
db = libwacom_database_new_for_path(TOPSRCDIR"/data");
88
list = libwacom_list_devices_from_database(db, NULL);
90
fprintf(stderr, "Failed to load device database.\n");
95
for (p = list; *p; p++)
96
print_udev_entry ((WacomDevice *) *p);
97
print_udev_trailer ();
99
libwacom_database_destroy (db);
104
/* vim: set noexpandtab tabstop=8 shiftwidth=8: */