Chinaunix首页 | 论坛 | 博客
  • 博客访问: 191434
  • 博文数量: 111
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 1240
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-07 07:46
文章分类

全部博文(111)

文章存档

2015年(2)

2014年(1)

2011年(1)

2010年(7)

2009年(100)

我的朋友

分类: LINUX

2009-09-23 11:29:44

转载时请注明出处和作者联系方式
文章出处:http://www.limodev.cn/blog
作者联系方式:李先静

uinput 是linux 2.6用来实现用户空间输入设备的内核接口,用它可以在用户空间实现输入设备,向系统中注入输入事件,而不需要通过GUI去实现。使用时要确保内核编译时 支持uinput模块,可能还要手工创建设备文件/dev/uinput(mknod /dev/uinput c 10 223)。

o 创建user input device
UInput* uinput_create(const char* dev, int xmax, int ymax);
android平台用xmax和ymax对触摸屏做简单的校准,如果不设置为实际的值,事件先会被丢掉。

o 上报mouse按键事件
void uinput_report_lbutton_event(UInput* thiz, int press);
void uinput_report_mbutton_event(UInput* thiz, int press);
void uinput_report_rbutton_event(UInput* thiz, int press);

o 上报mouse移动事件
void uinput_report_move_event(UInput* thiz, int x, int y);

o 上报按键事件
void uinput_report_key_event(UInput* thiz, unsigned short key, int press);

o 上报触摸屏事件
void uinput_report_touch_event(UInput* thiz, int x, int y, int press/*1(down) 0(up) -1(move)*/);

o 销毁设备
void uinput_destroy(UInput* thiz);

有需要的朋友请到这里下载。

阅读(824) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~