linux发送键盘事件,虚拟键盘(Linux/libevdev) - 发送事件

该博客介绍了一个在Linux环境下使用libevdev库创建虚拟键盘的程序,旨在发送键盘事件。虽然程序在Ubuntu PC上运行正常,但在Beaglebone Black或Raspberry Pi3上未生效。代码示例展示了如何编写和发送键盘事件,包括按键按下和释放。
摘要由CSDN通过智能技术生成

试图实现虚拟键盘。该程序在5秒周期内发送击键事件。它在PC(Ubuntu Linux)上工作。问题是Beaglebone Black/Raspberry Pi3没有显示任何内容。虚拟键盘(Linux/libevdev) - 发送事件

Plaftorm Beaglebone黑色,Debian的杰西:

[email protected]:~$ uname -a

Linux beaglebone 4.9.9-ti-r22 #1 SMP PREEMPT Mon Feb 13 18:39:00 UTC 2017 armv7l GNU/Linux

代码:

#include

#include

#include

#include

#include

#include

#include

/* emit function is identical to of the first example */

void emit(int fd, int type, int code, int val)

{

struct input_event ie;

ie.type = type;

ie.code = code;

ie.value = val;

/* timestamp values below are ignored */

ie.time.tv_sec = 0;

ie.time.tv_usec = 0;

int res = write(fd, &ie, sizeof(ie));

printf("emit write bytes=%d fd=%d code=%d v

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值