Where I started was I wanted to be able to just hit the
Print Screen key on the keyboard to get a screen dump. That led me to
actkbd and
screenshot.sh.
bootlocal.sh is the normal way to automatically have stuff running you want - in this case
actkbd. It is only later (when X is running) that
screenshot.sh is called in response to my hitting the
Print Screen key.
Poking around a little more I've discovered that the keyboard apparently always has the entry
EV=120013 in the /proc/bus/devices file[1]. I've just hacked out a simple bit of perl to autodetect the correct event and to launch
actkbd. Ideally the autodetect code in the
linux.c file should do this. (I used perl as I'm more familiar with it than shell script).
#!/usr/local/bin/perl
use strict;
use warnings;
# Scan the file /proc/bus/input/devices to find the eventN queue for the keyboard,
# and then launch actkbd.
#
# Keyboard can apparently can be identified by the entry where EV=120013.
open(DEVICES, '<', "/proc/bus/input/devices" ) || die ("Can't open devices file\n");
my $line;
while( $line=<DEVICES> ) {
my $event;
next if( !($line =~ m/^H:\sHandlers=.*kbd.*(event[0-9]+)/ ));
$event = $1;
$line=<DEVICES>; # discard next line
$line=<DEVICES>;
if( $line =~ m/EV=120013/ ) {
print "Launching actkbd on $event\n";
exec "sudo /usr/local/sbin/actkbd -D -q -d /dev/input/$event";
}
}
So I'm almost home. I've got a way now that looks like it selects the correct
eventN file, which just leaves me with the more trivial job of starting it manually.
FYI: On the machine I've been trying things out on - boot from the machine's flash drive and it's
event2 I need, boot from a USB Pen Drive and it's
event3.
[1]
https://unix.stackexchange.com/questions/74903/explain-ev-in-proc-bus-input-devices-data