rpms/libfprint/F-12 0001-Add-udev-rules-to-set-devices-to-autosuspend.patch, NONE, 1.1

Bastien Nocera hadess at fedoraproject.org
Thu Oct 1 14:17:43 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/libfprint/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14114

Added Files:
	0001-Add-udev-rules-to-set-devices-to-autosuspend.patch 
Log Message:
* Thu Oct 01 2009 Bastien Nocera <bnocera at redhat.com> 0.1.0-12.pre2
- Update udev autosuspend rules and disable SGS Thomson reader


0001-Add-udev-rules-to-set-devices-to-autosuspend.patch:
 Makefile.am              |   13 ++++++--
 fprint-list-udev-rules.c |   74 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 84 insertions(+), 3 deletions(-)

--- NEW FILE 0001-Add-udev-rules-to-set-devices-to-autosuspend.patch ---
>From c60d18b9e5e7d62c27d29d4f386a296edc3c491d Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg at redhat.com>
Date: Thu, 1 Oct 2009 15:08:41 +0100
Subject: [PATCH] Add udev rules to set devices to autosuspend

Most fingerprint readers can be suspended safely, so use
the udev rules to autosuspend them when they appear.

The script itself contains whitelists and blacklists.
---
 libfprint/Makefile.am              |   13 +++++-
 libfprint/fprint-list-udev-rules.c |   73 ++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 libfprint/fprint-list-udev-rules.c

diff --git a/libfprint/Makefile.am b/libfprint/Makefile.am
index 0eb5ca6..7f05468 100644
--- a/libfprint/Makefile.am
+++ b/libfprint/Makefile.am
@@ -1,6 +1,6 @@
 lib_LTLIBRARIES = libfprint.la
-noinst_PROGRAMS = fprint-list-hal-info
-MOSTLYCLEANFILES = $(hal_fdi_DATA)
+noinst_PROGRAMS = fprint-list-hal-info fprint-list-udev-rules
+MOSTLYCLEANFILES = $(hal_fdi_DATA) $(udev_rules_DATA)
 
 UPEKTS_SRC = drivers/upekts.c
 UPEKTC_SRC = drivers/upektc.c
@@ -66,6 +66,15 @@ hal_fdidir = $(datadir)/hal/fdi/information/20thirdparty/
 $(hal_fdi_DATA): fprint-list-hal-info
 	$(builddir)/fprint-list-hal-info > $@
 
+fprint_list_udev_rules_SOURCES = fprint-list-udev-rules.c
+fprint_list_udev_rules_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
+fprint_list_udev_rules_LDADD = $(builddir)/libfprint.la
+
+udev_rules_DATA = 60-fprint-autosuspend.rules
+udev_rulesdir = $(sysconfdir)/udev/rules.d/
+
+$(udev_rules_DATA): fprint-list-udev-rules
+	$(builddir)/fprint-list-udev-rules > $@
 
 if ENABLE_UPEKTS
 DRIVER_SRC += $(UPEKTS_SRC)
diff --git a/libfprint/fprint-list-udev-rules.c b/libfprint/fprint-list-udev-rules.c
new file mode 100644
index 0000000..874e41a
--- /dev/null
+++ b/libfprint/fprint-list-udev-rules.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2009 Red Hat <mjg at redhat.com> 
+ * Copyright (C) 2008 Bastien Nocera <hadess at hadess.net>
+ * Copyright (C) 2008 Timo Hoenig <thoenig at suse.de>, <thoenig at nouse.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+#include <stdio.h>
+
+#include "fp_internal.h"
+
+static const struct usb_id whitelist_id_table[] = {
+    { .vendor = 0x08ff, .product = 0x2810 },
+    { 0, 0, 0, },
+};
+
+static const struct usb_id blacklist_id_table[] = {
+    { .vendor = 0x0483, .product = 0x2016 },
+    { 0, 0, 0 },
+};
+
+struct fp_driver whitelist = {
+    .id_table = whitelist_id_table,
+};
+
+static void print_driver (struct fp_driver *driver)
+{
+    int i, j, blacklist;
+
+    for (i = 0; driver->id_table[i].vendor != 0; i++) {
+	blacklist = 0;
+	for (j = 0; blacklist_id_table[j].vendor != 0; j++) {
+	    if (driver->id_table[i].vendor == blacklist_id_table[j].vendor &&
+		driver->id_table[j].product == blacklist_id_table[j].product) {
+		blacklist = 1;
+	    }
+	}
+	if (blacklist)
+	    continue;
+
+	printf ("SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ATTR{power/level}=\"auto\"\n", driver->id_table[i].vendor, driver->id_table[i].product);
+    }
+}
+
+int main (int argc, char **argv)
+{
+    struct fp_driver **list;
+    guint i;
+
+    list = fprint_get_drivers ();
+
+    for (i = 0; list[i] != NULL; i++) {
+	print_driver (list[i]);
+    }
+
+    print_driver (&whitelist);
+
+    return 0;
+}
-- 
1.6.4.4





More information about the scm-commits mailing list