LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â(Ò»)
------------------------------------------
±¾ÎÄϵ±¾Õ¾Ô´´,»¶ÓתÔØ!
תÔØÇë×¢Ã÷³ö´¦:http://ericxiao.cublog.cn/
------------------------------------------
Ò»£ºÇ°ÑÔ
ÔÚ¼üÅÌÇý¶¯´úÂë·ÖÎöµÄ±Ê¼ÇÖУ¬½Ó´¥µ½ÁËinput×Óϵͳ.¼üÅÌÇý¶¯£¬¼üÅÌÇý¶¯½«¼ì²âµ½µÄËùÓа´¼ü¶¼Éϱ¨¸øÁËinput×Óϵͳ¡£Input×ÓϵͳÊÇËùÓÐI/OÉ豸Çý¶¯µÄÖмä²ã£¬ÎªÉϲãÌṩÁËÒ»¸öͳһµÄ½çÃæ¡£ÀýÈ磬ÔÚÖÕ¶ËϵͳÖУ¬ÎÒÃDz»ÐèҪȥ¹ÜÓжàÉÙ¸ö¼üÅÌ£¬¶àÉÙ¸öÊó±ê¡£ËüÖ»Òª´Óinput×ÓϵͳÖÐȥȡ¶ÔÓ¦µÄʼþ(°´¼ü£¬Êó±êÒÆλµÈ)¾Í¿ÉÒÔÁË¡£½ñÌì¾Í¶Ôinput×Óϵͳ×öÒ»¸öÏ꾡µÄ·ÖÎö.
ÏÂÃæµÄ´úÂëÊÇ»ùÓÚlinux kernel 2.6.25.·ÖÎöµÄ´úÂëÖ÷ҪλÓÚkernel2.6.25/drivers/inputÏÂÃæ.
¶þ£ºÊ¹ÓÃinput×ÓϵͳµÄÀý×Ó
ÔÚÄÚºË×Ô´øµÄÎĵµDocumentation/input/input-programming.txtÖС£ÓÐÒ»¸öʹÓÃinput×ÓϵͳµÄÀý×Ó£¬²¢¸½´øÏàÓ¦µÄ˵Ã÷¡£ÒÔ´ËΪÀý·ÖÎöÈçÏ£º
#include <linux/input.h>
#include <linux/module.h>
#include <linux/init.h>
#include <asm/irq.h>
#include <asm/io.h>
static void button_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1);
input_sync(&button_dev);
}
static int __init button_init(void)
{
if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {
printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);
return -EBUSY;
}
button_dev.evbit[0] = BIT(EV_KEY);
button_dev.keybit[LONG(BTN_0)] = BIT(BTN_0);&n
Ïà¹ØÎĵµ£º
LinuxϵͳÏ»ù±¾ÃüÁ ÒªÇø·Ö´óСд uname ÏÔʾ°æ±¾ÐÅÏ¢£¨Í¬win2KµÄ ver£© dir ÏÔʾµ±Ç°Ä¿Â¼Îļþ,ls -al ÏÔʾ°üÀ¨Òþ²ØÎļþ£¨Í¬win2KµÄ dir£© pwd ²éѯµ±Ç°ËùÔÚµÄĿ¼λÖà cd cd¡¡..»Øµ½ÉÏÒ»²ãĿ¼£¬×¢Òâcd Óë..Ö®¼äÓпոñ¡£cd¡¡/·µ»Øµ½¸ùĿ¼¡£ cat ÎļþÃû ²é¿´ÎļþÄÚÈÝ cat >abc.txt Íùabc.txtÎļþÖÐдÉÏÄÚÈÝ¡£ more Î ......
Linux·¢Ðа汾֮¼äµÄ²î±ðÆäʵºÜÉÙ£¬²î±ðÖ÷Òª±íÏÖÔÚϵͳ¹ÜÀíµÄÌØÉ«¹¤¾ßÒÔ¼°Èí¼þ°ü¹ÜÀí·½Ê½µÄ²»Í¬£¬³ý´ËÖ®Í⣬ûÓÐʲô´óµÄ²î±ð£» ±ÈÈçFedoraÈí¼þ°ü¹ÜÀí¹¤¾ßÊÇrpm£¬¶øSlackwareÊÇpkgtool »òinstallpkgµÈ£»
ÑÔ¹éÕý´«£¬ÎÒÃǽÓ×Å˵Îļþϵͳ×éÖ¯½á¹¹¡£
/ LinuxÎļþϵͳµÄÈë¿Ú£¬Ò²ÊÇ´¦ÓÚ×î¸ßÒ»¼¶µÄĿ¼£»
/bin »ù´¡ÏµÍ³ËùÐèÒªµ ......
½«¿ÉÒƶ¯É豸Á¬Èëϵͳʱ£¬ÏµÍ³µÄºǫ́ÖлáÒÀ´Î·¢ÉúÈçÏÂʼþ£º
l Äں˼ì²âµ½ÐÂÓ²¼þ²åÈ룬Ȼºó·Ö±ð֪ͨhotplugºÍudev¡£Ç°ÕßÓÃÀ´×°ÈëÏàÓ¦µÄÄÚºËÄ£¿é(Èçusb-storage)£¬¶øºóÕßÓÃÀ´ÔÚ/devÖд´½¨ÏàÓ¦µÄÉ豸½Úµã(Èç/dev/sda1)¡£
l udev´´½¨ÁËÏàÓ¦µÄÉ豸½ÚµãÖ®ºó£¬»á½«ÕâÒ»ÏûϢ֪ͨhalµÄÊØ»¤³ÌÐò(hald)¡£µ±È»udev»¹µÃ±£Ö¤Ð ......
˵Ã÷£º±¾ÎÄÒÔÖ÷ҪΪתÔØÄÚÈÝ£¬Í¬Ê±¼ÓÈëÁËÎÒÔÚʹÓùý³ÌÖÐÓöµ½ÎÊÌâ¶ÔÆäµÄÐÞÕý£¡£¡£¡£¡£¡£¡£¡£¡£¡
ÏÈ˵statfs½á¹¹£º
#include <sys/vfs.h> /* »òÕß <sys/statfs.h> */
int statfs(const char *path, struct statfs *buf);
int fstatfs(int fd, struct statfs *buf);
²ÎÊý£º ......