藍牙配對部分的進展

February 1, 2008 – 12:53 am

更新一下,發現了原來 KDE bluetooth 是會看 /etc/bluetooth/hcid.conf 這個檔案的,配對也能運作了,
以前的 bluetooth 軟體在 hcid.conf 中會指定 passkey, 後來修改了用 agent 來做這個配對動作,
但 KDE bluetooth 原來沿用回舊方法,在 hcid.conf 中讀取了 passkey 選項來做配對。
所以只要在 hcid.conf 中的 “option” 段這樣放 passkey 進去就成了,改好後重新開機。
我的 /etc/bluetooth/hcid.conf 內容:

options {
autoinit yes;
security auto;
pairing multi;
passkey “0000″;
}

device {
name “%h-%d”;
class 0×3e0100;
#pkt_type DH1,DM1,HV1;
iscan enable; pscan enable;
lm accept;
lp rswitch,hold,sniff,park;
}

請有用藍牙的同學一起試試這個配對方法是否可行!

更新: 感謝網友 cfyau 及 nyu 的測試,似乎透過藍牙連線到網路已經可行了!
請問 nyu 兄可不可以把安裝的步驟寫一點點的教學呢? 謝謝!

  1. 28 Responses to “藍牙配對部分的進展”

  2. 不太明白。hcid.conf裏本來就有「passkey “0000″;」這一行。可是就
    不能配對。是不是不同的手機有不同的反應?

    By nyu on Feb 1, 2008

  3. 是不是不同的手機有不同的反應,我也不知道,因為只有一部手機…
    不過 bluez-util 在舊版本會看這個 passkey 選項,在新版本不會看,只會呼叫 passkey-agent。在看 kdebluetooth 源碼時,看到跟 passkey-agent 差不多的代碼,看似是會在 hcid.conf 中抓出 passkey 來給手機配對用,暫時看到的情況是這樣,修改 hcid.conf 也見效。

    By lazyfai on Feb 1, 2008

  4. security 由 user 改為 auto
    passkey 由 1234改為0000
    由SE W700i 手機端來搜尋, 手機會出現要輸入配對碼的畫面, 配對完成後, 手機端會看到 eeepc, 而KDE內 configure 的 paired device 會出現手機的資料, 看起來配對是成了, 手機顯示的 service 只有 push
    但是要由 eeepc 端來input device 似乎無法成功
    另外, 雖然已經配對了, 只有在 send file, 才會顯示 connected, 但如果想藉由藍牙連接手機上網, 要怎麼設定呢?

    By nakazima on Feb 1, 2008

  5. 我試過 Input device 跟 BlueLock 都不能用… :-(
    現在功能還只有檔案傳送/接收。
    BlueLock 很好用,就是當你的手機(或者使用者,如果手機在身上)離開電腦之後,會暫時把電腦鎖住,回到電腦附近時解開。
    要撥接上網的話,需要一些 ppp 的設定,就是要用 wvdial, 內置的pon/poff 據說也可以,不過沒有試過。

    By lazyfai on Feb 1, 2008

  6. Hi,
    i typed the “/etc/bluetooth/hcid.conf” n it said command not found may i ask thru which steps i can make it work?
    Isabella

    By Isabella on Feb 1, 2008

  7. Re: Isabella,

    Not run the file but edit it, do it like editing your sources.list before.
    Change to root user and then use “nano /etc/bluetooth/hcid.conf” to edit the file,
    notice the red words and change according in your file.
    It should be able to pair up then.

    By lazyfai on Feb 1, 2008

  8. hi Fai,

    i folllow the steps, n the Sony Ericsson p1i still can recognised but still cannot link up together n the eeepc said: “QFile::open: No file name specified”, um… what can i do ? i did delete some sentences which did not shown in the example above. is it not right?
    Isabella

    By Isabella on Feb 2, 2008

  9. 最新測試結果, 與另一台 XP 的 Notebook 配對成功了!!!! 經過這次修改 security 為 auto 後, 當用另一台 xp 的 nb 尋找藍牙裝置時, 可以找到 eeepc, 重點是會在這台 xp NB上出現輸入配對碼畫面, 接下來就在雙方電腦上看到彼此了(而且已經是 paired device)!!! 雖然目前還只能傳接檔案, 不過能配對就覺得讓人振奮起來
    仔細看 xp 藍牙服務不少服務(包括藍牙網路連線), 不曉得 KDE 這邊有沒有類似的服務呢? 現在只差這步, 可能就可以藉由藍牙手機上網了, 還是玩 linux 有挑戰性!!

    By nakazima on Feb 3, 2008

  10. 配對成功之後,接下來就是利用 bluetooth 提供的“序列埠”模擬 (tty) 來做撥號了,這個方法跟用USB線一樣,不過還未知道怎樣設定這個 bluetooth-serial 的連線。

    By lazyfai on Feb 4, 2008

  11. Please try :
    sudo pon N95

    N95 is a script file in /etc/ppp/peers/ with contents as below:

    -detach
    lcp-echo-failure 0
    /dev/rfcomm0
    460800
    defaultroute
    usepeerdns
    noipdefault
    noauth
    crtscts
    lock
    connect ‘/usr/sbin/chat -v -t6 -f /etc/ppp/peers/N95_chat’

    you need another file N95_chat in the same directory with contents as below:

    ABORT VOICE
    ABORT BUSY
    ABORT “NO CARRIER”
    ABORT “NO DIALTONE”
    ABORT “NO DIAL TONE”
    TIMEOUT 120
    “” ATZ
    OK ATV1E0
    OK AT+CGDCONT=,,”smartone-vodafone”
    OK ATD*99***1#
    CONNECT \c

    The above settings works for me, hope that it also works for you too. Good Luck!

    ( Fai: I have delete those comment lines for easier to read )

    By cfyau on Feb 4, 2008

  12. 在下列網址內看到另一個設定 rfcomm.conf 設定的方式, 想請教這個設定檔是做什麼的呢

    http://140.111.66.56/post/3/36

    By nakazima on Feb 5, 2008

  13. rfcomm.conf 就是用來把 bluetooth 變成 serial / input device 之類的設定了。

    至於這句就是叫 hid (Human Input Device) 程序連接到藍牙。
    hidd –connect 00:12:A1:60:94:3C

    我們現在配對了之後也可以用這個方法接駁藍牙的輸入,不過 –connect 之後的是藍牙的硬體地址 (hardware address)。

    如果要撥號上網,可以用 rfcomm 做,參考我的部落格:
    http://lazyfai.blogspot.com/2007/10/use-bluetooth-phone-to-connect-to.html
    不過最近工作很忙,要過年才有時間研究。 :-(

    By lazyfai on Feb 5, 2008

  14. 因為參考 cfyau 兄, 和 Lazyfai 兄, 及 下列網頁內的方式, 可以讓手機接收到命令要求上網, 也真的上了, 地球符號也出現, 但 eeepc 要卻無法上網, 不知道是怎麼回事呢

    http://forum.eeeuser.com/viewtopic.php?id=2280

    By nakazima on Feb 5, 2008

  15. 本人也參考了eeeuser.com的forum。
    還用了SublimePorte 的Deb包(3egprs_0.1.deb)就成功地使Eeepc通過手機(Motorola V6)上了網。
    http://farm3.static.flickr.com/2001/2244273552_ce2f73df93_o.png

    By nyu on Feb 5, 2008

  16. 上網急問 
    今日上左深圳,買左中移動的神洲行,而家手機上到的,但eeepc就不可以.請問應該點set?

    By Morris on Feb 6, 2008

  17. Sorr.. 有太心急,搞到o係呢到留左個ot comment .
    我的問題solve了..thx ^^

    By Morris on Feb 6, 2008

  18. 首先祝大家新年快樂!

    eeepc通過手機上網的步聚、因為試了幾天而且不知那些是做對了、那些是做錯了也不太知道、也沒有把它寫下來、所以本人的步聚只可以給大家一個參考。
    1、首先install lazyfai兄的kbluetooth。確定eeepc可跟手機之間轉送檔案。
    2、按照http://forum.eeeuser.com/viewtopic.php?id=2280
    來編輯/etc/bluetooth/hcid.conf和/etc/bluetooth/rfcomm.conf檔案。
    3、本人用了「passkey-agent」來做配對。在Console中用root權限來執行「passkey-agent &」、然後執行/etc/init.d/dbus restart和/etc/init.d/bluetooth restart。再執行rfcomm connect 0 00:11:22:33:44:55、再試試l2ping可否ping到你的手機。配對一定要成功、否則上不了網。
    4、在你的手機和你的eeepc裏確認有對方的名字。
    5、下戴和安裝3egprs_0.1.deb包。
    6、在安裝中、要填一些APN此類的東西。
    7、在root權限下執行「pon 3egprs」。然後執行「ifconfig」看看有沒「ppp0」這一項。

    Good luck!

    By nyu on Feb 7, 2008

  19. Hi
    I just cannot see “ppp0″ other can link up then what can i do?
    Isabella

    By Isabella on Feb 10, 2008

  20. Re: Isabella

    I think you need to install 3egprs package too (using apt-get install 3egprs)
    And then run the GPRS configuration before using “sudo pon 3egprs”

    By lazyfai on Feb 10, 2008

  21. Hi,
    I am not quite sure how to run the GPRS config, could u tell me once more n also i saw other forum, it told me to delete the subdirectories file in /var/xxx/xxx/ (cannot remember). could u tell me by using which words begins(i.e. sudo? pico? i cannot remember). N i want to tell u when i click the gprs icon in my eeepc i saw my mobile lights up n ask for the code i set it as ‘0000′ n it recognise each other n a window pop up said gprs connected however wait for 15 seconds n nothing happen um………. i m using CSL1010 n my mobile SE P1i; could u tell me how can i link them up?? many thks. Isabella

    By Isabella on Feb 11, 2008

  22. Re: Isabella

    No need to remove somethnig in /var/lib/bluetooth/, the purpose of removing is to “remove” the partnership between eeepc and phone.

    I haven’t try 3egprs on my phone yet, but according to nyu, you need to see APN, username and password thing in it, like CSL 1010, refer to “http://help.yahoo.com/help/hk/mobile/sms/sms-24.html”, APN should be “hkcsl”, username and password can be anything.

    By lazyfai on Feb 11, 2008

  23. 很想弄清楚到底安裝 3egrps 動到哪些設定, 看起來
    1. etc/bluetooth 內的 hcid.conf 和 rfcomm.conf
    2. etc/ppp/peers/ 多了 3egrps和3egprs-chat,
    3. usr/sbin/service.sh 也被動過
    看 Asus 易模式的 simplerc 設定檔, 應該是執行 pon 3egprs
    最擔心原本KDE Kbluetooth 起來仍舊可以用, 不衝突…
    不曉得還有什麼要注意?

    By nakazima on Feb 12, 2008

  24. 如果使用藍牙滑鼠, 是否能應用以上的命令呢?

    By nakazima on Feb 13, 2008

  25. 我也沒有藍牙滑鼠,找到來測試的話就可以知道怎弄了。

    By lazyfai on Feb 14, 2008

  26. 其實你可以用bluez-gnome, 會比kdebluetooth要來的好, kdebluetooth的team不太活躍, 而且裡面滿多東西是舊的bluez的架構, 有時會有些整合上的問題, 相對bluez-gnome問題就少很多. 畢竟那是Marcel自己弄的, 不過他在Browse Service那邊也是還沒弄好, 需要另外進console mode就是了.

    By Mihs on Feb 19, 2008

  27. Hi Fai,

    I still got the problem n get stucked here with my eeepc n my mobile sony ericsson p1i though there is a link between them but can only last for one minute then lost the linkage already; and when i type “ifconfig” i cannot find ppp0, what am i still missing since they can “talk” for one minute but why they lost linkage after one minute can you or anyone tell me what am i still missing???? what have i done wrong?????? please

    isabella

    By Isabella on Feb 22, 2008

  28. Re: Isabella

    Sorry I don’t have many mobile to test for the connection method, but in your case I recommend you to use USB cable to test for connection first, it should be the same as using modem, after plugging USB cable the mobile will act as modem, so you can set it in network configuration.

    By lazyfai on Feb 22, 2008

  29. Hi Fai,
    Actually b4 i trying the bluetooth linkage of eeepc n mobile, i can use the usb cable let my mobile as modem n surf on-line but after i tried with my bluetooth thing i can NO LONGER create a link between usb cable n my mobile it tried to activate but finally cannot i watched the details window , it said modem terminated n i dunno why actually .

    Isabella

    By Isabella on Feb 22, 2008

Post a Comment