Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linuxÇý¶¯Ñ§Ï°

Ò»¡¢ioctl
´ó²¿·ÖÉ豸³ýÁ˶ÁдÄÜÁ¦£¬»¹¿É½øÐг¬³ö¼òµ¥µÄÊý¾Ý´«ÊäÖ®ÍâµÄ²Ù×÷£¬ËùÒÔÉ豸Çý¶¯Ò²±ØÐë¾ß±¸½øÐи÷ÖÖÓ²¼þ¿ØÖƲÙ×÷µÄÄÜÁ¦. ÕâЩ²Ù×÷³£³£Í¨¹ý ioctl ·½·¨À´Ö§³Ö£¬ËüÓкÍÓû§¿Õ¼ä°æ±¾²»Í¬µÄÔ­ÐÍ:
int (*ioctl) (struct inode *inode, struct file *filp,
              unsigned int cmd, unsigned long arg);
ÐèҪעÒâµÄÊÇ£º²»¹Ü¿ÉÑ¡µÄ²ÎÊýargÊÇ·ñÓÉÓû§¸ø¶¨ÎªÒ»¸öÕûÊý»òÒ»¸öÖ¸Õ룬Ëü¶¼ÒÔÒ»¸öunsigned longµÄÐÎʽ´«µÝ¡£Èç¹ûµ÷ÓóÌÐò²»´«µÝarg²ÎÊý, ±»Çý¶¯ÊÕµ½µÄ arg ÖµÊÇ䶨ÒåµÄ¡£ÒòΪÔÚarg²ÎÊýÉϵÄÀàÐͼì²é±»¹Ø±ÕÁË,ËùÒÔÈôÒ»¸ö·Ç·¨²ÎÊý´«µÝ¸ø ioctl£¬±àÒëÆ÷ÊÇÎÞ·¨±¨¾¯µÄ£¬ÇÒÈκιØÁªµÄ´íÎóÄÑÒÔ²éÕÒ.
Ñ¡ÔñioctlÃüÁî
ΪÁË·ÀÖ¹Ïò´íÎóµÄÉ豸ʹÓÃÕýÈ·µÄÃüÁÃüÁîºÅÓ¦¸ÃÔÚϵͳ·¶Î§ÄÚΨһ¡£Îª·½±ã³ÌÐòÔ±´´½¨Î¨Ò»µÄ ioctl ÃüÁî´úºÅ£¬ ÿ¸öÃüÁîºÅ±»»®·ÖΪ¶à¸öλ×ֶΡ£Òª°´ Linux Äں˵ÄÔ¼¶¨·½·¨ÎªÇý¶¯Ñ¡Ôñ ioctl µÄÃüÁîºÅ, Ó¦¸ÃÊ×ÏÈ¿´¿´ include/asm/ioctl.h ºÍ Documentation/ioctl-number.txt¡£ ҪʹÓõÄλ×ֶηûºÅ¶¨ÒåÔÚ <linux/ioctl.h> :
type(»ÃÊý)£º8 λ¿í(_IOC_TYPEBITS)£¬²Î¿¼ioctl-number.txtÑ¡ÔñÒ»¸öÊý£¬²¢ÔÚÕû¸öÇý¶¯ÖÐʹÓÃËü¡£
number£¨ÐòÊý£©£ºË³Ðò±àºÅ£¬8 λ¿í(_IOC_NRBITS)¡£
direction£¨Êý¾Ý´«Ë͵ķ½Ïò£©£º¿ÉÄܵÄÖµÊÇ _IOC_NONE(ûÓÐÊý¾Ý´«Êä)¡¢_IOC_READ¡¢ _IOC_WRITEºÍ _IOC_READ|_IOC_WRITE (Ë«Ïò´«ÊäÊý¾Ý)¡£¸Ã×Ö¶ÎÊÇÒ»¸öλÑÚÂ루Á½Î»£©, Òò´Ë¿ÉʹÓà AND ²Ù×÷À´³éÈ¡_IOC_READ ºÍ _IOC_WRITE¡£
size£¨Êý¾ÝµÄ´óС£©£º¿í¶ÈÓëÌåϵ½á¹¹ÓйØ,ARMΪ14λ.¿ÉÔÚºê _IOC_SIZEBITS ÖÐÕÒµ½Ìض¨ÌåϵµÄÖµ. 
 <linux/ioctl.h> Öаüº¬µÄ <asm/ioctl.h>¶¨ÒåÁËһЩ¹¹ÔìÃüÁî±àºÅµÄºê:
_IO(type,nr)/*ûÓвÎÊýµÄÃüÁî*/
_IOR(type, nr, datatype)/*´ÓÇý¶¯ÖжÁÊý¾Ý*/
_IOW(type,nr,datatype)/*дÊý¾Ý*/
_IOWR(type,nr,datatype)/*Ë«Ïò´«ËÍ*/
/*type ºÍ number ³ÉÔ±×÷Ϊ²ÎÊý±»´«µÝ, ²¢ÇÒ size ³ÉԱͨ¹ýÓ¦Óà sizeof µ½ datatype ²ÎÊý¶øµÃµ½*/
Õâ¸öÍ·Îļþ»¹¶¨ÒåÁËÓÃÀ´½â¿ªÕâ¸ö×ֶεĺê:
_IOC_DIR(nr)
_IOC_TYPE(nr)
_IOC_NR(nr)
_IOC_SIZE(nr)
¾ßÌåµÄʹÓ÷½·¨ÔÚʵÑéÖÐչʾ¡£
·µ»ØÖµ
POSIX ±ê×¼¹æ¶¨£ºÈç¹ûʹÓÃÁ˲»ºÏÊ浀 ioctl ÃüÁîºÅ£¬Ó¦µ±·µ»Ø-ENOTTY ¡£Õâ¸ö´íÎóÂë±» C ¿â½âÊÍΪ"²»ºÏÊʵÄÉ豸 ioctl¡£È»¶ø£¬Ëü·µ»Ø-EINVALÈÔÊ


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨Èý£© HCI²ã±à³Ì

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 Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

[תÌû]LinuxÇý¶¯¿ª·¢Ñ§Ï°µÄһЩ±ØÒª²½Öè

 1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......

LinuxϵͳÐÅÏ¢²é¿´ÃüÁî´óÈ«

ϵͳ
# uname -a # ²é¿´ÄÚºË/²Ù×÷ϵͳ/CPUÐÅÏ¢
# head -n 1 /etc/issue # ²é¿´²Ù×÷ϵͳ°æ±¾
# cat /proc/cpuinfo # ²é¿´CPUÐÅÏ¢
# hostname # ²é¿´¼ÆËã»úÃû
# lspci -tv # ÁгöËùÓÐPCIÉ豸
# lsusb -tv # ÁгöËùÓÐUSBÉ豸
# lsmod # ......

linuxÏÂÓÃphpize¸øPHP¶¯Ì¬Ìí¼ÓÀ©Õ¹

ʹÓÃphpµÄ³£¼ûÎÊÌâÊÇ£º±àÒëphpʱÍü¼ÇÌí¼ÓijÀ©Õ¹£¬ºóÀ´ÏëÌí¼ÓÀ©Õ¹£¬µ«ÊÇÒòΪ°²×°phpºóÓÖ×°ÁËһЩ¶«Î÷ÈçPEARµÈ£¬²»Ïëɾ³ýĿ¼ÖØ×°£¬±ð˵£¬php»¹ÕæÓÐÕâÑùµÄ¹¦ÄÜ¡£
¡¡¡¡ÎÒûÓÐÔÚÊÖ²áÖп´µ½¡£
¡¡¡¡ÈçÎÒÏëÔö¼ÓbcmathÖ§³Ö£¬ÕâÊÇÒ»¸öÖ§³Ö´óÕûÊý¼ÆËãµÄÀ©Õ¹¡£windows×Ô´ø¶øÇÒÄÚÖã¬linux“±¾ÀຯÊý½öÔÚ PHP ±àÒëʱÅäÖÃÁË --ena ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ