LinuxϵÄÊó±ê²Ù×÷
±¾²»ÏëдÕâЩÍæÒâ¶ù£¬ÆäʵÎÒ²¢²»Ï²»¶ËüÃÇ£¬Ö»²»¹ýû°ì·¨£¬Ë½ÐÎÒÊÇ¿¿ÕâЩ¼Ò»ïºý¿ÚµÄÄØ£¡
Èô¸ÉÄêÇ°£¬ÎÒ×ÔÈÏΪºÜϲ»¶Linux£»Èô¸ÉÄêºó£¬ÎÒ·¢ÏÖÎÒµ±³õÊǺεȵÄÌìÕæ¡£
¶÷£¬Ò»·ÖÇ®£¬Ò»·Ö»õ£¡ÎÒ¼áÐÅÕâÒ»µã£¡ËùÒÔÎÒÏÖÔÚ¼á³ÖÓÃMSµÄVista£¬Õý°æµÄŶ£¡
ÑÔ¹éÕý´«£¬Ç°¶Îʱ¼äÒòΪ¹¤×÷£¬ÐèÒªÔÚLinuxϲÙ×÷Êó±ê£¬µ±È»À²£¬¿Ï¶¨²»»áÊÇÔÚX-windowϲÙ×÷£¬ÄÇÑùµÄ»°Ò²¾Í²»»áÓÐÕâƪÎÄÕµĴæÔÚÁË¡£ÎÒÒª×öµÄ¾ÍÊÇÔÚConsoleÏÂÃæµÃµ½Êó±êµÄ×ø±ê¡£°Ù¶È¡¢¹È¸è¶¼ÓÃÉÏÁË£¬¿É¾ÍÊÇÕÒ²»µ½Ïà¹ØµÄ×ÊÁÏ¡£ÎÞÄÎ֮ϣ¬Ö»ÄÜÄÃÆðLinuxµÄÄں˿дúÂëÁË¡£ÏÂÃæÊÇÕâ¶Îʱ¼äµÄ³É¹û£º
1. ¹ØÓÚ"/dev/input/mice"
ÏàÐźܶàÈ˶¼ÓùýLinux£¬Ò²ÐíÄã·¢ÏÖ²»¹ÜÊÇÔÚX-windowÏÂÃ棬»¹ÊÇÔÚConsoleÏÂÃ棬Êó±ê¶¼ÊÇ¿ÉÒÔ²Ù×÷µÄ¡£ÄÇôÄãÓÐûÓп¼ÂǹýÕâЩÊó±ê¶¼ÊÇ´ÓÄÄÀ´µÄ£¿
²»´í£¡ËûÃǶ¼ÊÇ´Ó"/dev/input/mice"Õâ¸öÎļþÀïÀ´µÄ¡£Èç¹ûÄã¶ÔLinux±È½ÏÊ죬ÄÇôÄã¿Ï¶¨¿´µÃ³öÀ´ÕâÊÇÒ»¸öÉ豸Îļþ¡£"mice"¾ÍÊÇLinuxÏÂÃæÊó±êµÄÉ豸Îļþ£¬²»¹ÜÄãÓõÄÊÇPS2µÄ»¹ÊÇUSBµÄ£¬ËùÓйØÓÚÊó±êµÄ²Ù×÷¶¼±»³éÏóµ½"mice"Õâ¸öÎļþÖС£
2. "mice"֮ĸ
"mice"֮ĸÊÇË£¿female mouse? µ±È»²»ÊÇ£¡ÔÚlinuxÏÂÃ棬ËýÊÇ"mousedev.c"Õâ¸öÎļþ¡£Äã¿ÉÒÔÔÚÄں˵Ä"Drivers/input"Ŀ¼ÀïÕÒµ½Ëý¡£ÔÚËýÄÇÀÄã¿ÉÒԵõ½¹ØÓÚ"mice"µÄÒ»ÇС£µ«ÊÇÎÒÏë99%µÄÈ˶ÔÓÚ"mice"ËûÂèµ½µ×ÊǸÉÂïµÄÊDz»»á¸ÐÐËȤµÄ¡£ËùÒÔÎҾͲ»·Ï»°ÁË¡£Èç¹ûÄãÓÐÐËȤ£¬¿É×ÔÐзÔÄ¡£
3. ×ø±ê
ÈçºÎµÃµ½mouseµÄµ±Ç°×ø±êÖµ£¿¿Éͨ¹ýÈçϼ¸²½£º
1£©´ò¿ª"/dev/input/mice"Îļþ¡£
2£©¶Á3¸ö×Ö½Ú¡£Èý¸ö×Ö½ÚµÄÖµ·Ö±ðÊÇ“ButtonÀàÐÍ”£¬“XµÄÏà¶ÔλÒÆ”£¬“YµÄÏà¶ÔλÒÆ”¡£ÕâÀïÏÈÓÃButton, xRel, yRel±íʾ¡£
3£©È¡ButtonµÄµÍ3루Button & 0x07£©¡£0x00 = LeftButtonUp, 0x01 = LeftButtonDown, 0x02 = RightButtonDown.
4£©ÒòΪÕâÀïÈ¡µÃÊÇÏà¶ÔλÒÆ£¬ËùÒÔX, YÒª·Ö±ðÓëÉÏÒ»´ÎµÄ×ø±êÖµÏà¼Ó¡£xPos += xRel; yPos +=yRel.
ºÃÁË£¬µ½ÕâÀïÍê³ÉÁËÒ»´Î¶ÁÈ¡²Ù×÷¡£¾ßÌåµÄ´úÂëÇë²Î¼û¸½Â¼Ò»¡£¸½Â¼¶þ½éÉÜÒ»ÏÂgpm¡£
ÎÒºÜÆæ¹ÖΪʲôÔÚÍøÉÏÕÒ²»µ½Õâ·½ÃæµÄ×ÊÁÏ£¬¹ØÓÚgpmµÄ×ÊÁÏÒ²ÊÇÁÈÁÈÎÞ¼¸¡£
¸½Â¼Ò»£º
#include
#include
#include
#include
#include
#include
#include
int main()
{
int fd, retval;
char buf[6];
fd_set readfds;
struct timeval tv;
fd = open("/dev/input/mice", O_RDONLY);
if(!fd)
{
printf("Failed to open \"/dev/input/mice\"\n");
re
Ïà¹ØÎĵµ£º
sourceÃüÁîÓ÷¨£º
source FileName
×÷ÓÃ:ÔÚµ±Ç°bash»·¾³Ï¶ÁÈ¡²¢Ö´ÐÐFileNameÖеÄÃüÁî¡£
×¢£º¸ÃÃüÁîͨ³£ÓÃÃüÁî“.”À´Ìæ´ú¡£
È磺source .bash_rc Óë . .bash_rc ÊǵÈЧµÄ¡£
sourceÃüÁî(´Ó C Shell ¶øÀ´)ÊÇbash shellµÄÄÚÖÃÃüÁî¡£µãÃüÁ¾ÍÊǸöµã·ûºÅ£¬(´ÓBourne Shell¶øÀ´)ÊÇsourceµÄÁíÒ»Ãû³Æ¡£Í¬Ñùµ ......
1¡¢ һЩͷÎļþµÄ×÷Óãº
<assert.h>£ºANSI C¡£Ìṩ¶ÏÑÔ£¬assert(±í´ïʽ)
<glib.h>£ºGCC¡£GTK£¬GNOMEµÄ»ù´¡¿â£¬ÌṩºÜ¶àÓÐÓõĺ¯Êý£¬ÈçÓÐÊý¾Ý½á¹¹²Ù×÷º¯Êý¡£Ê¹ÓÃglibÖ»ÐèÒª°üº¬<glib.h>
<dirent.h>£ºGCC¡£Îļþ¼Ð²Ù×÷º¯Êý¡£struct dirent,struct DIR,opendir(),closedir(),readdir(),readdi ......
ÔÚLinux
ÖÐͨ¹ýlocale
À´ÉèÖóÌÐòÔËÐеIJ»Í¬ÓïÑÔ»·¾³£¬locale
ÓÉANSI C
Ìṩ֧³Ö¡£locale
µÄÃüÃû¹æÔòΪ<
ÓïÑÔ>_<
µØÇø>.<
×Ö·û¼¯±àÂë>
£¬Èçzh_CN.UTF-8
£¬zh
´ú±íÖÐÎÄ£¬CN
´ú±í´ó½µØÇø£¬UTF-8
±íʾ×Ö·û¼¯¡£ÔÚlocale
»·¾³ÖУ¬ÓÐÒ»×é±äÁ¿£¬´ú±í¹ú¼Ê»¯»·¾³ÖеIJ»Í¬ÉèÖãº
1. & ......
Linux MakefileÎļþµÄ½éÉÜ
1. Makefile½éÉÜ
×¢ÒâÊÇ“Makefile”£¬µÚÒ»¸ö×Öĸ´óд£¬ÆäÓàµÄ¶¼ÊÇСд¡£Makefile¹Øϵµ½ÁËÕû¸ö¹¤³ÌµÄ±àÒë¹æÔò£¬Ò»¸ö¹¤³ÌÖеÄÔ´Îļþ²»¼ÆÊý£¬Æä°´ÀàÐÍ¡¢¹¦ÄÜ¡¢Ä£¿é·Ö±ð·ÅÔÚÈô¸É¸öĿ¼ÖУ¬Makefile¶¨ÒåÁËһϵÁеĹæÔòÀ´Ö¸¶¨£¬ÄÄЩÎļþÐèÒªÏȱàÒ룬 ......
1. ¹ØÓÚ/etc/host£¬Ö÷»úÃûºÍIPÅäÖÃÎļþ
Hosts - The static table lookup for host name£¨Ö÷»úÃû²éѯ¾²Ì¬±í£©
Linux µÄ/etc/hostsÊÇÅäÖÃipµØÖ·ºÍÆä¶ÔÓ¦Ö÷»úÃûµÄÎļþ£¬ÕâÀï¿ÉÒԼǼ±¾»úµÄ»òÆäËûÖ÷»úµÄip¼°Æä¶ÔÓ¦Ö÷»úÃû¡£²»Í¬µÄlinux°æ±¾£¬Õâ¸öÅäÖÃÎļþÒ²¿ÉÄܲ»Í¬¡£±ÈÈçDebianµÄ¶ÔÓ¦ÎļþÊÇ/etc/hostname¡£
2. ÅäÖÃÎļþ ......