Simulate input/Keyboard: Difference between revisions
Content added Content deleted
BrianFennell (talk | contribs) |
BrianFennell (talk | contribs) |
||
Line 331: | Line 331: | ||
Perl on linux can do this for PseudoTerminals (ptys) and Terminals (ttys) using [http://www.kernel.org/doc/man-pages/online/pages/man4/tty_ioctl.4.html IOCTL TIOCSTI]. The same can be done with C or any other language that can use IOCTL either natively or via [http://en.wikipedia.org/wiki/Foreign_function_interface FFI] such as [http://en.wikipedia.org/wiki/Java_Native_Interface JNI] or [http://en.wikipedia.org/wiki/Java_Native_Access JNA]. |
Perl on linux can do this for PseudoTerminals (ptys) and Terminals (ttys) using [http://www.kernel.org/doc/man-pages/online/pages/man4/tty_ioctl.4.html IOCTL TIOCSTI]. The same can be done with C or any other language that can use IOCTL either natively or via [http://en.wikipedia.org/wiki/Foreign_function_interface FFI] such as [http://en.wikipedia.org/wiki/Java_Native_Interface JNI] or [http://en.wikipedia.org/wiki/Java_Native_Access JNA]. |
||
⚫ | |||
Target may be externally created, but process must be able to open tty/pty for writing. |
Target may be externally created, but process must be able to open tty/pty for writing. |
||
<lang perl>$target = "/dev/pts/51"; |
<lang perl>$target = "/dev/pts/51"; |
||
⚫ | |||
$TIOCSTI = 0x5412 ; |
$TIOCSTI = 0x5412 ; |
||
open(TTY,">$target") or die "cannot open $target" ; |
open(TTY,">$target") or die "cannot open $target" ; |