Author: jsuchome
Date: Fri Sep 26 14:34:22 2008
New Revision: 51583
URL: http://svn.opensuse.org/viewcvs/yast?rev=51583&view=rev
Log:
new agent is based on libfprint (fate#300416)
Added:
trunk/fingerprint-reader/agent-fprint/
trunk/fingerprint-reader/agent-fprint/Makefile.am
trunk/fingerprint-reader/agent-fprint/conf/
trunk/fingerprint-reader/agent-fprint/conf/Makefile.am
trunk/fingerprint-reader/agent-fprint/conf/fprint.scr
trunk/fingerprint-reader/agent-fprint/doc/
trunk/fingerprint-reader/agent-fprint/doc/Makefile.am
trunk/fingerprint-reader/agent-fprint/doc/autodocs/
trunk/fingerprint-reader/agent-fprint/doc/autodocs/Makefile.am
trunk/fingerprint-reader/agent-fprint/src/
trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.cc
trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.h
trunk/fingerprint-reader/agent-fprint/src/Makefile.am
trunk/fingerprint-reader/agent-fprint/src/Y2CCFPrintAgent.cc
trunk/fingerprint-reader/agent-fprint/testsuite/
trunk/fingerprint-reader/agent-fprint/testsuite/Makefile.am
Removed:
trunk/fingerprint-reader/agent-thinkfinger/
Modified:
trunk/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp
trunk/fingerprint-reader/yast2-fingerprint-reader.spec.in
Added: trunk/fingerprint-reader/agent-fprint/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1 @@
+SUBDIRS = conf doc src testsuite
Added: trunk/fingerprint-reader/agent-fprint/conf/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/conf/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/conf/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/conf/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1,7 @@
+#
+# Makefile.am for .../agent-fprint/conf
+#
+
+scrconf_DATA = fprint.scr
+
+EXTRA_DIST = $(scrconf_DATA)
Added: trunk/fingerprint-reader/agent-fprint/conf/fprint.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/conf/fprint.scr?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/conf/fprint.scr (added)
+++ trunk/fingerprint-reader/agent-fprint/conf/fprint.scr Fri Sep 26 14:34:22 2008
@@ -0,0 +1,14 @@
+/**
+ * File: fprint.scr
+ * Summary: FPrint agent
+ * Author: Jiri Suchomel
+ * Access: read / write / execute
+ *
+ * Example: FIXME
+ *
+ */
+.fprint
+
+`ag_fprint(
+ `FPrintAgent()
+)
Added: trunk/fingerprint-reader/agent-fprint/doc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/doc/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/doc/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/doc/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1 @@
+SUBDIRS = autodocs
Added: trunk/fingerprint-reader/agent-fprint/doc/autodocs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/doc/autodocs/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/doc/autodocs/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/doc/autodocs/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1,13 @@
+#
+# Makefile.am for .../agent-fprint/doc/autodocs
+#
+
+htmldir = $(docdir)/autodocs
+
+html_DATA = index.html $(wildcard *.html *.png) doxygen.css @RPMNAME@.tag
+CLEANFILES = $(html_DATA) doxygen.log doxygen.conf installdox
+
+doxygen.css @RPMNAME@.tag: index.html
+
+index.html: $(srcdir)/../../src/*.h
+ @ybindir@/ydoxygen PROJECT_NAME=@RPMNAME@
Added: trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.cc?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.cc (added)
+++ trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.cc Fri Sep 26 14:34:22 2008
@@ -0,0 +1,445 @@
+/* FPrintAgent.cc
+ *
+ * An agent for FPrint library (access to fingerprint reader)
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id$
+ */
+
+#include "FPrintAgent.h"
+
+#define PC(n) (path->component_str(n))
+
+#define INIT_FAILED 500
+#define SET_FILE_FAILED 600
+#define SET_CALLBACK_FAILED 700
+
+
+/**
+ * Constructor
+ */
+FPrintAgent::FPrintAgent() : SCRAgent()
+{
+ child_pid = -1;
+ child_retval = -1;
+}
+
+/**
+ * Destructor
+ */
+FPrintAgent::~FPrintAgent()
+{
+}
+
+// return the only instance of the class
+FPrintAPI& FPrintAPI::instance()
+{
+ static FPrintAPI _instance; // The singleton
+ return _instance;
+}
+
+// handler for SIGTERM signal (it is necessary to kill the process when
+// user his Cancel)
+void FPrintAPI::catch_sigterm (int sig_num)
+{
+ instance().finalize ();
+ exit (256);
+}
+
+// de-initialize finger print reader (must be called at the end!)
+void FPrintAPI::finalize ()
+{
+/*
+ if (instance().tf != NULL)
+ {
+ libfprint_free (instance().tf);
+ instance().tf = NULL;
+ }
+*/
+ y2internal ("finalize");
+ if (instance().data != NULL)
+ {
+ fp_print_data_free (instance().data);
+ instance().data = NULL;
+ }
+ fp_exit();
+ y2internal ("finalized");
+}
+
+FPrintAPI::FPrintAPI()
+{
+ data = NULL;
+}
+
+FPrintAPI::~FPrintAPI ()
+{
+}
+
+/**
+ * wrapper for fp_enroll_finger function;
+ * - we need to take care of the errors and signals
+ * @param file descriptor of the pipe
+ * @param path to the target bir file FIXME
+ */
+int FPrintAPI::acquire (int write_fd, string bir_path)
+{
+y2internal ("FPrintAPI::acquire");
+ signal (15, catch_sigterm);
+
+// FIXME move initialization to separate call, to differentiate betw.ret values
+
+ struct fp_print_data *enrolled_print = NULL;
+ int r;
+
+ struct fp_dscv_dev *ddev;
+ struct fp_dscv_dev **discovered_devs;
+ struct fp_dev *dev;
+
+ r = fp_init();
+ if (r < 0) {
+ y2error("Failed to initialize libfprint\n");
+ r = INIT_FAILED;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+y2internal ("fp_init: %d", r);
+ discovered_devs = fp_discover_devs();
+ if (!discovered_devs) {
+ y2error("Could not discover devices\n");
+ instance().finalize ();
+ r = INIT_FAILED;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+y2internal ("discovered");
+
+ ddev = discovered_devs[0];
+
+
+ if (!ddev) {
+ y2error("No devices detected.\n");
+ instance().finalize ();
+ r = INIT_FAILED;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+
+ struct fp_driver *drv;
+ drv = fp_dscv_dev_get_driver(ddev);
+ y2milestone ("Found device claimed by %s driver",
+ fp_driver_get_full_name(drv));
+
+ dev = fp_dev_open(ddev);
+ fp_dscv_devs_free(discovered_devs);
+ if (!dev) {
+ y2error("Could not open device.\n");
+ }
+
+ y2milestone("Opened device. It's now time to enroll your finger.\n\n");
+
+ y2milestone ("You will need to successfully scan your finger %d times to "
+ "complete the process.\n", fp_dev_get_nr_enroll_stages (dev));
+
+ do {
+ sleep (1);
+ y2internal ("Scan your finger now.");
+
+ r = fp_enroll_finger (dev, &enrolled_print);
+
+ if (r < 0) {
+ y2error ("Enroll failed with error %d", r);
+ break;
+ }
+y2internal ("retvall: %d", r);
+ if (write (write_fd, &r, sizeof (int)) == -1)
+ y2error ("write to pipe failed: %d (%m)", errno);
+
+
+ switch (r) {
+ case FP_ENROLL_COMPLETE:
+ y2milestone("Enroll complete!");
+ break;
+ case FP_ENROLL_FAIL:
+ y2milestone("Enroll failed, something wen't wrong :(");
+// return NULL; FIXME
+ break;
+ case FP_ENROLL_PASS:
+ y2milestone("Enroll stage passed. Yay!");
+ break;
+ case FP_ENROLL_RETRY:
+ y2milestone("Didn't quite catch that. Please try again.");
+ break;
+ case FP_ENROLL_RETRY_TOO_SHORT:
+ y2milestone("Your swipe was too short, please try again.");
+ break;
+ case FP_ENROLL_RETRY_CENTER_FINGER:
+ y2milestone("Didn't catch that, please center your finger on the sensor and try again.");
+ break;
+ case FP_ENROLL_RETRY_REMOVE_FINGER:
+ y2milestone("Scan failed, please remove your finger and then try again.");
+ break;
+ }
+ } while (r != FP_ENROLL_COMPLETE);
+
+ if (!enrolled_print) {
+ y2error ("Enroll complete but no print?\n");
+ }
+ else {
+ data = enrolled_print;
+ y2milestone ("Enrollment completed, exiting with %d", r);
+ // FIXME save enrolled_print now
+ }
+
+ instance().finalize ();
+ signal (15, SIG_DFL);
+ return r;
+}
+
+/**
+ * Dir
+ */
+YCPList FPrintAgent::Dir(const YCPPath& path)
+{
+ y2error("Wrong path '%s' in Dir().", path->toString().c_str());
+ return YCPNull();
+}
+
+/**
+ * Read
+ */
+YCPValue FPrintAgent::Read(const YCPPath &path, const YCPValue& arg, const YCPValue& opt) {
+
+ y2debug ("Path in Read(): %s", path->toString().c_str());
+ YCPValue ret = YCPVoid();
+
+ if (path->length() == 0) {
+ ret = YCPString("0");
+ }
+ else if (path->length() == 1) {
+
+ if (PC(0) == "error") {
+ // return the last error message
+ ret = YCPString ("error_message");
+ }
+ else if (PC(0) == "state") {
+ YCPMap retmap;
+ if (child_pid == -1)
+ {
+ y2error ("FPrint not initialized yet!");
+ return ret;
+ }
+ int state;
+ size_t size = sizeof (int);
+ int retval = read (data_pipe[0], &state, size);
+ if (retval == -1)
+ {
+ if (errno != EINTR && errno != EAGAIN)
+ y2error ("error reading from pipe: %d (%m)", errno);
+ }
+ else if (retval == size) {
+ if (state == INIT_FAILED ||
+ state == SET_FILE_FAILED || state == SET_CALLBACK_FAILED)
+ {
+ y2warning ("some initialization failed (%d)...", state);
+ return ret;
+ }
+ retmap->add (YCPString ("state"), YCPInteger (state));
+ }
+ else if (retval == 0)
+ {
+ // check if child is still alive
+ int status;
+ if (waitpid (-1, &status, WNOHANG) != 0)
+ {
+ if (WIFSIGNALED (status))
+ {
+ y2error ("child process was killed");
+ child_pid = -1;
+ return ret;
+ }
+ if (WIFEXITED (status))
+ {
+ child_retval = WEXITSTATUS (status);
+ child_pid = -1;
+ return ret;
+ }
+ }
+ }
+ return retmap;
+ }
+ // check if child process exited
+ else if (PC(0) == "check_exit" ) {
+ int status;
+ ret = YCPBoolean (false);
+ if (child_pid != -1)
+ {
+ if (waitpid (child_pid, &status, WNOHANG) != 0)
+ {
+ child_pid = -1;
+ ret = YCPBoolean (true);
+ if (WIFSIGNALED (status))
+ {
+ y2error ("child process was killed");
+ }
+ if (WIFEXITED (status))
+ {
+ child_retval = WEXITSTATUS (status);
+ }
+ }
+ }
+ else
+ {
+ y2milestone ("child process already exited");
+ ret = YCPBoolean (true);
+ }
+ }
+ // wait for child exit if it still not exited (do not use this part)
+ // return child exit value
+ else if (PC(0) == "exit_status" ) {
+ int status;
+ int retval = 255;
+ if (child_pid != -1)
+ {
+ wait (&status);
+ if (WIFSIGNALED (status))
+ y2milestone ("child process was killed");
+ else if (WIFEXITED (status))
+ {
+ retval = WEXITSTATUS (status);
+ y2milestone ("retval is %d", retval);
+ }
+ }
+ else
+ {
+ y2milestone ("child process already exited");
+ if (child_retval)
+ retval = child_retval;
+ child_retval = -1;
+ }
+ ret = YCPInteger (retval);
+ close (data_pipe[0]); // close FD for reading
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ return ret;
+}
+
+
+/**
+ * Write - nothing to do
+ */
+YCPBoolean FPrintAgent::Write(const YCPPath &path, const YCPValue& value,
+ const YCPValue& arg)
+{
+ return YCPBoolean(false);
+}
+
+/**
+ * Execute(.fprint.enroll) is action to acquire fingerprint
+ */
+YCPValue FPrintAgent::Execute(const YCPPath &path, const YCPValue& val, const YCPValue& arg)
+{
+ y2milestone ("Path in Execute(): %s", path->toString().c_str());
+ YCPValue ret = YCPBoolean(false);
+
+ if (path->length() == 1) {
+
+ if (PC(0) == "cancel") {
+ y2milestone ("terminanting child process with pid %d", child_pid);
+ if (child_pid)
+ {
+ if (kill (child_pid, 15) != -1)
+ {
+ sleep (3);
+ int status;
+ if (waitpid (-1, &status, WNOHANG) == 0)
+ {
+ y2milestone ("... still alive, killing it");
+ kill (child_pid, 9);
+ wait (&status);
+ }
+ child_pid = -1;
+ }
+ else
+ {
+ y2error ("error while killing: %d (%m)", errno);
+ }
+ }
+ ret = YCPBoolean (true);
+ }
+ /**
+ * parameter is whole path to target bir file, e.g.
+ * /tmp/YaST-123-456/hh.bir
+ */
+ else if (PC(0) == "enroll") {
+ string path;
+ if (!val.isNull())
+ {
+ path = val->asString()->value();
+ }
+ else
+ {
+ y2error ("path to bir file is missing");
+ return ret;
+ }
+ if (pipe (data_pipe) == -1) {
+ y2error ("pipe creation failed");
+ return ret;
+ }
+
+ long arg;
+ arg = fcntl (data_pipe[0], F_GETFL);
+ if (fcntl (data_pipe[0], F_SETFL, arg | O_NONBLOCK ) < 0)
+ {
+ y2error ("Couldn't set O_NONBLOCK: errno=%d: %m", errno);
+ close (data_pipe[0]);
+ close (data_pipe[1]);
+ return ret;
+ }
+ child_pid = fork ();
+ if (child_pid == -1)
+ {
+ y2error ("fork failed");
+ return ret;
+ }
+ else if (child_pid == 0)
+ {
+y2internal ("child process");
+ close (data_pipe[0]); // close the read-only FD
+ int state =
+ FPrintAPI::instance().acquire (data_pipe[1], path);
+ y2milestone ("acquire done with state %d", state);
+ close (data_pipe[1]);
+ exit (state);
+ }
+ else // parent -> return
+ {
+ close (data_pipe[1]); // close FD for writing
+ ret = YCPBoolean(true);
+ }
+ }
+ }
+ return ret;
+}
+
+/**
+ * otherCommand
+ */
+YCPValue FPrintAgent::otherCommand(const YCPTerm& term)
+{
+ string sym = term->name();
+
+ if (sym == "FPrintAgent") {
+
+ return YCPVoid();
+ }
+
+ return YCPNull();
+}
+
Added: trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.h?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.h (added)
+++ trunk/fingerprint-reader/agent-fprint/src/FPrintAgent.h Fri Sep 26 14:34:22 2008
@@ -0,0 +1,123 @@
+/* FPrintAgent.h
+ *
+ * FPrint agent implementation
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id: FPrintAgent.h 26456 2005-12-07 16:11:23Z jsuchome $
+ */
+
+#ifndef _FPrintAgent_h
+#define _FPrintAgent_h
+
+#include
+#include
+
+using namespace std;
+
+#include
+#include
+#include
+#include
+#include
+
+#include <string>
+
+/**
+ * The real interface to fprint library
+ * - extra (singleton) class is used to contain signal handler function
+ */
+class FPrintAPI
+{
+
+private:
+ FPrintAPI ();
+
+ virtual ~FPrintAPI();
+
+public:
+
+ static FPrintAPI & instance();
+
+ static void catch_sigterm (int);
+
+ int acquire (int, string);
+
+ int test_int;
+
+ struct fp_print_data *data;
+
+ void finalize ();
+
+};
+
+/**
+ * @short An interface class between YaST2 and FPrint Agent
+ */
+class FPrintAgent : public SCRAgent
+{
+
+public:
+
+ /**
+ * Default constructor.
+ */
+ FPrintAgent ();
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~FPrintAgent();
+
+ /**
+ * Provides SCR Read ().
+ * @param path Path that should be read.
+ * @param arg Additional parameter.
+ */
+ virtual YCPValue Read(const YCPPath &path,
+ const YCPValue& arg = YCPNull(),
+ const YCPValue& opt = YCPNull());
+
+ /**
+ * Provides SCR Write ().
+ */
+ virtual YCPBoolean Write(const YCPPath &path,
+ const YCPValue& val,
+ const YCPValue& arg = YCPNull());
+
+ /**
+ * Provides SCR Execute ().
+ */
+ virtual YCPValue Execute(const YCPPath &path,
+ const YCPValue& val = YCPNull(),
+ const YCPValue& arg = YCPNull());
+
+ /**
+ * Provides SCR Dir ().
+ */
+ virtual YCPList Dir(const YCPPath& path);
+
+ /**
+ * Used for mounting the agent.
+ */
+ virtual YCPValue otherCommand(const YCPTerm& term);
+
+ /**
+ * array with pipe file descriptors
+ */
+ int data_pipe[2];
+
+ /**
+ * pid of the child process after fork
+ */
+ pid_t child_pid;
+
+ /**
+ * return value of the child process
+ */
+ int child_retval;
+
+};
+
+#endif /* _FPrintAgent_h */
Added: trunk/fingerprint-reader/agent-fprint/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/src/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/src/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/src/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1,24 @@
+
+# Makefile.am for .../agent-fprint/src
+#
+
+AM_CXXFLAGS = -DY2LOG=\"agent-fprint\" -Wall
+
+plugin_LTLIBRARIES = libpy2ag_fprint.la
+noinst_LTLIBRARIES = liby2ag_fprint.la
+
+liby2ag_fprint_la_SOURCES = \
+ FPrintAgent.cc \
+ FPrintAgent.h
+liby2ag_fprint_la_LDFLAGS = -version-info 2:0
+liby2ag_fprint_la_LIBADD = @AGENT_LIBADD@ -lfprint
+
+
+libpy2ag_fprint_la_SOURCES = \
+ $(liby2ag_fprint_la_SOURCES) \
+ Y2CCFPrintAgent.cc
+libpy2ag_fprint_la_LDFLAGS = -version-info 2:0
+libpy2ag_fprint_la_LIBADD = @AGENT_LIBADD@ -lfprint
+
+
+INCLUDES = -I$(includedir)
Added: trunk/fingerprint-reader/agent-fprint/src/Y2CCFPrintAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/src/Y2CCFPrintAgent.cc?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/src/Y2CCFPrintAgent.cc (added)
+++ trunk/fingerprint-reader/agent-fprint/src/Y2CCFPrintAgent.cc Fri Sep 26 14:34:22 2008
@@ -0,0 +1,14 @@
+/* Y2CCFPrintAgent.cc
+ *
+ * Authors: Jiri Suchomel
+ *
+ */
+
+#include
+#include
+
+#include "FPrintAgent.h"
+
+typedef Y2AgentComp <FPrintAgent> Y2FPrintAgentComp;
+
+Y2CCAgentComp <Y2FPrintAgentComp> g_y2ccag_fprint ("ag_fprint");
Added: trunk/fingerprint-reader/agent-fprint/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/agent-fprint/testsuite/Makefile.am?rev=51583&view=auto
==============================================================================
--- trunk/fingerprint-reader/agent-fprint/testsuite/Makefile.am (added)
+++ trunk/fingerprint-reader/agent-fprint/testsuite/Makefile.am Fri Sep 26 14:34:22 2008
@@ -0,0 +1,8 @@
+#
+# Makefile.am for .../agent-thinkfinger/testsuite
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+
+clean-local:
+ rm -f tmp.err.* tmp.out.* site.exp site.bak
Modified: trunk/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp?rev=51583&r1=51582&r2=51583&view=diff
==============================================================================
--- trunk/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp (original)
+++ trunk/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp Fri Sep 26 14:34:22 2008
@@ -92,22 +92,22 @@
integer swipe_success = 0;
integer swipe_failed = 0;
- // helper function: return exit status of the thinkfinger proccess;
+ // helper function: return exit status of the fprint proccess;
// regulary check user input for `cancel button
integer get_exit_status () {
integer ex = exit_status;
while (true)
{
- boolean exited = (boolean) SCR::Read (.thinkfinger.check_exit);
+ boolean exited = (boolean) SCR::Read (.fprint.check_exit);
if (exited)
{
- ex = (integer) SCR::Read (.thinkfinger.exit_status);
+ ex = (integer) SCR::Read (.fprint.exit_status);
break;
}
ui = UI::PollInput ();
if (ui == `cancel)
{
- SCR::Execute (.thinkfinger.cancel);
+ SCR::Execute (.fprint.cancel);
UI::ReplaceWidget (`id (`rp), `Label (_("Canceled")));
break;
}
@@ -125,7 +125,7 @@
swipe_success, swipe_failed)
));
}
- if (SCR::Execute (.thinkfinger.add-user, bir_path) != true)
+ if (SCR::Execute (.fprint.enroll, bir_path) != true)
{
ui = `cancel;
// status message
@@ -134,7 +134,8 @@
}
while (ui != `cancel)
{
- map statemap = (map) SCR::Read (.thinkfinger.state);
+ map statemap = (map) SCR::Read (.fprint.state);
+y2internal ("statemap: %1", statemap);
if (statemap != nil && statemap != $[])
{
integer state = statemap["state"]:0;
@@ -176,6 +177,21 @@
replace_swipe_string ();
break;
}
+
+ case 1: { // FP_ENROLL_COMPLETE
+ UI::ReplaceWidget (`id (`rp),
+ // status label
+ `Label (_("Storing data...")));
+ UI::ReplaceWidget (`id (`rpstatus), `VSpacing ());
+ exit = true;
+ break;
+ }
+ case -1: { // FP_ENROLL_FAIL FIXME
+ UI::ReplaceWidget (`id (`rp),
+ `Label (_("Acquiring fingerprint failed.")));
+ exit = true;
+ break;
+ }
}
}
else if (statemap == nil)
@@ -193,7 +209,7 @@
if (ui == `cancel || ui == `back)
{
- SCR::Execute (.thinkfinger.cancel);
+ SCR::Execute (.fprint.cancel);
// status label (canceled after user action)
UI::ReplaceWidget (`id (`rp), `Label (_("Canceled")));
y2milestone ("canceled");
@@ -202,9 +218,11 @@
sleep (100);
}
y2milestone ("agent exit status: %1", exit_status);
+// FIXME FIXME
// 9 is failed acquire, 253 is USB error, 254 communication error
// FIXME what's the meaning of TF_STATE_ENROLL_SUCCESS (7)?
- if (exit_status == 7 || exit_status == 8)
+// if (exit_status == 7 || exit_status == 8)
+ if (exit_status == 1)
{
// status label
UI::ReplaceWidget (`id (`rp), `Label (_("Fingerprint acquired successfully.")));
Modified: trunk/fingerprint-reader/yast2-fingerprint-reader.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/fingerprint-reader/yast2-fingerprint-reader.spec.in?rev=51583&r1=51582&r2=51583&view=diff
==============================================================================
--- trunk/fingerprint-reader/yast2-fingerprint-reader.spec.in (original)
+++ trunk/fingerprint-reader/yast2-fingerprint-reader.spec.in Fri Sep 26 14:34:22 2008
@@ -2,7 +2,7 @@
@HEADER@
Requires: yast2 yast2-pam
-BuildRequires: libthinkfinger libusb-devel
+BuildRequires: libfprint0 libfprint-devel libusb-devel
BuildRequires: doxygen gcc-c++ yast2-core-devel perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite yast2-pam
Supplements: modalias(usb:v0483p2016d*dc*dsc*dp*ic*isc*ip*)
@@ -32,5 +32,5 @@
@moduledir@/UsersPluginFingerprintReader.pm
@desktopdir@/fingerprint-reader.desktop
@scrconfdir@/*.scr
-@plugindir@/libpy2ag_thinkfinger.*
+@plugindir@/libpy2ag_fprint.*
%doc @docdir@
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org