Thanks to Murr and lg for excellent answers about keyboard emulation. IOCTLs like TIOCSTI, VT_ACTIVATE and VT_GETSTATE allows good keyboard emulation under consoles and shell. But if there any ioctls that allow emulate mouse? Now I use such approach as moving /dev/psaux to another place and creating a FIFO instead. Listening this FIFO and implementing ps/2 protocol allows to emulate mouse in QT, X and console (gpm) but real mouse doesn't work (it is necessary to make additional workaround to translate messages from/to real device). So it is a bit complicated. Any suggestions? Also is there anywhere a description of ioctls listed in "man ioctl_list"?