On Tue Dec 16 22:49 , David Schulz sent:
>I recently purchased 2 net4801 that now run OpenBSD 4.4 Release.
>I attached a USB Keyboard to the USB Port.
>
>In my dmesg, the USB Keyboard gets attached to /dev/wskbd1
>
>I want to automatically run a Program at boot that logs and processes Keyboard
>Input. How can i get to the Keyboard Input made on a USB Keyboard that i
>attached to my Soekris USB Port? Means: How can i capture whatever is entered
>on the USB Keyboard, so i can use it in my program?
>
>Here is a hypothetical Perl Program that takes Input and writes it to a file.
>I am aware that noone will see the print Statements when there is no screen,
>they are just for examples sake when i run this from a ssh session:
>
>
>#!/usr/bin/perl
>
>use strict;
>use warnings;
>
>open(my $fh, '>', '/var/log/reader.log') or die $!;
>
>while ('TRUE') {
> print "Enter ID :";
> chomp(my $id = <STDIN>);
> print $fh " You entered $id\n";
> if ($id eq 'exit') {
> print "Exiting\n";
> close($fh);
> exit;
> }
>}
>
>
>The above will not work for me, because when the Machine is running
>unattended, there is noone who logged in, the Program wouldn't know where to
>take the input from. I need to somehow make my Program read directly
>from the Keyboard Device Entry, and take its Input from there.
You're on the right track. You need to be reading from that keyboard, not
standard in. My Perl is very rusty, but you need to either remap STDIN to
/dev/wskbd1, or just open the keyboard device as a file and read from that file
handle. I'd probably go with the latter. Either way I think you need Perl's
"open" function. If you don't have a Camel or Llama handy, google for perldocs.
The other problem is how to run it unattended. Unix gives you many ways to do
this, including: cron, boot RC scripts, /etc/inittab, and /dev/ttys. The latter
has traditionally dealt with terminals. I'm more familiar with FreeBSD and
SunOS, so YMMV with OpenBSD as to the exact file used for those.
>Can anyone
>help me out, it would be great. I hope i have been concise but clear with my
>Problem.
Works for me. A lot better than one frequently gets on other forums.
-Jed
_______________________________________________
Soekris-tech mailing list
[email protected]
http://lists.soekris.com/mailman/listinfo/soekris-tech