♩About myself♪

我的相片
永遠的藍星
怠惰是一種病,偷懶是種藉口

Panda dog?

2008年8月14日 星期四

Linux bluetooth基本操作

支持 usb_hci rfcomm 協定軟體 bluez 載入hci_usb、 rfcomm模組# modprobe hci_usb # modprobe rfcomm 插入usb receriver # hciconfig hci0 up 指令啟動裝置
查詢usb receriver狀態 # hciconfig -a
hci0: Type: USB BD Address: 00:10:60:A3:68:9F ACL MTU: 192:8 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:1860 acl:10 sco:0 events:88 errors:0 TX bytes:1432 acl:10 sco:0 commands:52 errors:0 Features: 0xff 0xff 0x0f 0x00 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'Debian' Class: 0x000100 Service Classes: Unspecified Device Class: Computer, Uncategorized HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d Manufacturer: Cambridge Silicon Radio (10)
掃瞄周圍藍牙設備:
# hcitool scan Scanning ... 00:0B:0D:85:13:53 HOLUX GPSlim236 00:11:94:02:1A:84 MPx220 00:19:2D:E0:33:77 628...............i love it 00:18:0F:CE:2B:4B ...........................
Ping一下看看: (指令為l2ping,l是小寫的L而不是數字1) )
# l2ping 00:0E:07:1C:AE:1D
Ping: 00:0B:0D:85:13:53 from 00:10:60:E3:7D:E0 (data size 44) ... 0 bytes from 00:0B:0D:85:13:53 id 0 time 10.83ms 0 bytes from 00:0B:0D:85:13:53 id 1 time 6.42ms 0 bytes from 00:0B:0D:85:13:53 id 2 time 6.36ms 0 bytes from 00:0B:0D:85:13:53 id 3 time 6.28ms 0 bytes from 00:0B:0D:85:13:53 id 4 time 6.07ms 0 bytes from 00:0B:0D:85:13:53 id 5 time 5.22ms 0 bytes from 00:0B:0D:85:13:53 id 6 time 6.18ms 0 bytes from 00:0B:0D:85:13:53 id 7 time 5.09ms 0 bytes from 00:0B:0D:85:13:53 id 8 time 11.07ms 0 bytes from 00:0B:0D:85:13:53 id 9 time 7.03ms 10 sent, 10 received, 0% loss #O#有反應
本地主機配置文件(主機名等參數): /etc/bluetooth/hcid.conf
....
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
#lm accept; #改成註解 lm accept,master #這邊設定為伺服模式 ....
PIN配對碼所在文件: /etc/bluetooth/pin 我設在/bin/bluepin
內容
#!/bin/sh echo
"PIN:0000"
加載配置文件: #hcid -f /etc/bluetooth/hcid.conf
透過rfcomm連線 #rfcomm connect /dev/rfcomm0 00:0E:07:1C:AE:1D ﹍(參數設定通道) Connected /dev/rfcomm0 to 00:0B:0D:85:13:53 on channel 1 Press CTRL-C for hangup 用串口查看裝置傳輸內容 #minicom -s set
┌───────────────────────┐
│ A - Serial Device : /dev/rfcomm0
│ B - Lockfile Location : /var/lock
│ C - Callin Program :
│ D - Callout Program :
│ E - Bps/Par/Bits : 115200 8N1
│ F - Hardware Flow Control : Yes
│ G - Software Flow Control : No │
│ Change which setting?
└───────────────────────┘
儲存設定後esc就可以看到以下數據:$GPGGA,062721.764,2459.7236,N,12127.1011,E,0,00,,46.4,M,15.2,M,,0000*4A $GPRMC,062721.764,V,2459.7236,N,12127.1011,E,,,150808,,,N*7B $GPVTG,,T,,M,,N,,K,N*2C $GPGGA,062722.761,2459.7236,N,12127.1011,E,0,00,,46.4,M,15.2,M,,0000*4C $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPGSV,3,1,11,16,47,019,,06,84,102,,03,74,212,,23,47,291,*77 $GPGSV,3,2,11,19,41,204,19,31,41,100,,13,21,317,18,25,14,317,*77 $GPGSV,3,3,11,21,11,068,,32,06,216,,20,04,236,*47 $GPRMC,062722.761,V,2459.7236,N,12127.1011,E,,,150808,,,N*7D $GPVTG,,T,,M,,N,,K,N*2C 由GPS接收器收到的訊號

2008年8月13日 星期三

Picasa2 測試




Picasa2 測試

Posted by Picasa

Bluez-移植問題

http://www.yuanma.org/data/2006/0607/article_699.htm 主要都是由這篇文章,源頭dennis以下是我的問題編譯bluez函式庫(版本:Bluez-libs-3.36)沒有問題,但在下面產生函式庫就出現下面的問題(待解)/usr/local/arm/3.4.1/bin/arm-linux-gcc -o -shared -o libbluetooth.so.1.0.17 bluetooth.o hci.o sdp.oerror:/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld: bluetooth.o: Relocations in generic ELF (EM: 3)bluetooth.o: could not read symbols: File in wrong formatcollect2: ld returned 1 exit status
search:http://www.linuxeden.com/forum/thread-159396-1-6.html接下來只要作函式庫連結在放到arm核心中就可以了# ln -s libbluetooth.so.1.0.17 libbluetooth.so# ln -s libbluetooth.so.1.0.17 libbluetooth.so.1
http://www.yuanma.org/data/2006/0607/article_699.htm(參考文章)
在基本核心內已經有包括bluez,hci_usb,rfcomm...等基本模組,再來函式庫及檔案系統中的bin操作測試版本同lib一樣 bluez-utils-3.36
checking for DBUS... noconfigure: error: D-Bus library is required作blue-unit設定時DBUS ERROR
改換版本bluez-utils-2.25+bluez-libs-2.25(都給他試試看)做了以下設定:libs./configure --prefix=/usr --host=armv4l CC=/usr/local/arm/3.4.1/bin/arm-linux-gccmake;make installutils./configure --prefix=/usr/bluetooth --includedir=/usr/include/bluetooth --libdir=/usr/lib --with-bluez=/usr/bluetooth --disable-test --disable-cups --disable-pcmia --host=armv4l CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc CPP=/usr/local/arm/3.4.1/bin/arm-linux-cpp AR=/usr/local/arm/3.4.1/bin/arm-linux-ar STRIP=/usr/local/arm/3.4.1/bin/arm-linux-strip RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib LD=/usr/local/arm/3.4.1/bin/arm-linux-ldmake;make install在我的/usr/bluetooth裡面就看得到bin及sbin了接下來要丟到機器上試試看~~ 結果沒問題照藍芽的基本操作來設定也是接收的到gps的訊號的! 上面問題就無視了==+
檔案系統預設方面有點問題,在設定device時要etc的rfcomm.conf不能設定初始化,全部用成註解
還有在/.bashrc 的檔案內容新增
ln -sf /dev/bluetooth/rfcomm/0 /dev/rfcomm0
重新啟動, 再照上面操作結果ok!

(ENDLESS)