X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=checkcard.pl;h=263ffe71ed348797d64d983ddda90dd2ea8c492c;hb=afc36c1874ead0a61d77846384081488d9616eb7;hp=b948393935c0cf4e7a19e397f6d32aae52d8abad;hpb=889622e0c6757408211798cfe8562a026a93b5b2;p=svn42.git diff --git a/checkcard.pl b/checkcard.pl index b948393..263ffe7 100755 --- a/checkcard.pl +++ b/checkcard.pl @@ -6,16 +6,17 @@ my $fh; #my $fifofile = "/tmp/door_cmd.fifo"; my $socketfile = "/tmp/door_cmd.socket"; -exit(1) unless (-S $socketfile); +sleep(1) while (! -S $socketfile); my $socketaddr = sockaddr_un($socketfile); my $keys; my %good; -open $keys,'/flash/realraum/keys'; +open $keys,'/flash/keys'; while (<$keys>) { - if ($_ =~ /([0-9A-Fa-f]{8})\s(\S+)/) + chomp; + if ($_ =~ /^([0-9A-Fa-f]{8})\s+(.+)$/) { $good{$1}=$2; } @@ -31,7 +32,7 @@ sub send_to_fifo while (sleep 1) { - open $fh,'/flash/realraum/mifare-read 0 2>&1 |'; + open $fh,'/flash/tuer_python/mifare-read 0 2>&1 |'; while (<$fh>) { next unless /UID/; @@ -53,36 +54,5 @@ while (sleep 1) # # ############################################################### -# /dev/ttyUSB0: door key printer -# -# -# Ok -# Ok, closing now -# Already closed -# Already opened -# close forced manually\nOk -# open forced manually\nOk -# Error: .* -# .* be: unknown command -# Operation in progress -# open/close took too long! -# last open/close operation took to long! -# -# commands: -# c ... close -# response: "Ok", "Already closed", "Error: .*" -# o ... open -# response: "Ok", "Already opened", "Error: .*" -# s ... status -# response: "Status: closed|opened|<->, opening|waiting|closing|idle" -# or "Error: .*" -# r ... reset -# "Ok, closing now" or "Error: .*" -# -# open/close will only be accepted if Status: ..., idle -# Reset overrules all other operations in progress -# s will always be accepted -# -############################################################### # #