> On Wed, 5 Jan 2000, Luc Hermans wrote:
>> Hi,
>> With 'cat /dev/vcs1' I can dump the screen of the prog
>> running on /dev/tty1.
>> Can I send console input to that prog also ?
> Try the following:
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <linux/keyboard.h>
> #include <linux/kd.h>
> void inskey (unsigned char *string, const char *tty_dev)
> {
> int tty_fd;
> long kbmode;
> tty_fd = open (tty_dev, O_RDONLY);
> if (tty_fd_fd == -1) return;
> /* The ultimate goal for this function is to be able to insert characters,
> * as well as arrow key controls, even if the keyboard on the console is
> * in K_RAW mode (as in dosemu particularly).
> * For instance, at least, the insertion is not performed if in
> * raw keyboard to prevent garbage results.
> * Keyboard scan codes would have to be sent otherwise.
> */
> ioctl( tty_fd, KDGKBMODE, &kbmode );
> if( kbmode == K_XLATE )
> while (*string)
> if (ioctl (tty_fd, TIOCSTI, string++))
> break;
> close (tty_fd);
> Then calling inskey( "ls -la\r", "/dev/tty1" ) for example should provide
> the expected result on tty1.
> Also you might want to use /dev/vcsa1 instead. See "man vcs".
> Nicolas
I could have sworn that I just saw something like this
posted on Freshmeat a few weeks ago. It seemed like
it was basically like this (or like the old FAKEY.COM
program for Messy-DOS).
It might be fun to wrap this function with a
command line parser and a --help message and post it
to [fm].
There was one Messy-DOS utility that a friend of mine
wrote as a throwaway. This one was for quality
assurance. It was different because it would somehow
reprogram the keyboard controller (not the 8042 on the
motherboard but the 80xx inside the keyboard itself)
and force it to send the keystrokes back after a short
programmed delay. This allowed him to guarantee that
there was NO TSR present when the software to be tested
was loaded.
(If we really wanted something like that for Linux
I'd suggest a device driver. If I really needed something
like that for my own QA buy a serial to keyboard converter
out of the back of Circuit Cellar Ink and use a second
computer to feed the keystrokes into the target port).
--
Jim Dennis [EMAIL PROTECTED]
Linuxcare: Linux Corporate Support Team: http://www.linuxcare.com
--
To unsubscribe from this list, send a message to [EMAIL PROTECTED]
with the command "unsubscribe linux-embedded" in the message body.
For more information, see <http://waste.org/mail/linux-embedded>.