¶ÔÓÚÊó±êÇý¶¯ºÍÇ°Ãæ·ÖÎö¹ýµÄ¼üÅÌÇý¶¯¶¼Êǹ²ÓÃinputÄ£ÐÍ,ËùÒÔ,¶ÔÓÚʼþÉϱ¨ºÍ´¦ÀíµÄ·½Ê½¶¼Ã»ÓÐÇø±ð,Ö»ÊÇmouseÊó±êÇý¶¯µ±Éϱ¨Íêdx,dy,left,middle,rightÖ®ºó,ÐèÒªµ÷ÓÃinput_sync(),½«Ç°ÃæÉϱ¨µÄ½ö½öÌî³äÔÚ»º³åÇøÖеÄÊý¾Ý,ͨ¹ýmousedev_notify_readers()·¢Ë͸øopenÁ˵ĹҽÓÔÚmousedev->client_listÁ´±íÉϵȴý»ñÈ¡Êó±êÐÅÏ¢µÄclientÃÅ,Êó±êÉ豸ºÍ¼üÅÌÉ豸ÀàËƶ¼ÊÇÔÚ/dev/input/Ŀ¼Ï´´½¨ÁËÒ»¸öcharÀàÐ͵ÄÉ豸½Úµã,ÓÉÓ¦ÓóÌÐòʹÓÃread»òÕßpollÀ´×èÈûµ÷ÓÃ,¶ÔÓÚ¼üÅÌÉ豸Ϊ/dev/input/event0,...,/dev/input/eventx,¶ÔÓÚÊó±êÉ豸Ϊ/dev/input/mouse0,...,/dev/input/mousex,¿ÉÒÔʹÓÃsudo cat /dev/input/event0À´´ÓÖÕ¶ËÉϽػñÏÔʾ°´¼üµÄÐÅÏ¢,ʹÓÃsudo cat /dev/input/mouse0À´²¶×½Êó±êµÄÐÅÏ¢.
ÈÃÎÒÃÇÀ´¿´¿´Çý¶¯Ô´Â롾gliethttp.Leith¡¿£º
============drivers\input\mouse\amimouse.c============
input_report_rel(amimouse_dev, REL_X, dx);
input_report_rel(amimouse_dev, REL_Y, dy);
input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400);
input_sync(amimouse_dev);// ¿½±´µ½openÁ˵Äÿ¸öclientµÄclient->packets[16]»·Ðλº³åÇø,ÿ¸öÓ¦ÓóÌÐòÔÚµ÷ÓÃopen ʱ,mousedev_open¶¼»áµ÷ÓÃkzallocÀ´ÉêÇëÒ»¸ö¶ÀÁ¢µÄmousedev_client½á¹¹Ìå,È»ºó½«¸Ãclient¹Ò½Óµ½ mousedev->client_listÁ´±í,×îºóÓÉmousedev_notify_readersÏò mousedev->client_listÁ´±íÉϹҽӵÄÿ¸öclient¿½±´Êó±êÐÅÏ¢,×îºówake_up»½ÐÑread»òpoll.
============drivers\input\mousedev.c============
mousedev_read=>mousedev_packet=>Èç¹ûdx,dy,dzͬʱ¶¼Îª0,˵Ã÷Êó±êÍ£Ö¹ÁË,ÄÇôclient->ready = 0;
mousedev_event(dev, EV_SYN, SYN_REPORT, 0)=>mousedev_notify_readers=>Èç¹ûdx,dy,dzÓÐÒ»¸ö·¢ÉúÁËÒƶ¯»òÕßÊó±ê°´¼üÉÏÒ»´ÎµÄ°´¼ü²»Í¬,ÄÇôclient->ready = 1;¿½±´Êý¾Ýµ½mousedev->client_listÁ´±íÉϹҽӵÄÿ¸öclientµÄ»·Ðλº³åÇø,×îºóµ÷ÓÃwake_up_interruptible(&mousedev->wait);»½ÐÑÒòΪread»òÕßpoll²Ù×÷¶ø±»pendingסµÄÓ¦Ó