Tag: uikeyboard uinput

用于Ubuntu 14.04的C中的UINPUT设备程序不起作用。 为什么? 第2部分:

我正在使用Ubuntu 14.04,我在c中设置了一个虚拟键盘,这需要输入才能工作。 我的程序应该将密钥’a’发送到终端,就像我按下键盘上的’a’键一样。 这是我的源代码: int main() { int uinp_fd; int i; /********** Open uinput file section. **********************/ uinp_fd = open(“/dev/uinput”, O_WRONLY|O_NDELAY); if(uinp_fd < 0) { printf("Unable to open /dev/uinput\n"); return -1; } else printf("Can open /dev/uinput\n"); /********* Setup input device structure section: ***********/ memset(&uinp,0,sizeof(uinp)); snprintf(uinp.name, UINPUT_MAX_NAME_SIZE, "The C Keyboard"); uinp.id.bustype = BUS_USB; uinp.id.version = 1; […]