- added "design-document"...
--- /dev/null
+Goal:
+ - Card is read
+ - UID is piped to door-key-bubble-jet-printer-daemon
+ - door-key-bubble-jet-printer-daemon (dkbjpd) toggles open/close
+ - it works
+
+Features:
+ - opening/closing of key is logged
+ - state of key is periodically checked and logged
+ - open/close toggling can be triggered by different sources, like
+ - RFID card
+ - phone calls
+ - agressively watching onto a Windows login screen
+ - learn-mode
+ - simple way to add new rfid cards to allowed card-list
+
+Architecture:
+ - door-key-bubble-jet-printer-daemon
+ - can open/close door
+ - logs state of door
+ - rfid-reader
+ - recognizes presence of accepted rfid-card and toggles door
+ - voip-reader
+ - recognizes phone call of accepted caller-id and toggles doort
+ - door-key-ubble-jet-printer
+ - accepts single-character commands and writes
+ success and status messages
+ - *-reader write to a fifo, which is listened by the
+ door-key-bubble-jet-printer-daemon
+ - rfid-learner
+
+Design:
+ - Perl is great for everything.
+ - Shell is for the rest.
--- /dev/null
+
+i=1
+while [ $i -gt 0 ]; do
+ opensc-tool --serial > /dev/null 2>&1
+ i=$?
+ if [ $i -gt 0 ]; then
+ echo "Please insert card...."
+ sleep 5
+ else
+ opensc-tool --serial | cut -b 0,48 >> card-database
+ fi
+done
+
+perl -ne s/[^0-9A-F]//g; $_ = substr($_,0,32); print "$_\n" card-database
--- /dev/null
+#!/usr/bin/perl -w
+
+my $fifofile = "/root/door_cmd.fifo";
+my %validcards;
+
+while (<>)
+{
+ my ($cardid,$name)= split /\s+/,$_;
+ $validcards{$cardid}=$name;
+};
+
+my $currentcard=0;
+while (sleep 1)
+{
+ my $card=`/usr/bin/opensc-tool --serial 2>/dev/null`;
+ $card =~ s/[^0-9A-F]//g;
+ $card = substr($card,0,32);
+ if ($card eq $currentcard)
+ { next; }
+ else
+ {$currentcard=$card;}
+ if ($validcards{$card})
+ {
+ if( -p $fifofile)
+ {
+ open(my $fifo,"> $fifofile");
+ print $fifo "toggle "."Card ".$validcards{$card}."\n";
+ close($fifo);
+ }
+ } else {
+ print "Card did not match $card\n";
+ }
+}
--- /dev/null
+#!/usr/bin/perl
+
+my $card=`/usr/bin/opensc-tool --serial`;
+my @validcards;
+
+$card =~ s/\D//g;
+print "$card\n";
--- /dev/null
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: ledstats
+Version: 0.3.1-5
+Binary: ledstats
+Maintainer: Julien Danjou <acid@debian.org>
+Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64
+Standards-Version: 3.6.2.2
+Build-Depends: debhelper (>> 4.0.0), libparportled-dev (>= 0.3)
+Files:
+ 4219980ce5e5c2caaa775f84898dc827 22789 ledstats_0.3.1.orig.tar.gz
+ 25ce0b0df64c43ef83337399f7802c5e 25312 ledstats_0.3.1-5.diff.gz
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.3 (GNU/Linux)
+
+iD8DBQFEOPcUpGK1HsL+5c0RApQ8AKCAf2cUWfzsjVSQy+Vn4Q8i79Af4gCg1K7b
+EKeMPdHr9iKROoaSpL5seS4=
+=fvbV
+-----END PGP SIGNATURE-----
--- /dev/null
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: libparportled
+Version: 0.5.1-6
+Binary: libparportled-dev, libparportled
+Maintainer: Julien Danjou <acid@debian.org>
+Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64
+Standards-Version: 3.6.2.2
+Build-Depends: debhelper (>> 4.0.0)
+Files:
+ 78874d9d652d44e7aae1780a4dc78eb8 27486 libparportled_0.5.1.orig.tar.gz
+ 5473343aea605842fb69c4ade3097a8e 24630 libparportled_0.5.1-6.diff.gz
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.3 (GNU/Linux)
+
+iD8DBQFEOPYSpGK1HsL+5c0RApO2AJ4jN+vEaOYwS93x94cSkOHoJL4a6wCgtGU8
++UCZk34aiYOMMlJVoGEMiYs=
+=D+o1
+-----END PGP SIGNATURE-----