Alright, some of you might have noticed I've been working on this problem off and on for about 3 weeks. I cannot figure out for the life of me whats going on.. Below is the perl script that saves input from USB card reader which acts like a keyboard. The machine is an embedded system running off of a compact flash drive, using voyage linux.
use strict;
use Time::Local;
open(MATCH,'swipe_match.txt');
my @matches = <MATCH>;
close(MATCH);
my $error = qr/[+%;]E\?/;
while(1) {
my $text = <STDIN>;
my $text1 = <STDIN>;
my $text2 = <STDIN>;
if (($text && $text1 && $text2) or ($text && $text1) or $text) {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(); $year += 1900;
$mon+=1;
my $timestamp = "$mon/$mday/$year $hour:$min:$sec";
chomp $text;
chomp $text1;
chomp $text2;
# my $matched = 0;
# foreach my $test (@matches) {
# chomp $test;
# $matched = 1 if ($text =~ /$test/i);
# }
# if ($matched) {
# system("aplay /SWIPE/good.wav >/dev/null 2>/dev/null");
# } else {
# system("aplay /SWIPE/bad.wav >/dev/null 2>/dev/null");
# }
# write out the swipe even if its bad...
open(LOG,'>>/DATA/SWIPES.TXT');
print LOG $text."\t".$text1."\t".$text2."\t".$timestamp."\n";
close(LOG);
if ($text =~ $error or $text1 =~ $error or $text2 =~ $error) {
system("aplay /SWIPE/bad.wav >/dev/null 2>/dev/null");
}
else {
system("aplay /SWIPE/good.wav >/dev/null 2>/dev/null");
}
}
}
exit;
I did not write this script, and the person who did write it, is long gone. Currently I have 2 machines. One of which is working and the other is the one Im trying to get to work. Im trying to figure out how this script gets input (on the machine that is working). I can open the log file /DATA/SWIPES.TXT and view the actual swipes. Currently there are no running processes on the machine that would affect the script, here are the processes:
PID TTY STAT TIME COMMAND
1 ? Ss 0:29 init [2]
2 ? S< 0:00 [kthreadd]
3 ? S< 0:04 [ksoftirqd/0]
4 ? S< 3:21 [events/0]
5 ? S< 0:00 [khelper]
44 ? S< 0:00 [kblockd/0]
46 ? S< 0:00 [kacpid]
47 ? S< 0:00 [kacpi_notify]
94 ? S< 0:00 [kseriod]
134 ? S 0:00 [pdflush]
135 ? S 0:06 [pdflush]
136 ? S< 0:00 [kswapd0]
137 ? S< 0:00 [aio/0]
138 ? S< 0:00 [nfsiod]
795 ? S< 0:00 [kpsmoused]
800 ? S< 0:00 [rpciod/0]
1627 ? S< 0:00 [ksuspend_usbd]
1631 ? S< 0:00 [khubd]
1646 ? S< 0:00 [ata/0]
1648 ? S< 0:00 [ata_aux]
1794 ? S<s 0:00 udevd --daemon
2913 ? Ss 0:00 pump -i eth0
2979 ? Ss 0:00 /usr/sbin/rpc.idmapd
3060 ? S 0:01 /usr/sbin/syslogd --no-forward
3083 ? Ss 0:00 /usr/sbin/sshd
3099 ? S 0:00 /usr/sbin/inetutils-inetd
3122 ? Ss 0:00 /usr/sbin/pptpd
3138 ? Ss 0:00 /usr/sbin/cron
3149 ? SLs 0:33 /usr/sbin/watchdog
3167 tty2 Ss+ 0:00 /sbin/mingetty tty2
3169 tty3 Ss+ 0:00 /sbin/rungetty tty3
3170 tty4 Ss+ 0:00 /sbin/rungetty tty4
3173 tty5 Ss+ 0:00 /sbin/getty 38400 tty5
3175 tty6 Ss+ 0:00 /sbin/getty 38400 tty6
15677 ? Ss 0:00 sshd: root@pts/0
15679 pts/0 Ss 0:00 -bash
15710 ? Z 0:00 [watchdog] <defunct>
15711 pts/0 R+ 0:00 ps x
So, from there, I don't know where to go. Can anyone give me any suggestions or hints as to how this script is actually receiving the input from the usb reader. Also, it some how receives the input while not being logged in. The machine is an embedded machine, I turn it on, and it accepts swipes and saves them, using the perl script.