版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、Android 藍牙AVRCP功能的實現(xiàn)作者:Macro LiuAVRCP的按按鍵定義:sdkemmulatoorkeyymapsAVRCPP.klkey 2000 MEEDIA_PPLAY_PPAUSE WAAKEkey 2011 MEEDIA_PPLAY_PPAUSE WAAKEkey 1666 MEEDIA_SSTOP WAAKEkey 1633 MEEDIA_NNEXT WAAKEkey 1655 MEEDIA_PPREVIOOUS WAAKEkey 1688 MEEDIA_RREWINDD WAAKEkey 2088 MEEDIA_FFAST_FFORWARRD WAAKEBCM(b
2、rooadcomm)宏定義需要打打開:BOARD_HHAVE_BBLUETOOOTH_BBCM := trueeBT音頻控制的的代碼externaalbluuetootthbluuezauudioccontrool.c(1) 按鍵的的MAPstatic strucct const char *namee;uint8_t avrrcp;uint166_t uiinput; key_mmap = PLAAY,PLAY_OP,KEY_PPLAYCDD , STOOP,STOP_OP,KEY_SSTOPCDD , PAUUSE,PAUSEE_OP,KEY_PPAUSECCD , FORRWARD,FO
3、RWAARD_OPP,KEY_NNEXTSOONG , BACCKWARDD,BACKWWARD_OOP,KEY_PPREVIOOUSSONNG , REWWIND,REWINND_OP,KEY_RREWINDD , FASST FORRWARD,FAST_FORWAARD_OPP,KEY_FFASTFOORWARDD , NULLL ;(2) 按鍵處處理static void handlle_pannel_paassthrrough(strucct conntrol *conttrol, for (ii = 0; key_mapii.namme != NULL; i+) uint88_t k
4、eey_quiirks;if (operaands00 & 00 x7F) != key_mapii.avrrcp)conttinue;DBG(AVRCPP: %s %s, key_e, staatus);key_qquirkss = coontroll-keyy_quirrkskeey_mappi.aavrcp;if (kkey_quuirks & QUIIRK_NOO_RELEEASE) if (!presssed) DBGG(AVRRCP: IIgnoriing reeleasee);breeak;DBG(AVRCCP: trreatinng keyy presss
5、as presss + reeleasee);sendd_key(contrrol-uuinputt, keyy_mapi.uiinput, 1);sendd_key(contrrol-uuinputt, keyy_mapi.uiinput, 0);breaak;send_key(ccontrool-uiinput, key_mapii.uinnput, presssed);breakk;HCIDUMPP數(shù)據(jù)分析以Sony耳機機DRC-BBT15為例例#adb shhell#hcidummp X左鍵: ACL ddata: handlle 12 flagss 0 x022 dlenn 12 L
6、2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 30 111 0e 000 48 7c 4c 00 0.H|L. HCI CCommannd: Exxit Snniff MMode (0 x02|0 x00004) pllen 2 0000: 0c 00 . HCI EEvent: Max Slotss Channge (00 x1b) plen 3 0000: 0c 00 05 . HCI EEvent: Modee Channge (00 x14) plen 6 0000: 00 00c 00 00 000 00 . HCI EEvent: Com
7、mmand SStatuss (0 x00f) pllen 4 0000: 0c 01 04 088 . ACL ddata: handlle 12 flagss 0 x022 dlenn 12 L2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 40 111 0e 000 48 7c cc 00 .H|? HCI EEvent: Numbber off Comppletedd Packkets (0 x13) plenn 5 0000: 01 00c 00 02 000 .播放/暫停: ACL ddata: handlle 12 flagss 0 x0
8、22 dlenn 12 L2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 50 111 0e 000 48 7c 4b 00 PP.H|K. ACL ddata: handlle 12 flagss 0 x022 dlenn 12 L2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 60 111 0e 000 48 7c cb 00 .H|? HCI EEvent: Numbber off Comppletedd Packkets (0 x13) plenn 5 0000: 01 00c 00 02 000 .右
9、鍵: ACL ddata: handlle 12 flagss 0 x022 dlenn 12 L2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 70 111 0e 000 48 7c 46 00 pp.H|F. ACL ddata: handlle 12 flagss 0 x022 dlenn 12 L2CCAP(d): cidd 0 x00042 leen 8 psm 00 00000: 80 111 0e 000 48 7c c6 00 .H|? HCI EEvent: Numbber off Comppletedd Packkets (0 x1
10、3) plenn 5 0000: 01 00c 00 02 000 . HCI EEvent: Max Slotss Channge (00 x1b) plen 3 0000: 0c 00 01 . HCI EEvent: Modee Channge (00 x14) plen 6 0000: 00 00c 00 02 c8 00 .?然后將conttrol.cc的日志打印出來來:按一次”“播放放/暫停鍵”:D/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = 46 對應(yīng)PAAUSE_O
11、OPD/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 1按按鍵按下D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 201對應(yīng)應(yīng)MEDIAA_PLAYY_PAUSSED/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = c6 (= 0 xx46 0 x80 表示按鍵釋釋放了)D/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 0按按鍵釋
12、放D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 201 對對應(yīng)MEDIIA_PLAAY_PAUUSE再按一次”“播播放/暫停鍵鍵”:D/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = 44 對應(yīng)PLLAY_OPPD/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 1 按鍵按按下D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,sse
13、nd_kkey = 200 對應(yīng)MEDDIA_PLLAY_PAAUSED/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = c4D/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 0 按鍵釋放放D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 200 對對應(yīng)MEDIIA_PLAAY_PAUUSEnext keey:D/ACRVPP ( 237): - handdle_paanel
14、_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = 4b對應(yīng)應(yīng)FORWAARD_OPPD/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 1D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 163 對對應(yīng)MEDIIA_NEXXTD/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = cbD/ACRVPP ( 237): keyy_quir
15、rks = 0, prressedd = 0D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 163prev keey:D/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = 4c 對應(yīng)BACCKWARDD_OPD/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 1D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey =
16、165 對對應(yīng)D/ACRVPP ( 237): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 237): opeerandss0 = ccD/ACRVPP ( 237): keyy_quirrks = 0, prressedd = 0D/ACRVPP ( 237): conntrol-uinpput = ffffffffe,ssend_kkey = 165 MEDIAA_PREVVIOUS從上面可以看到到bluettooth的的協(xié)議棧bllueZ是沒沒有問題的將 frameeworkssbaseelibssuiEEventHHub.cppp的LOGG打
17、開,只能能看到了coontroll.c的日志志,EvenntHub的getEvvent完全全不響應(yīng)觀察所有l(wèi)ogg日志發(fā)現(xiàn),openDevice里也沒有裝載AVRCP.kl初步判斷eveent有問題題event分析析:$ adb sshell# cd /pproc/bbus/innput# cat ddeviceescat devvices# cat ddeviceescat devvicesI: Bus=0019 Vendoor=00001 Prooduct=0001 Versiion=00001 參考s3c-keyypad.ccN: Namee=s3cc-keyppad inputt_de
18、v-namee = DEEVICE_NAME;P: Physs=s3c-keyypad/iinput00 inpput_deev-phhys = s3c-keyypad/iinput00;S: Sysffs=/deevicess/virttual/iinput/inputt0 virrtual的的?U: Uniqq=H: Handdlers=eventt0B: EV=33B: KEY=40004400 0I: Bus=0019 Vendoor=00001 Prooduct=0001 Versiion=01100參考vpadd_butttons.ccN: Namee=s3cc-einttkey
19、iinput-namee = pddev-nname, gpioo_keyss_deviice_= s3cc-einttkey,P: Physs=gpioo-keyss/inpuut0 inputt-phyys = gpio-keys/inputt0S: Sysffs=/deevicess/plattform/s3c-einntkey/inputt/inpuut1 為什么這里里是plattform目目錄?U: Uniqq=H: Handdlers=eventt1B: EV=33B: KEY=1000000 0 00 0I: Bus=0018 Vendoor=00000
20、Prooduct=0000 Versiion=00000 參考amrii_ts.ccN: Namee=amrri_ts ammri_tss_drivver.naame = amrii_tsP: Physs= 沒有有定義S: Sysffs=/deevicess/plattform/s3c24400-i2c.0/ii2c-0/00-00333/inpuut/inpput2 為什么這這里是plaatformm目錄?U: Uniqq=H: Handdlers=eventt2B: EV=bbB: KEY=400 00 0 0 0 0 4400008800 400 0 0 100000B: ABS=265
21、00000 0I: Bus=0000 Vendoor=00000 Prooduct=0000 Versiion=00000N: Namee=ecoompasss_dataaP: Physs=S: Sysffs=/deevicess/virttual/iinput/inputt3U: Uniqq=H: Handdlers=eventt3B: EV=99B: ABS=307bff從上面可以看到到,完全沒有AVVRCP的eevent。解決辦法:Kernel$ make menucconfiggCONFIG_INPUTT_UINPPUT解決后的狀況:$ adb sshell# cd /pproc/bb
22、us/innput# cat ddevicees顯示增加了一個個eventtI: Bus=0005 Vendoor=00000 Prooduct=0000 Versiion=00000N: Namee=AVRRCPP: Physs=S: Sysffs=/deevicess/virttual/iinput/inputt4U: Uniqq=H: Handdlers=eventt4B: EV=11000077B: KEY=103000 168 0 0 00 0 0B: REL=0看openDeevice的的信息:D/EventtHub( 84): EveentHubb:reaadNotiify nf
23、fd: 877D/EventtHub( 84): Opeening devicce: /ddev/innput/eevent44D/EventtHub( 84): Gettting keys.D/EventtHub( 84): Gettting absollute ccontroollerss.D/EventtHub( 84): keyylayouutFileename = /syystem/usr/kkeylayyout/AAVRCP.kl I/EventtHub( 84): Neww keybboard: deviice-iid=0 x110003 devnaame=AAVRCP prop
24、pName=hw.kkeyboaards.665539.devnaame kkeylayyout=/systtem/ussr/keyylayouut/AVRRCP.kllI/EventtHub( 84): Neww deviice: ppath=/dev/iinput/eventt4 namme=AVRRCP idd=0 x100003 (of 0 xx4) inndex=44 fd=1196 cllassess=0 x1D/EventtHub( 84): Addding ddevicee /devv/inpuut/eveent4 00 x3618800 att 4, iid = 33, cl
25、aasses = 0 x11D/EventtHub( 84): Repportinng devvice oopenedd: id=0 x100003, nname=/dev/iinput/eventt4按鍵時也可以看看到EvenntHub的的信息了:Log如下:D/ACRVPP ( 236): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 236): opeerandss0 = 46D/ACRVPP ( 236): keyy_quirrks = 0, prressedd = 1D/ACRVPP ( 236): conntrol-uinpput = 14
26、,seend_keey = 2201 conntrol.c發(fā)出2001號鍵,按按鍵按下了D/EventtHub( 84): /deev/inpput/evvent4 got: t0=9337, t11=5829930, ttype=11, codde=2011, v=11 表示從從eventt4得到2001號鍵 MMEDIA_PLAY_PAUSEED/EventtHub( 84): ievv.codee=201 keyCoode=855 flaggs=0 x0000000001 errr=0D/EventtHub( 84): /deev/inpput/evvent4 got: t0=9337,
27、 t11=6002241, ttype=00, codde=0, v=0D/AudiooHardwware( 61): AuddioStrreamOuutALSAA:settParammeterss() rooutingg=0D/ACRVPP ( 236): - handdle_paanel_ppassthhroughh -D/ACRVPP ( 236): opeerandss0 = c6D/ACRVPP ( 236): keyy_quirrks = 0, prressedd = 0D/ACRVPP ( 236): conntrol-uinpput = 14,seend_keey = cc9D
28、/EventtHub( 84): /deev/inpput/evvent4 got: t0=9337, t11=6643391, ttype=11, codde=2011, v=00 contrrol.c發(fā)發(fā)出201號號鍵,按鍵釋釋放了D/EventtHub( 84): ievv.codee=201 keyCoode=855 flaggs=0 x0000000001 errr=0D/EventtHub( 84): /deev/inpput/evvent4 got: t0=9337, t11=6644406, ttype=00, codde=0, v=0D/A2DP ( 61): a2ddp_stoopD/A2DP ( 61): bluuetootth_stoopE/BluettoothEEventLLoop.cc
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 消防培訓方案
- 2024年醫(yī)用設(shè)備維修合同范本
- 等級保護三級相關(guān)要求
- 股權(quán)轉(zhuǎn)讓協(xié)議書范本 格式 樣本 樣式 協(xié)議
- 住宅租賃合同撰寫指南
- 員工專業(yè)技能培訓合同
- 2024年委托貸款協(xié)議合同
- 出口代理協(xié)議范本模板
- 個人融資協(xié)議書合同范本撰寫指南
- 2024年簡單店面租賃合同2
- 肺脹(慢性阻塞性肺病)中醫(yī)優(yōu)勢病種診療方案
- 鐵路交通安全主題班會課件
- 2024年專技人員公需科目考試答
- 數(shù)學蘇教版四年級(上冊)1、解決問題的策略 蘇教版(共13張)
- 2023-2024學年北京市某中學七年級上學期期中考試地理試卷(含詳解)
- 落實《中小學德育工作指南》制定的實施方案(pdf版)
- 調(diào)味品品牌授權(quán)銷售合作協(xié)議(2024年版)
- 中國軟件行業(yè)基準數(shù)據(jù)報告(SSM-BK-202409)
- 2024新華社招考應(yīng)屆高校畢業(yè)生(高頻重點提升專題訓練)共500題附帶答案詳解
- 人教版體育與健康八年級9武術(shù)《健身南拳》參考教學設(shè)計
- 2024年全國軟件水平考試之高級網(wǎng)絡(luò)規(guī)劃設(shè)計師考試重點黑金模擬題(附答案)
評論
0/150
提交評論