ʵս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µÈÐÒ鶼ÊÇÈí¼þÐÎʽÌá³öµÄ£¨BluezÖÐÊÇÒÔkernel²ã³ÌÐò)¡£ÔÚModuleÕâÒ»¶Ë£ºLink Manager, BB, µÈÐÒ鶼ÊÇÓ²¼þÖÐfirmwareÌṩµÄ¡£
¶øHCIÔò±È½ÏÌØÊ⣬ËüÒ»²¿·ÖÔÚÈí¼þÖÐʵÏÖ£¬ÓÃÀ´¸øÉϲãÐÒéºÍ³ÌÐòÌṩ·ÃÎʽӿڣ¨BluezÖÐ,hci.c hci_usb.c£¬hci_sock.cµÈ£©.ÁíÒ»²¿·ÖÒ²ÊÇÔÚFirmwareÖÐʵÏÖ£¬ÓÃÀ´½«Èí¼þ²¿·ÖµÄÖ¸ÁîµÈÓõײãÐÒéÃ÷°×µÄ·½Ê½´«µÝ¸øµ×²ã¡£
¾ÓÓÚPCµÄÉϲã³ÌÐòÓëÐÒéºÍ¾ÓÓÚModulesµÄϲãÐÒéÖ®¼äͨ¹ýHCI¹µÍ¨£¬ÓÐ4ÖÖ²»Í¬ÐÎʽµÄ´«Ê䣺Commands, Event, ACL Data, SCO/eSCO Data¡£
1.1. HCI Command£º
HCI CommandÊÇHostÏòModules·¢ËÍÃüÁîµÄÒ»ÖÖ·½Ê½¡£HCI Command Packet½á¹¹ÈçÏ£º
OpCodeÓÃÀ´Î¨Ò»±êʶHCI Command.ËüÓÉ2²¿·Ö×é³É£¬10bitµÄOpcode Command. 6bitµÄOpcode Group¡£
1.1.1: OpCode Group:
Linux Kernel£¨BlueZ£©ÖУ¬~/include/net/bluetooth/hci.hÖж¨ÒåÁËOpCode Group¡£
#define OGF_LINK_CTL 0x01
#define OGF_LINK_POLICY 0x02
#define OGF_HOST_CTL 0x03
#define OGF_INFO_PARAM 0x04
#define OGF_STATUS_PARAM 0x05
ËüÃÇ´ú±íÁ˲»Í¬µÄCommand Group£º
OGF_LINK_CTL: Link control,Õâ¸öCommand GroupÖеÄCommandÔÊÐíHost¿ØÖÆÓëÆäËübluetooth device µÄÁ¬½Ó¡£
OGF_LINK_POLICY £ºLink Policy¡£Õâ¸öCommand GroupÖеÄCommandÔÊÐíµ÷ÕûLink Manager control.
OGF_HOST_CTL: Control and Baseband.
1.1.2: Opcode Command:
ÓÃÀ´ÔÚͬһ¸öGroupÄÚΨһʶ±ðCommand¡£~/include/net/bluetooth/hci.hÖж¨Òå¡£
1.2: HCI Event£º
ModulesÏòHost·¢ËÍһЩÐÅÏ¢£¬Ê¹ÓÃHCI Event¡£Event Packet½á¹¹ÈçÏ£º
HCI Event·Ö3ÖÖ£ºCommand complete Event, Command States Event£¬Command Subsequently Completend.
Command complete Event: Èç¹ûHost·¢Ë͵ÄCommand¿ÉÒÔÁ¢¿ÌÓнá¹û£¬Ôò»á·¢ËÍ´ËÀàEvent¡£Ò²¾ÍÊÇ˵£¬Èç¹û·¢Ë͵ÄCommandÖ»Óë±¾µØModulesÓйأ¬²»ÓëremoteÉ豸´ò½»µÀ£¬ÔòʹÓÃCommand complete Event¡£ÀýÈ磺HCI_Read_Buffer_Size.
Command States Event£ºÈç¹ûHost·¢ËÍ
Ïà¹ØÎĵµ£º
×¼±¸¹¤×÷:
¡¡¡¡Óõ½µÄperl À©Õ¹×é¼þ(modules)ÔÚÉÏƪÌù³ö.( win32::odbc Ä£¿é
)ÏÂÔØ×é¼þºó°´ÕÕReadmeÎļþ°²×°µ¹ÏìӦĿ¼.ÅäÖúÃÏàÓ¦µÄodbcÊý¾ÝÔ´.
¡¡¡¡
¡¡¡¡³ÌÐòʵÏÖ:
¡¡¡¡Ê¹ÓÃ
¡¡¡¡use
Win32::ODBC;
¡¡¡¡
¡¡¡¡Óï¾ä°üº¬Ó¦Ê¹ÓõÄÄ£¿éÊÇwin32::odbc,д³öÊý¾Ý¿â
Á¬½Ó×Ö·û´®
¡¡¡¡
¡¡¡¡$DSN = "DSN =
My DSN ......
redhat linux ÏÂFTPÅäÖá£(vsftp)
1.Æô¶¯vsftp£º /sbin/service vsftpd start ±¸×¢d´ú±íÔÙºǫ́Æô¶¯¡£
2.²é¿´ÊÇ·ñÆô¶¯£¬¾ÍµÇ½µ½FTPÊÔÊÔ¡£ µÇ½FTP£ºftp localhost Í˳öFTP£ºbye
3.²é¿´Linux IP £ºifconfig
ÔÚ¿ØÖƹÜÀį́Ï¿ɿ´¼ûÈçÏ´úÂ룺¿ÉÒÔ¿´³ö£¬IP Address ÊÇ£º192.168.0.128
4.Èç¹û¾ÖÓòÍ ......
×ܽ᣺
zhy2111314
À´×Ô£º
LinuxSir.Org
ÕûÀí£º
±±ÄÏÄϱ±
ͻ񻣼
±¾ÎÄÊÇfind ÃüÁîµÄÏêϸ˵Ã÷£¬¿É¹óµÄÊÇÕë¶Ô²ÎÊý¾ÙÁ˺ܶàµÄʵÀý£¬´óÁ¿µÄÀýÖ¤£¬ÈóõѧÕ߸üΪÈÝÒ×Àí½â£»±¾ÎÄÊÇzhyflyÐÖÌùÔÚÂÛ̳ÖУ»ÎÒ¶Ô±¾ÎĽøÐÐÁËÔÙ´ÎÕûÀí£¬Îª·½±ã´ó¼ÒÔĶÁ£»
Ŀ¼
°æȨÉùÃ÷
Ç°ÑÔ£º¹ØÓÚfindÃüÁî
Ò»¡¢find ÃüÁî¸ñʽ
1¡¢findÃüÁîµÄÒ» ......
ѧµÄ¿ìÍüµÄÒ²¿ì£¬ºÃ£¬°ÑËü¼ÇÏÂÀ´¡£
(Ò») Óû§
1. ×÷ΪrootµÇ¼
2. ¸øÄãÒªÌí¼ÓµÄÓû§ÉèÖÃÓû§Ä¿Â¼£¬ mkdir /home/yang
3. useradd yang -g users -G 100 -d /home/yang
-->Ö¸¶¨×éÓà -g£¬Òª²é¿´ÏµÍ³Ä¿Ç°ÓÐÄÄЩ×飬¿ÉÒÔ cat /etc/group
-->Èç¹û²»ÉèÖà -g, -d useradd½«Ê¹Óà /etc/default/useradd ½Å±¾Ö¸¶¨µÄ ......
Ç°Ãæ½²ÁËʹÓà ioctl·¢ËÍHCI CommandµÄ·½·¨¡£µ«HCI protocol»¹ÓÐһЩCommand£¬±ÈÈçInquiryµÈ£¬ËûÃÇÔò²»ÐèҪʹÓÃioctlÀ´·¢ËÍ¡£blueZ Ö±½ÓÌṩÁËÖ§³Ö£¬ËäÈ»ËûÃǵÄ×îÖÕ¶¼ÊÇÓÃͬÑù°ì·¨ÊµÏֵġ£
ÔÚÓ¦ÓóÌÐòÖУº
hci_inquiry(dev_id, length, num_rsp, NULL, &info, flags);
ÕâÑùÐèÒª°üº¬blueZ Í·ÎļþÈçÏ£º
#include //BT ......