[libwacom] Mark data subpackage as noarch and make it a requirement for libwacom
Peter Hutterer
whot at fedoraproject.org
Thu Mar 8 23:36:14 UTC 2012
commit f04829b26e29af3d0c627dc16451d3c79c0e670a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Mar 9 08:40:49 2012 +1000
Mark data subpackage as noarch and make it a requirement for libwacom
- Use generated udev rule file to list only known devices from libwacom
database
libwacom-0.3-add-bamboo-one.patch | 27 +++++++
libwacom-0.3-add-list-devices.patch | 64 +++++++++++++++++
libwacom-0.3-add-udev-generator.patch | 127 +++++++++++++++++++++++++++++++++
libwacom.rules | 45 ++++++++++++
libwacom.spec | 31 ++++++++-
5 files changed, 292 insertions(+), 2 deletions(-)
---
diff --git a/libwacom-0.3-add-bamboo-one.patch b/libwacom-0.3-add-bamboo-one.patch
new file mode 100644
index 0000000..2bd792a
--- /dev/null
+++ b/libwacom-0.3-add-bamboo-one.patch
@@ -0,0 +1,27 @@
+commit 952a58a5f0c50c461d079788c9102bf4a09357c3
+Author: Olivier Fourdan <ofourdan at redhat.com>
+Date: Fri Feb 24 11:19:01 2012 +0100
+
+ Add Bamboo One definition
+
+diff --git a/data/bamboo-one.tablet b/data/bamboo-one.tablet
+new file mode 100644
+index 0000000..67f0114
+--- /dev/null
++++ b/data/bamboo-one.tablet
+@@ -0,0 +1,15 @@
++[Device]
++# Bamboo One (CTF-430/SO-B)
++Name=Bamboo One
++DeviceMatch=usb:056a:0069
++Width=5.0
++Height=3.6
++
++[Features]
++Reversible=true
++Stylus=true
++Touch=false
++Ring=false
++NumStrips=0
++Buttons=0
++BuiltIn=false
diff --git a/libwacom-0.3-add-list-devices.patch b/libwacom-0.3-add-list-devices.patch
new file mode 100644
index 0000000..ddea417
--- /dev/null
+++ b/libwacom-0.3-add-list-devices.patch
@@ -0,0 +1,64 @@
+commit 93dc2413517f4c7760e6218143bad6eec59cfd71
+Author: Olivier Fourdan <ofourdan at redhat.com>
+Date: Fri Feb 24 11:56:57 2012 +0100
+
+ lib: Add API to list all items in the database
+
+diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
+index b30cc10..c9f31b6 100644
+--- a/libwacom/libwacom-database.c
++++ b/libwacom/libwacom-database.c
+@@ -466,4 +466,29 @@ libwacom_database_destroy(WacomDeviceDatabase *db)
+ g_free (db);
+ }
+
++WacomDevice**
++libwacom_list_devices_from_database(WacomDeviceDatabase *db, WacomError *error)
++{
++ GList *cur, *devices;
++ WacomDevice **list, **p;
++
++ if (!db) {
++ libwacom_error_set(error, WERROR_INVALID_DB, "db is NULL");
++ return NULL;
++ }
++
++ devices = g_hash_table_get_values (db->device_ht);
++ list = calloc (g_list_length (devices) + 1, sizeof (WacomDevice *));
++ if (!list) {
++ libwacom_error_set(error, WERROR_BAD_ALLOC, "Memory allocation failed");
++ return NULL;
++ }
++
++ for (p = list, cur = devices; cur; cur = g_list_next (cur))
++ *p++ = (WacomDevice *) cur->data;
++ g_list_free (devices);
++
++ return list;
++}
++
+ /* vim: set noexpandtab tabstop=8 shiftwidth=8: */
+diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
+index b1122eb..4f537c4 100644
+--- a/libwacom/libwacom.h
++++ b/libwacom/libwacom.h
+@@ -244,6 +244,19 @@ WacomDevice* libwacom_new_from_usbid(WacomDeviceDatabase *db, int vendor_id, int
+ WacomDevice* libwacom_new_from_name(WacomDeviceDatabase *db, const char *name, WacomError *error);
+
+ /**
++ * Returns the list of devices in the given database.
++ *
++ * @param db A device database
++ * @param error If not NULL, set to the error if any occurs
++ *
++ * @return A NULL terminated list of pointers to all the devices inside the
++ * database.
++ * The content of the list is owned by the database and should not be
++ * modified of freed. Use free() to free the list.
++ */
++WacomDevice** libwacom_list_devices_from_database(WacomDeviceDatabase *db, WacomError *error);
++
++/**
+ * Remove the device and free all memory and references to it.
+ *
+ * @param device The device to delete
diff --git a/libwacom-0.3-add-udev-generator.patch b/libwacom-0.3-add-udev-generator.patch
new file mode 100644
index 0000000..44438f5
--- /dev/null
+++ b/libwacom-0.3-add-udev-generator.patch
@@ -0,0 +1,127 @@
+commit 8f1d640b4e8416c181b3a08b697aaac67ba6005a
+Author: Olivier Fourdan <ofourdan at redhat.com>
+Date: Fri Feb 24 12:05:19 2012 +0100
+
+ data: Add tool to generate udev rules from the DB
+
+diff --git a/data/Makefile.am b/data/Makefile.am
+index 9f2e8d2..c307b6d 100644
+--- a/data/Makefile.am
++++ b/data/Makefile.am
+@@ -4,4 +4,10 @@ dist_libwacomtablet_DATA = $(shell find $(top_srcdir)/data -name "*.tablet" -pr
+ libwacomstylusdir = $(datadir)/libwacom
+ dist_libwacomstylus_DATA = $(shell find $(top_srcdir)/data -name "*.stylus" -printf "%P\n")
+
++INCLUDES=-I$(top_srcdir)/libwacom -DTOPSRCDIR="\"$(top_srcdir)\""
++
++noinst_PROGRAMS = list
++list_SOURCES = list.c
++list_LDADD=$(top_builddir)/libwacom/libwacom.la
++
+ EXTRA_DIST = wacom.example
+diff --git a/data/list.c b/data/list.c
+new file mode 100644
+index 0000000..de3986f
+--- /dev/null
++++ b/data/list.c
+@@ -0,0 +1,100 @@
++/*
++ * Copyright © 2012 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:
++ * Olivier Fourdan (ofourdan at redhat.com)
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <stdio.h>
++#include <string.h>
++#include "libwacom.h"
++
++static void print_udev_header (void)
++{
++ printf ("# udev rules for libwacom supported devices\n");
++ printf ("\n");
++ printf ("ACTION!=\"add|change\", GOTO=\"libwacom_end\"\n");
++ printf ("KERNEL!=\"event[0-9]*\", GOTO=\"libwacom_end\"\n");
++ printf ("\n");
++}
++
++static void print_udev_entry (WacomDevice *device)
++{
++ WacomBusType type = libwacom_get_bustype (device);
++ int vendor = libwacom_get_vendor_id (device);
++ int product = libwacom_get_product_id (device);
++ int has_touch = libwacom_has_touch (device);
++ static char *touchpad;
++
++ if (has_touch)
++ touchpad = ", ID_INPUT_TOUCHPAD=\"1\"";
++ else
++ touchpad = "";
++
++ switch (type) {
++ case WBUSTYPE_USB:
++ 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);
++ break;
++ case WBUSTYPE_BLUETOOTH:
++ 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);
++ break;
++ default:
++ /* Not sure how to deal with serials */
++ break;
++ }
++}
++
++static void print_udev_trailer (void)
++{
++ printf ("\n");
++ printf ("# Match all serial wacom tablets with a serial ID starting with WACf\n");
++ printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"WACf*\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n");
++ printf ("ENV{ID_BUS}==\"tty|pnp\", ATTRS{id}==\"FUJ*\", ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"\n");
++ printf ("\n");
++ printf ("LABEL=\"libwacom_end\"\n");
++}
++
++
++int main(int argc, char **argv)
++{
++ WacomDeviceDatabase *db;
++ WacomDevice **list, **p;
++
++ db = libwacom_database_new_for_path(TOPSRCDIR"/data");
++
++ list = libwacom_list_devices_from_database(db, NULL);
++
++ print_udev_header ();
++ for (p = list; *p; p++)
++ print_udev_entry ((WacomDevice *) *p);
++ print_udev_trailer ();
++
++ libwacom_database_destroy (db);
++
++ return 0;
++}
++
++/* vim: set noexpandtab tabstop=8 shiftwidth=8: */
diff --git a/libwacom.rules b/libwacom.rules
new file mode 100644
index 0000000..114e257
--- /dev/null
+++ b/libwacom.rules
@@ -0,0 +1,45 @@
+# udev rules for libwacom supported devices
+
+ACTION!="add|change", GOTO="libwacom_end"
+KERNEL!="event[0-9]*", GOTO="libwacom_end"
+
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00c6", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00bc", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00bb", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00ba", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0069", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0024", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0022", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0043", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0045", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0044", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0042", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0023", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0041", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0021", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0020", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00c5", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00cc", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b3", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00d1", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ID_INPUT_TOUCHPAD="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0014", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="003f", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="bluetooth", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0081", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0015", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b9", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="0013", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b8", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b7", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00f4", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b5", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b4", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b2", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b1", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="00b0", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="056a", ENV{ID_MODEL_ID}=="003e", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ID_INPUT_TOUCHPAD="1"
+
+# Match all serial wacom tablets with a serial ID starting with WACf
+ENV{ID_BUS}=="tty|pnp", ATTRS{id}=="WACf*", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+ENV{ID_BUS}=="tty|pnp", ATTRS{id}=="FUJ*", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1"
+
+LABEL="libwacom_end"
diff --git a/libwacom.spec b/libwacom.spec
index 26c6f44..16039f4 100644
--- a/libwacom.spec
+++ b/libwacom.spec
@@ -1,13 +1,19 @@
Name: libwacom
Version: 0.3
-Release: 1%{?dist}
+Release: 5%{?dist}
Summary: Tablet Information Client Library
+Requires: %{name}-data
Group: System Environment/Libraries
License: MIT
URL: http://linuxwacom.sourceforge.net
Source0: http://prdownloads.sourceforge.net/linuxwacom/%{name}/%{name}-%{version}.tar.bz2
+Source1: libwacom.rules
+
+Patch01: libwacom-0.3-add-list-devices.patch
+Patch02: libwacom-0.3-add-udev-generator.patch
+Patch03: libwacom-0.3-add-bamboo-one.patch
BuildRequires: autoconf automake libtool doxygen
BuildRequires: glib2-devel libgudev1-devel
@@ -27,6 +33,7 @@ Tablet information client library library development package.
%package data
Summary: Tablet Information Client Library Library Data Files
+BuildArch: noarch
%description data
Tablet information client library library data files.
@@ -34,13 +41,19 @@ Tablet information client library library data files.
%prep
%setup -q -n %{name}-%{version}
+%patch01 -p1
+%patch02 -p1
+%patch03 -p1
+
%build
-autoreconf -v --install || exit 1
+autoreconf --force -v --install || exit 1
%configure --disable-static
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} INSTALL="install -p"
+install -d ${RPM_BUILD_ROOT}/lib/udev/rules.d
+install -p -m 644 %SOURCE1 ${RPM_BUILD_ROOT}/lib/udev/rules.d/65-libwacom.rules
# We intentionally don't ship *.la files
rm -f %{buildroot}%{_libdir}/*.la
@@ -52,6 +65,7 @@ rm -f %{buildroot}%{_libdir}/*.la
%defattr(-,root,root,-)
%doc COPYING README
%{_libdir}/libwacom.so.*
+/lib/udev/rules.d/65-libwacom.rules
%files devel
%defattr(-,root,root,-)
@@ -70,6 +84,19 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_datadir}/libwacom/*.stylus
%changelog
+* Thu Mar 08 2012 Olivier Fourdan <ofourdan at redhat.com> 0.3-5
+- Mark data subpackage as noarch and make it a requirement for libwacom
+- Use generated udev rule file to list only known devices from libwacom
+ database
+
+* Tue Mar 06 2012 Peter Hutterer <peter.hutterer at redhat.com> 0.3-4
+- libwacom-0.3-add-list-devices.patch: add API to list devices
+- libwacom-0.3-add-udev-generator.patch: add a udev rules generater tool
+- libwacom-0.3-add-bamboo-one.patch: add Bamboo One definition
+
+* Tue Feb 21 2012 Olivier Fourdan <ofourdan at redhat.com> - 0.3-2
+- Add udev rules to identify Wacom as tablets for libwacom
+
* Tue Feb 21 2012 Peter Hutterer <peter.hutterer at redhat.com>
- Source file is .bz2, not .xz
More information about the scm-commits
mailing list