linux uinput 分析。
linux uinput
本文以 2.6.22.7 的kernel 为基础。
首先 uinput 是一个字符设备, 其次它还是一个 input 设备。另外它可以是一个鼠标或者键盘设备。
从 init 部分说起吧。
static const struct file_operations uinput_fops = {
.owner = THIS_MODULE,
.open = uinput_open,
.release = uinput_release,
.read = uinput_read,
.write = uinput_write,
.poll = uinput_poll,
.unlocked_ioctl = uinput_ioctl,
};
static struct miscdevice uinput_misc = {
.fops = &uinput_fops,
.minor = UINPUT_MINOR,
.name = UINPUT_NAME,
};
static int __init uinput_init(void)
{
return misc_register(&uinput_misc);
}
首先说说 miscdevice, 很方便的东西,对 device 做了简单的包装,
当 misc_register 的时候就完成了 设备的 注册安装一类的东东, 不用自己再操心了。真是懒人的设计阿。
所有的 misc 设备公用同一个主设备号,在 misc_init 中,
static int __init misc_init(void)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *ent;
ent = create_proc_entry("misc", 0, NULL);
if (ent)
ent->proc_fops = &misc_proc_fops;
#endif
misc_class = class_create(THIS_MODULE, "misc");
if (IS_ERR(misc_class))
return PTR_ERR(misc_class);
if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
printk("unable to get major
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
bash有两种输入模式vi模式和emacs模式,其中emacs是默认模式,而且操作起来也比vi模式要快捷。可以通过 set -o vi和set -o emacs来转换。
1.在命令历史中查找
强烈推荐使用 Ctrl+r, 这个键组合是反向增量查找消息历史。很好用。 比如你很久以前输入过某个命令如。 gcc -c -DKKT -
Dnnn 等等,一长串, ......
tidy 是一个非常帮忙的网页代码分析和纠错的工具,能够支持多种页面编码,并且支持xhtml输出。如果我们偷懒,甚至可以将整个页面缓存,最后采用tidy处理,最后输出完美的xhtml代码。
linux下安装过程如下:
首先安装tidy ,下载tidy源代码:
cvs -d:pserver: anonymous@tidy.cvs.sourceforge.net 为防备电子邮件地址收集 ......
首先,记住vi编辑器的两个模式:1、命令模式 2、编辑模式。
在一个UNIX/Linux的shell命令或者一个以斜杠(/)、问号(?)或冒号(:)开始的vi命令后面用户需要键入回车键,而要切换到vi命令模式需要按Esc键。注意,以冒号(:)或者斜杠(/) 开始的vi命令会显示在屏幕底部,但其他命令都不会显示在屏幕上。
&nb ......