LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì²âµ½µÄËùÓа´¼ü¶¼Éϱ¨¸øÁËinput×Óϵͳ¡£Input×ÓϵͳÊÇËùÓÐI/OÉ豸Çý¶¯µÄÖмä²ã£¬ÎªÉϲãÌṩÁËÒ»¸öͳһµÄ½çÃæ¡£ÀýÈ磬ÔÚÖÕ¶ËϵͳÖУ¬ÎÒÃDz»ÐèҪȥ¹ÜÓжàÉÙ¸ö¼üÅÌ£¬¶àÉÙ¸öÊó±ê¡£ËüÖ»Òª´Óinput×ÓϵͳÖÐȥȡ¶ÔÓ¦µÄʼþ(°´¼ü£¬Êó±êÒÆλµÈ)¾Í¿ÉÒÔÁË¡£
¶þ£ºÊ¹ÓÃinput deviceµÄÀý×Ó
ÏÂÃæµÄ´úÂëÊÇ»ùÓÚlinux kernel 2.6.25.·ÖÎöµÄ´úÂëÖ÷ҪλÓÚkernel2.6.25/drivers/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);
input_register_device(&button_dev);
}
static void __exit button_exit(void)
{
&n
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
Èç¹ûÄãÐèÒªÔÚLinuxÖвÙ×÷windowsϵÄÎļþ£¬ÄÇôÄã¿ÉÄܻᾳ£Óöµ½Îļþ±àÂëת»»µÄÎÊÌâ¡£WindowsÖÐĬÈϵÄÎļþ¸ñʽÊÇGBK(gb2312)£¬¶øLinuxÒ»°ã¶¼ÊÇUTF-8¡£ÏÂÃæ½éÉÜһϣ¬ÔÚLinuxÖÐÈçºÎ²é¿´ÎļþµÄ±àÂë¼°ÈçºÎ½øÐжÔÎļþ½øÐбàÂëת»»¡£
Ò»£¬²é¿´Îļþ±àÂ룺
ÔÚLinuxÖв鿴Îļþ±àÂë¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖ·½Ê½£º
1.ÔÚVimÖпÉÒÔÖ±½Ó²é¿ ......
×÷ÕߣºSam£¨Õç·å£© sam_cdoe@hotmail.com
1.´´½¨thread.
int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr,
void *(*start_routine)(void*), void *restrict arg);
²ÎÊý1£ºpthread_t *restrict t ......
wallÃüÁî
Õâ¸öÃüÁîµÄ¹¦ÄÜÊǶÔÈ«²¿ÒѵǼµÄÓû§·¢ËÍÐÅÏ¢£¬Óû§¿ÉÒÔÏÈ°ÑÒª·¢Ë͵ÄÐÅϢдºÃ´æÈëÒ»¸öÎļþÖУ¬È»ºóÊäÈ룺
# wall < ÎļþÃû
ÕâÑù¾ÍÄܶÔËùÓеÄÓû§·¢ËÍÐÅÏ¢ÁË¡£
ÔÚÉÏÃæµÄÀý×ÓÖзûºÅ“<”±íʾÊäÈëÖض¨Ïò£¬ÓйØËüµÄº¬ÒåºÍÓ÷¨Çë²ÎÔĵÚʮյÄÓйØÄÚÈÝ¡£ ÀýÈ磺
# wall ‘Thank you!&rsquo ......