pancake
2007-01-28 23:48:46 UTC
I've written a small patch for slock for those who want to unlock
the X windows using a fingerprint device.
It's using thinkfinger.sf.net driver and utilities.
$ hg clone http://suckless.org/cgi-bin/hgwebdir.cgi/slock
You'll need to install lt-tf-tool tf-init elf binaries (.libs/*)
with 4755 perms on /usr/bin, and create an rc script for initializing
the fingerprint device on boot time.
Enjoy.
--pancake
pancake@~/prg/slock$ hg diff
diff -r 03007b1332bc slock.c
--- a/slock.c Sat Jan 13 14:10:56 2007 +0100
+++ b/slock.c Mon Jan 29 00:41:51 2007 +0100
@@ -6,6 +6,7 @@
#include <shadow.h>
#endif
+#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <stdlib.h>
@@ -62,11 +63,19 @@ main(int argc, char **argv) {
XColor black, dummy;
XEvent ev;
XSetWindowAttributes wa;
+ pid_t pid;
if((argc > 1) && !strncmp(argv[1], "-v", 3)) {
fputs("slock-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS);
}
+
+ if (!(pid=fork())) {
+ setuid(geteuid());
+ system("while : ; do lt-tf-tool --no-init --verify && pkill slock && break ; sleep 1; done");
+ exit(1);
+ }
+
pws = get_password();
if(!(dpy = XOpenDisplay(0))) {
fputs("slock: cannot open display\n", stderr);
@@ -133,5 +142,6 @@ main(int argc, char **argv) {
XFreePixmap(dpy, pmap);
XDestroyWindow(dpy, w);
XCloseDisplay(dpy);
+ kill(pid,SIGKILL);
return 0;
}
the X windows using a fingerprint device.
It's using thinkfinger.sf.net driver and utilities.
$ hg clone http://suckless.org/cgi-bin/hgwebdir.cgi/slock
You'll need to install lt-tf-tool tf-init elf binaries (.libs/*)
with 4755 perms on /usr/bin, and create an rc script for initializing
the fingerprint device on boot time.
Enjoy.
--pancake
pancake@~/prg/slock$ hg diff
diff -r 03007b1332bc slock.c
--- a/slock.c Sat Jan 13 14:10:56 2007 +0100
+++ b/slock.c Mon Jan 29 00:41:51 2007 +0100
@@ -6,6 +6,7 @@
#include <shadow.h>
#endif
+#include <signal.h>
#include <ctype.h>
#include <pwd.h>
#include <stdlib.h>
@@ -62,11 +63,19 @@ main(int argc, char **argv) {
XColor black, dummy;
XEvent ev;
XSetWindowAttributes wa;
+ pid_t pid;
if((argc > 1) && !strncmp(argv[1], "-v", 3)) {
fputs("slock-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS);
}
+
+ if (!(pid=fork())) {
+ setuid(geteuid());
+ system("while : ; do lt-tf-tool --no-init --verify && pkill slock && break ; sleep 1; done");
+ exit(1);
+ }
+
pws = get_password();
if(!(dpy = XOpenDisplay(0))) {
fputs("slock: cannot open display\n", stderr);
@@ -133,5 +142,6 @@ main(int argc, char **argv) {
XFreePixmap(dpy, pmap);
XDestroyWindow(dpy, w);
XCloseDisplay(dpy);
+ kill(pid,SIGKILL);
return 0;
}