⑴ 易語言後台模擬滑鼠、鍵盤的模塊或者源碼
不能用是因為人家游戲用API把你的模擬按鍵功能和諧了...解決方法:網路 易語言 驅動鍵盤模擬(其實驅動級的模擬就是直接模擬你滑鼠和鍵盤的操作,自然也無法和諧....超級模塊里有不同的模擬按鍵方式,你也可以一個個的試過去-_-!)
⑵ 濡備綍鍐欎竴涓獮ndroid USB鎺ュ彛椹卞姩
璇村埌 android 椹卞姩鏄紱諱笉寮 linux 椹卞姩鐨勩侫ndroid 鍐呮牳閲囩敤鐨勬槸 Linux2.6 鍐呮牳 錛堟渶榪慙inux 3.3 宸茬粡鍖呭惈浜嗕竴浜 Android 浠g爜錛夈備絾 Android 騫舵病鏈夊畬鍏ㄧ収鎼 Linux 緋葷粺鍐呮牳錛岄櫎浜嗗筁inux 榪涜岄儴鍒嗕慨姝o紝榪樺炲姞浜嗕笉灝戝唴瀹廣俛ndroid 椹卞姩 涓昏佸垎涓ょ嶇被鍨嬶細Android 涓撶敤椹卞姩 鍜 Android 浣跨敤鐨勮懼囬┍鍔錛坙inux錛夈
Android 涓撴湁椹卞姩紼嬪簭錛
1錛堿ndroid Ashmem 鍖垮悕鍏變韓鍐呭瓨錛 涓虹敤鎴風┖闂寸▼搴忔彁渚涘垎閰嶅唴瀛樼殑鏈哄埗錛屼負榪涚▼闂存彁渚涘ぇ鍧楀叡浜鍐呭瓨錛屽悓鏃朵負鍐呮牳鎻愪緵鍥炴敹鍜岀$悊榪欎釜鍐呭瓨銆
2錛堿ndroid Logger 杞婚噺綰х殑LOG錛堟棩蹇楋級 椹卞姩錛
3錛堿ndroid Binder 鍩轟簬 OpenBinder 妗嗘灦鐨勪竴涓椹卞姩錛
4錛堿ndroid Power Management 鐢墊簮綆$悊妯″潡錛
5錛塋ow Memory Killer 浣庡唴瀛樼$悊鍣錛
6錛堿ndroid PMEM 鐗╃悊鍐呭瓨椹卞姩錛
7錛塙SB Gadget USB 椹卞姩錛堝熀浜 gaeget 妗嗘灦錛夛紱
8錛塕am Console 鐢ㄤ簬璋冭瘯鍐欏叆鏃ュ織淇℃伅鐨勮懼囷紱
9錛塗ime Device 瀹氭椂鎺у埗璁懼囷紱
10錛堿ndroid Alarm 紜浠舵椂閽燂紱
Android 涓婄殑璁懼囬┍鍔錛
1錛塅ramebuff 鏄劇ず椹卞姩錛
2錛塃vent 杈撳叆璁懼囬┍鍔錛
3錛堿LSA 闊抽戦┍鍔錛
4錛塐SS 闊抽戦┍鍔錛
5錛塿412鎽勫儚澶達細瑙嗛戦┍鍔錛
6錛塎TD 椹卞姩錛
7錛夎摑鐗欓┍鍔錛
8錛塛LAN 璁懼囬┍鍔錛
Android 涓撴湁椹卞姩紼嬪簭
1.Android Ashmem
涓虹敤鎴風┖闂寸▼搴忔彁渚涘垎閰嶅唴瀛樼殑鏈哄埗錛屼負榪涚▼闂存彁渚涘ぇ鍧楀叡浜鍐呭瓨錛屽悓鏃朵負鍐呮牳鎻愪緵鍥炴敹鍜岀$悊榪欎釜鍐呭瓨銆
璁懼囪妭鐐癸細/dev/ashmen .涓昏懼囧彿 10.
婧愮爜浣嶇疆錛 include/linux/ashmen.h Kernel /mm/ashmen.c
鐩告瘮浜 malloc 鍜 anonymous/named mmap 絳変紶緇熺殑鍐呭瓨鍒嗛厤鏈哄埗錛屽叾浼樺娍鏄閫氳繃鍐呮牳椹卞姩鎻愪緵浜嗚緟鍔╁唴鏍哥殑鍐呭瓨鍥炴敹綆楁硶鏈哄埗錛坧in/unoin錛
2.Android Logger
鏃犺烘槸搴曞眰鐨勬簮浠g爜榪樹笂灞傜殑搴旂敤錛屾垜浠閮藉彲浠ヤ嬌鐢 logger 榪欎釜鏃ュ織璁懼囩湅銆佹潵榪涜岃皟璇曘
璁懼囪妭鐐癸細 /dev/log/main /dev/log/event /dev/log/radio
婧愮爜浣嶇疆錛歩nclude/linux/logger.h include/linux/logger.c
3.Android Binder
IPC Binder 涓縐嶈繘紼嬮棿閫氫俊鏈哄埗銆備粬鐨勮繘紼嬭兘澶熶負鍏跺畠榪涚▼鎻愪緵鏈嶅姟 ----- 閫氳繃鏍囧噯鐨 Linux 緋葷粺璋冪敤 API銆
璁懼囪妭鐐 錛/dev/binder
婧愮爜浣嶇疆錛欿ernel/include/linux/binder.h Kernel/drivers/misc/binder.c
4.Android Power Management
涓涓鍩轟簬鏍囧噯 linux 鐢墊簮綆$悊鐨勮交閲忕駭 Android 鐢墊簮綆$悊緋葷粺錛屽湪 drivers/android/power.c kernel/power/
5.Low Memory Killer
瀹冨湪鐢ㄦ埛絀洪棿涓鎸囧畾浜嗕竴緇勫唴瀛樹復鐣屽礆紝褰撳叾涓鏌愪釜鍊間笌榪涚▼鎻忚堪涓鐨 oom_adj 鍊煎湪鍚屼竴鑼冨洿鏃訛紝璇ヨ繘紼嬪皢琚獽ill鎺夛紙鍦╬arameters/adj涓鎸囧畾oome_adj 鐨勬渶灝忓礆級銆傚畠涓庢爣鍑嗙殑Linux OOM鏈哄埗綾諱技錛屽彧鏄瀹炵幇鏂規硶涓嶅悓
婧愮爜浣嶇疆錛歞rivers/misc/lowmemorykiller.c
6.Android PMEM
PMEM 涓昏佷綔鐢ㄥ氨鏄鍚戠敤鎴風┖闂存彁渚涜繛緇鐨勭墿鐞嗗唴瀛樺尯鍩熴
1.璁 GPU 鎴 VPU 緙撳啿鍖哄叡浜 CPU 鏍稿績銆
2.鐢ㄤ簬 Android service 鍫嗐
婧愮爜浣嶇疆錛歩nclude/linux/android_pmem.h drivers/android/pmem.c
7.USB Gadget
鍩轟簬鏍囧噯 Linux USB gaeget 椹卞姩妗嗘灦鐨勮懼囬┍鍔ㄣ
婧愮爜浣嶇疆錛歞rivers/usb/gadet/
8.Ram Console
涓轟簡鎻愪緵璋冭瘯鍔熻兘錛宎ndroid 鍏佽稿皢璋冭瘯鏃ュ織淇℃伅鍐欏叆榪欎釜璁懼囷紝瀹冩槸鍩轟簬 RAM 鐨 buffer.
婧愮爜浣嶇疆錛 drivers/staging/android/ram_console.c
9.Time Device
瀹氭椂鎺у埗,鎻愪緵浜嗗硅懼囪繘琛屽畾鏃舵帶鍒剁殑鍔熻兘銆
婧愮爜浣嶇疆錛歞rivers/staging/android/timed_output.c(timed_gpio.c)
10.Android Alarm
鎻愪緵涓涓瀹氭椂鍣錛岀敤浜庢妸璁懼囦粠鐫$湢鐘舵佸敜閱掞紝鍚屾椂瀹冭繕鎻愪緵浜嗕竴涓鍗充嬌鍦ㄨ懼囩潯鐪犳椂涔熶細榪愯岀殑鏃墮挓鍩哄噯銆
璁懼囪妭鐐癸細/dev/alarm
婧愮爜浣嶇疆錛歞rivers/trc/alarm.c
Android 璁懼囬┍鍔
1. Framebuffer 甯х紦瀛樿懼
Framebuffer 椹卞姩鍦 Linux 涓鏄鏍囧噯鐨勬樉紺鴻懼囩殑椹卞姩銆傚逛簬 PC 緋葷粺錛屽畠鏄鏄懼崱鐨勯┍鍔 錛 瀵逛簬宓屽叆寮 SOC 澶勭悊鍣ㄧ郴緇燂紝瀹冩槸 LCD 鎺у埗鍣ㄦ垨鑰呭叾浠栨樉紺烘帶鍒跺櫒鐨勯┍鍔ㄣ傚畠鏄涓涓瀛楃﹁懼囷紝鍦ㄦ枃浠剁郴緇熶腑璁懼囪妭鐐歸氬父鏄 /dev/fbx 銆 姣忎釜緋葷粺鍙浠ユ湁澶氫釜鏄劇ず璁懼 錛 渚濇$敤 /dev/fbO 銆 /dev/fb l
絳夋潵琛ㄧず銆傚湪 Android 緋葷粺涓涓昏懼囧彿涓 29 錛屾¤懼囧彿閫掑炵敓鎴愩
Android 瀵 Framebuffer 椹卞姩鐨勪嬌鐢ㄦ柟寮忔槸鏍囧噯鐨 錛 鍦 / dev / graphie / 涓鐨 Framebuffer 璁懼囪妭鐐圭敱 init 榪涚▼鑷鍔ㄥ壋寤 錛 琚 libui 搴撹皟鐢 銆 Android 鐨 GUI 緋葷粺涓 錛 閫氳繃璋冪敤 Framebuffer 椹卞姩鐨勬爣鍑嗘帴鍙o紝瀹炵幇鏄劇ず璁懼囩殑鎶借薄銆
Framebuff鐨勭粨鏋勬嗘灦鍜屽疄鐜 錛
linux LCD椹卞姩錛堜簩錛--FrameBuffer
Linux LCD椹卞姩(鍥涳級--椹卞姩鐨勫疄鐜
2.Event杈撳叆璁懼囬┍鍔
Input 椹卞姩紼嬪簭鏄 Linux 杈撳叆璁懼囩殑椹卞姩紼嬪簭 錛 鍒嗕負娓告垙鏉 (joystick) 銆 榧犳爣 (mouse 鍜 mice)鍜屼簨浠惰懼 (Event queue)3 縐嶉┍鍔ㄧ▼搴忋傚叾涓浜嬩歡椹卞姩紼嬪簭鏄鐩鍓嶉氱敤鐨勭▼搴忥紝鍙鏀鎸侀敭鐩 銆 榧犳爣銆佽Е鎽稿睆絳夊氱嶈緭鍏ヨ懼囥 Input 椹卞姩紼嬪簭鐨勪富璁懼囧彿鏄 l3 錛屾瘡涓縐 Input 璁懼囦粠璁懼囧彿鍗 鐢5 浣 錛 3 縐嶄粠璁懼囧彿鍒嗛厤鏄 錛 娓告垙鏉 0 鍀 61 錛 Mouse 榧犳爣 33 鍀 62 錛 Mice 榧犳爣 63 錛 浜嬩歡璁懼 64 鍀 95 錛屽悇涓鍏蜂綋鐨勮懼囧湪 misc 銆 touchscreen 銆 keyboard 絳夌洰褰曚腑銆
Event 璁懼囧湪鐢ㄦ埛絀洪棶浣跨敤 read 銆 ioctl 銆 poll 絳夋枃浠剁郴緇熺殑鎺ュ彛鎿嶄綔錛 read 鐢ㄤ簬璇誨彇杈撳叆淇℃伅錛 ioctl 鐢ㄤ簬鑾峰彇鍜岃劇疆淇℃伅錛 poll 鐢ㄤ簬鐢ㄦ埛絀洪棿鐨勯樆濉烇紝褰撳唴鏍告湁鎸夐敭絳変腑鏂鏃訛紝閫氳繃鍦ㄤ腑鏂涓鍞ら啋鍐呮牳鐨 poll 瀹炵幇銆
Event 杈撳叆椹卞姩鐨勬灦鏋勫拰瀹炵幇錛
Linux璁懼囬┍鍔ㄤ箣鈥斺攊nput瀛愮郴緇
3.ALSA闊抽戦┍鍔
楂樼駭 Linux 澹伴煶浣撶郴 ALSA(Advanced Linux Sound Architecture ) 鏄涓洪煶棰戠郴緇熸彁渚涢┍鍔 鐨凩inux 鍐呮牳緇勪歡錛屼互鏇誇唬鍘熷厛鐨勫紑鍙戝0闊崇郴緇 OSS 銆傚畠鏄涓涓瀹屽叏寮鏀炬簮浠g爜鐨勯煶棰戦┍鍔ㄧ▼搴忛泦 錛岄櫎浜嗗儚 OSS 閭f牱鎻愪緵涓緇勫唴鏍擱┍鍔ㄧ▼搴忔ā鍧椾箣澶 錛 ALSA 榪樹笓闂ㄤ負綆鍖栧簲鐢ㄧ▼搴忕殑緙栧啓鎻愪緵鐩稿簲鐨勫嚱鏁板簱錛屼笌 OSS 鎻愪緵鐨勫熀浜 ioctl 絳夊師濮嬬紪紼嬫帴鍙g浉姣旓紝 ALSA 鍑芥暟搴撲嬌鐢ㄨ搗鏉ヨ佹洿鍔犳柟渚誇竴浜
鍒╃敤璇ュ嚱鏁板簱錛屽紑鍙戜漢鍛樺彲浠ユ柟渚褲佸揩鎹峰湴寮鍙戝嚭鑷宸辯殑搴旂敤紼嬪簭錛岀粏鑺傚垯鐣欑粰鍑芥暟搴撹繘琛屽唴閮ㄥ勭悊 銆 鎵浠ヨ櫧鐒 ALSA 涔熸彁渚涗簡綾諱技浜 OSS 鐨勭郴緇熸帴鍙 錛 浣嗗緩璁搴旂敤紼嬪簭寮鍙戣呬嬌鐢ㄩ煶棰戝嚱鏁板簱錛岃屼笉鏄鐩存帴璋冪敤椹卞姩鍑芥暟銆
ALSA 椹卞姩鐨勪富璁懼囧彿涓 116 錛屾¤懼囧彿鐢卞悇涓璁懼囧崟鐙瀹氫箟錛屼富瑕佺殑璁懼囪妭鐐瑰備笅錛
/ dev / snd / contmlCX 鈥斺 涓繪帶鍒 錛
/ dev / snd / pcmXXXc 鈥斺 PCM 鏁版嵁閫氶亾 錛
/ dev / snd / seq 鈥斺 欏哄簭鍣錛
/ dev / snd / timer 鈥斺 瀹氫箟鍣ㄣ
鍦ㄧ敤鎴風┖闂涓 錛 ALSA 椹卞姩閫氬父閰嶅悎 ALsA 搴撲嬌鐢 錛 搴撻氳繃 ioctl 絳夋帴鍙h皟鐢 ALSA 椹卞姩紼嬪簭鐨勮懼囪妭鐐廣傚逛簬 AIJSA 椹卞姩鐨勮皟鐢錛岃皟鐢ㄧ殑鏄鐢ㄦ埛絀洪棿鐨 ALsA 搴撶殑鎺ュ彛錛岃屼笉鏄鐩存帴璋冪敤 ALSA 椹卞姩紼嬪簭銆
ALSA 椹卞姩紼嬪簭鐨勪富瑕佸ご鏂囦歡鏄 include / sound ./ sound . h 錛岄┍鍔ㄦ牳蹇冩暟鎹緇撴瀯鍜屽叿浣撻┍鍔ㄧ殑娉ㄥ唽鍑芥暟鏄 include / sound / core . h 錛岄┍鍔ㄧ▼搴 鐨勬牳蹇冨疄鐜版槸 Sound / core / sound . c 鏂囦歡銆
ALSA 椹卞姩紼嬪簭浣跨敤涓嬮潰鐨勫嚱鏁版敞鍐屾帶鍒跺拰璁懼囷細
int snd _ pcm _ new (struct snd _ card * card 錛 char * id 錛 int device 錛 int playback _ count 錛 int capture _ count 錛 struct snd _ pcm ** rpcm) 錛
int snd ctl _ add(struct snd _ card * card 錛 struct snd _ kcontrol * kcontro1) 錛
ALSA 闊抽戦┍鍔ㄥ湪鍐呮牳榪涜 menuconfig 閰嶇疆鏃 錛 閰嶇疆閫夐」涓 鈥 Device Drivers 鈥 > 鈥 Sound c ard support 鈥 涓 > 鈥 Advanced Linux Sound Architecture 鈥 銆傚瓙閫夐」鍖呭惈浜 Generic sound devices( 閫氱敤澹伴煶璁懼 ) 銆 ARM 浣撶郴緇撴瀯鏀鎸侊紝浠ュ強鍏煎 OSS 鐨勫嚑涓閫夐」銆 ALsA 闊抽戦┍鍔ㄩ厤緗瀵瑰簲鐨勬枃浠舵槸sound / core / Kconfig 銆
Android 娌℃湁鐩存帴浣跨敤 ALSA 椹卞姩錛屽彲浠ュ熀浜 A-LSA 椹卞姩鍜 ALSA 搴撳疄鐜 Android Audio 鐨勭‖浠舵娊璞″眰錛 ALSA 搴撹皟鐢ㄥ唴鏍哥殑 ALSA 椹卞姩錛 Audio 鐨勭‖浠舵娊璞″眰璋冪敤 ALSA 搴撱
4.OSS闊抽戦┍鍔
OSS錛圤pen Sound System寮鏀懼0闊崇郴緇燂級鏄 linux 涓婃渶鏃╁嚭鐜扮殑澹板崱椹卞姩銆侽SS 鐢變竴濂楀畬鏁寸殑鍐呮牳椹卞姩紼嬪簭妯″潡緇勬垚錛屽彲浠ヤ負緇濆ぇ澶氭暟澹板崱鎻愪緵緇熶竴鐨勭紪紼嬫帴鍙c
OSS 鏄瀛楃﹁懼囷紝涓昏懼囧彿14錛屼富瑕佸寘鎷涓嬮潰鍑犵嶈懼囨枃浠訛細
1錛 /dev/sndstat
瀹冩槸澹板崱椹卞姩紼嬪簭鎻愪緵鐨勭畝鍗曟帴鍙o紝瀹冮氬父鏄涓涓鍙璇繪枃浠訛紝浣滅敤涔熷彧闄愪簬奼囨姤澹板崱鐨勫綋鍓嶇姸鎬併傦紙鐢ㄤ簬媯嫻嬪0鍗★級
2錛/dev/dsp
鐢ㄤ簬鏁板瓧閲囨牱鍜屾暟瀛楀綍闊崇殑璁懼囨枃浠躲傚逛簬闊抽戠紪紼嬪緢閲嶈併傚疄鐜版ā鎷熶俊鍙峰拰鏁板瓧淇″彿鐨勮漿鎹銆
3錛/dev/audio
綾諱技浜/dev/dsp錛屼嬌鐢ㄧ殑鏄 mu-law 緙栫爜鏂瑰紡銆
4錛/dev/mixer
鐢ㄤ簬澶氫釜淇″彿緇勫悎鎴栬呭彔鍔犲湪涓璧鳳紝瀵逛簬涓嶅悓鐨勫0鍗℃潵璇達紝鍏舵販闊沖櫒鐨勪綔鐢ㄥ彲鑳藉悇涓嶇浉鍚屻
5錛/dev/sequencer
榪欎釜璁懼囩敤鏉ュ瑰0鍗″唴寤虹殑娉㈣〃鍚堟垚鍣ㄨ繘琛屾搷浣滐紝鎴栬呭 MIDI 鎬葷嚎涓婄殑涔愬櫒榪涜屾帶鍒躲
OSS 椹卞姩鎵娑夊強鐨勬枃浠朵富瑕佸寘鎷錛
kernel/include/linux/soundcard.h
kernel/include/linux/sound.h 瀹氫箟 OSS 椹卞姩鐨勬¤懼囧彿鍜屾敞鍐屽嚱鏁
kernel/sound_core.c OSS鏍稿績瀹炵幇閮ㄥ垎
5.V4l2瑙嗛戦┍鍔
銆銆 V4L2鏄疺4L鐨勫崌綰х増鏈錛屼負linux涓嬭嗛戣懼囩▼搴忔彁渚涗簡涓濂楁帴鍙h勮寖銆傚寘鎷涓濂楁暟鎹緇撴瀯鍜屽簳灞俈4L2椹卞姩鎺ュ彛銆俈4L2鎻愪緵浜嗗緢澶氳塊棶鎺ュ彛錛屼綘鍙浠ユ牴鎹鍏蜂綋闇瑕侀夋嫨鎿嶄綔鏂規硶銆傞渶瑕佹敞鎰忕殑鏄錛屽緢灝戞湁椹卞姩瀹屽叏瀹炵幇浜嗘墍鏈夌殑鎺ュ彛鍔熻兘銆傛墍浠ュ湪浣跨敤鏃墮渶瑕佸弬鑰冮┍鍔ㄦ簮鐮侊紝鎴栦粩緇嗛槄璇婚┍鍔ㄦ彁渚涜呯殑浣跨敤璇存槑銆
V4L2鐨勪富璁懼囧彿鏄81錛屾¤懼囧彿錛0~255錛岃繖浜涙¤懼囧彿閲屼篃鏈夊ソ鍑犵嶈懼囷紙瑙嗛戣懼囥丷adio璁懼囥乀eletext銆乂BI錛夈
V4L2鐨勮懼囪妭鐐癸細 /dev/videoX, /dev/vbiX and /dev/radioX
Android 璁懼囬┍鍔錛堜笅錛
MTD 椹卞姩
Flash 椹卞姩閫氬父浣跨敤 MTD 錛坢emory technology device )錛屽唴瀛樻妧鏈璁懼囥
MTD 鐨勫瓧絎﹁懼囷細
/dev/mtdX
涓昏懼囧彿 90.
MTD 鐨勫潡璁懼囷細
/dev/block/mtdblockX
涓昏懼囧彿 13.
MTD 椹卞姩婧愮爜
drivers/mtd/mtdcore.c錛歁TD鏍稿績錛屽畾涔塎TD鍘熷嬭懼
drivers/mtd/mtdchar.c錛歁TD瀛楃﹁懼
drivers/mtd/mtdblock.c錛歁TD鍧楄懼
MTD 椹卞姩紼嬪簭鏄 Linux 涓嬩笓闂ㄤ負宓屽叆寮忕幆澧冨紑鍙戠殑鏂頒竴綾婚┍鍔ㄧ▼搴忋侺inux 涓嬬殑 MTD 椹卞姩紼嬪簭鎺ュ彛琚鍒掑垎涓虹敤鎴鋒ā鍧楀拰紜浠舵ā鍧楋細
鐢ㄦ埛妯″潡 鎻愪緵浠庣敤鎴風┖闂寸洿鎺ヤ嬌鐢ㄧ殑鎺ュ彛錛氬師濮嬪瓧絎﹁塊棶銆佸師濮嬪潡璁塊棶銆丗TL 錛團lash Transition Layer錛夊拰JFS錛圝ournaled File System錛夈
紜浠舵ā鍧 鎻愪緵鍐呭瓨璁懼囩殑鐗╃悊璁塊棶錛屼絾涓嶇洿鎺ヤ嬌鐢ㄥ畠浠錛屼簩鍗侀氳繃涓婅堪鐨勭敤鎴鋒ā鍧楁潵璁塊棶銆傝繖浜涙ā鍧楁彁渚涗簡闂瀛樹笂璇匯佸啓鍜屾摝闄ょ瓑鎿嶄綔鐨勫疄鐜般
钃濈墮椹卞姩
鍦 Linux 涓錛岃摑鐗欒懼囬┍鍔ㄦ槸緗戠粶璁懼囷紝浣跨敤緗戠粶鎺ュ彛銆
Android 鐨勮摑鐗欏崗璁鏍堜嬌鐢˙lueZ瀹炵幇鏉ュ笹AP, SDP浠ュ強RFCOMM絳夊簲鐢ㄨ勮寖鐨勬敮鎸,騫惰幏寰椾簡SIG璁よ瘉銆傜敱浜嶣luez浣跨敤GPL鎺堟潈, 鎵浠Android 妗嗘灦閫氳繃D-BUS IPC鏉ヤ笌bluez鐨勭敤鎴風┖闂翠唬鐮佷氦浜掍互閬垮厤浣跨敤鏈緇忔巿鏉冪殑浠g爜銆
钃濈墮鍗忚閮ㄥ垎澶存枃浠訛細
include/net/bluetooth/hci_core.h
include/net/bluetooth/bluetooth.h
钃濈墮鍗忚婧愪唬鐮佹枃浠訛細
net/bluetooth/*
钃濈墮椹卞姩紼嬪簭閮ㄥ垎鐨勬枃浠訛細
drivers/bluetooth/*
钃濈墮鐨勯┍鍔ㄧ▼搴忎竴鑸閮介氳繃鏍囧噯鐨凥CI鎺у埗瀹炵幇銆備絾鏍規嵁紜浠舵帴鍙e拰鍒濆嬪寲嫻佺▼鐨勪笉鍚岋紝鍙堝瓨鍦ㄤ竴浜涘樊鍒銆傝繖綾誨垵濮嬪寲鍔ㄤ綔涓鑸鏄涓浜涙櫠鎸棰戠巼錛屾嘗鐗圭巼絳夊熀紜璁劇疆銆傛瘮濡侰SR鐨勮姱鐗囦竴鑸閫氳繃BCSP鍗忚瀹屾垚鏈鍒濈殑鍒濆嬪寲閰嶇疆錛屽啀嬋媧繪爣鍑咹CI鎺у埗嫻佺▼銆傚筁inux鏉ヨ達紝涓鏃bluez鍙浠ヤ嬌鐢℉CI涓庤姱鐗囧緩絝嬭搗閫氫俊(涓鑸鏄痟ciattach + hciconfig)錛屼究鍙浠ュ埄鐢ㄥ叾涓婄殑鏍囧噯鍗忚(SCO, L2CAP絳)錛屼笌钃濈墮閫氫俊錛屼嬌鍏舵e父宸ヤ綔浜嗐
WLAN 璁懼囬┍鍔錛圵i-Fi錛夛紙姣旇緝澶嶆潅鎴戦潰浼氫笓闂ㄥ啓涓獁ifi鍒嗘瀽錛
鍦╨inux涓錛學lan璁懼囧睘浜庣綉緇滆懼囷紝閲囩敤緗戠粶鎺ュ彛銆
Wlan鍦ㄧ敤鎴風┖闂撮噰鐢ㄦ爣鍑嗙殑socket鎺ュ彛榪涜屾帶鍒躲
WiFi鍗忚閮ㄥ垎澶存枃浠訛細
include/net/wireless.h
WiFi鍗忚閮ㄥ垎婧愭枃浠訛細
net/wireless/*
WiFi椹卞姩紼嬪簭閮ㄥ垎錛
drivers/net/wireless/*
⑶ 如何在嵌入式linux開發板上使用USB鍵盤
滑鼠驅動可分為幾個部分:驅動載入部分、probe部分、open部分、urb回調函數處理部分。
下文陰影部分為註解。
一、驅動載入部分
static int __init usb_mouse_init(void)
{
int retval = usb_register(&usb_mouse_driver);//注冊滑鼠驅動
if (retval == 0)
info(DRIVER_VERSION ":" DRIVER_DESC);
return retval;
}
其中usb_mouse_driver的定義為:
static struct usb_driver usb_mouse_driver = {
.owner = THIS_MODULE,
.name = "usbmouse",
.probe = usb_mouse_probe,
.disconnect = usb_mouse_disconnect,
.id_table = usb_mouse_id_table,
};
如果注冊成功的話,將會調用usb_mouse_probe。那麼什麼時候才算注冊成功呢?
和其它驅動注冊過程一樣,只有在其對應的「匯流排」上發現匹配的「設備」才會調用probe。匯流排匹配的方法和具體匯流排相關,如:platform_bus_type中是判斷驅動名稱和平台設備名稱是否相同;那如何確認usb匯流排的匹配方法呢?
Usb設備是注冊在usb_bus_type匯流排下的。查看usb_bus_type的匹配方法。
struct bus_type usb_bus_type = {
.name = "usb",
.match = usb_device_match,
.hotplug = usb_hotplug,
.suspend = usb_generic_suspend,
.resume = usb_generic_resume,
};
其中usb_device_match定義了匹配方法
static int usb_device_match (struct device *dev, struct device_driver *drv)
{
struct usb_interface *intf;
struct usb_driver *usb_drv;
const struct usb_device_id *id;
/* check for generic driver, which we don't match any device with */
if (drv == &usb_generic_driver)
return 0;
intf = to_usb_interface(dev);
usb_drv = to_usb_driver(drv);
id = usb_match_id (intf, usb_drv->id_table);
if (id)
return 1;
return 0;
}
可以看出usb的匹配方法是usb_match_id (intf, usb_drv->id_table),也就是說通過比對「dev中intf信息」和「usb_drv->id_table信息」,如果匹配則說明驅動所對應的設備已經添加到匯流排上了,所以接下了就會調用drv中的probe方法注冊usb設備驅動。
usb_mouse_id_table的定義為:
static struct usb_device_id usb_mouse_id_table[] = {
{ USB_INTERFACE_INFO(3, 1, 2) },
{ } /* Terminating entry */
};
#define USB_INTERFACE_INFO(cl,sc,pr) /
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, /
.bInterfaceClass = (cl), /
.bInterfaceSubClass = (sc), /
.bInterfaceProtocol = (pr)
滑鼠設備遵循USB人機介面設備(HID),在HID規范中規定滑鼠介面類碼為:
介面類:0x03
介面子類:0x01
介面協議:0x02
這樣分類的好處是設備廠商可以直接利用標準的驅動程序。除了HID類以外還有Mass storage、printer、audio等
#define USB_DEVICE_ID_MATCH_INT_INFO /
(USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_INT_PROTOCOL)
匹配的過程為:
usb_match_id(struct usb_interface *interface, const struct usb_device_id *id)
{
struct usb_host_interface *intf;
struct usb_device *dev;
/* proc_connectinfo in devio.c may call us with id == NULL. */
if (id == NULL)
return NULL;
intf = interface->cur_altsetting;
dev = interface_to_usbdev(interface);
/* It is important to check that id->driver_info is nonzero,
since an entry that is all zeroes except for a nonzero
id->driver_info is the way to create an entry that
indicates that the driver want to examine every
device and interface. */
for (; id->idVendor || id->bDeviceClass || id->bInterfaceClass ||
id->driver_info; id++) {
if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
id->idVendor != le16_to_cpu(dev->descriptor.idVendor))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) &&
id->idProct != le16_to_cpu(dev->descriptor.idProct))
continue;
/* No need to test id->bcdDevice_lo != 0, since 0 is never greater than any unsigned number. */
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) &&
(id->bcdDevice_lo > le16_to_cpu(dev->descriptor.bcdDevice)))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) &&
(id->bcdDevice_hi < le16_to_cpu(dev->descriptor.bcdDevice)))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) &&
(id->bDeviceClass != dev->descriptor.bDeviceClass))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) &&
(id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) &&
(id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
continue;
//介面類
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
(id->bInterfaceClass != intf->desc.bInterfaceClass))
continue;
//介面子類
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) &&
(id->bInterfaceSubClass != intf->desc.bInterfaceSubClass))
continue;
//遵循的協議
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) &&
(id->bInterfaceProtocol != intf->desc.bInterfaceProtocol))
continue;
return id;
}
return NULL;
}
從中可以看出,只有當設備的介面類、介面子類、介面協議匹配滑鼠驅動時滑鼠驅動才會調用probe方法。