bluetooth how to, hcitool, obexftp, rfcomm
Posted 03-03-2013 at 07:05 AM by ted_chou12
Hi, I am trying to figure out how to connect a phone by bluetooth thru terminal. I am just posting my progress here:
First! I Don't know how Ive got it working, but there must be something that I have done correctly to ensure the connection was successfully made. Secondly, this is going to be a mess and you are warned. Third, there is really not much info on this and quite a lot of them are specific issues rather than guides. I will make this as helpful and informative as I can:
Ensure that you have these installed:
Secondly use hcitool to descover devices:
Now use sdptool to show available services:
Pay special attention to the channel, rfcomm.
add
to your /etc/bluetooth/rfcomm.conf and restart your bluetooth service.
now rfcomm should give an output similar to this:
if not, then this must have worked:
Then rfcomm again.
Try restarting bluetooth service again.
Now use obexftp to access the device directories:
Ted
First! I Don't know how Ive got it working, but there must be something that I have done correctly to ensure the connection was successfully made. Secondly, this is going to be a mess and you are warned. Third, there is really not much info on this and quite a lot of them are specific issues rather than guides. I will make this as helpful and informative as I can:
Ensure that you have these installed:
Code:
root:# slapt-get --search blue bluedevil-1.2.2-i586-1vl70 [inst=no]: bluedevil (bluetooth stack for KDE) bluefish-2.0.2-i586-1vl70 [inst=no]: Bluefish (GTK-based HTML Editor) bluefish-2.2.3-i586-2vl70 [inst=no]: bluefish () bluegriffon-1.4-i586-1vl70 [inst=no]: bluegriffon (WYSIWYG Web Editor based on the rendering engine of Firefox) blueman-1.23-i586-1vl70 [inst=yes]: blueman (a GTK+ Bluetooth Manager) bluez-4.91-i486-1 [inst=no]: bluez (Bluetooth libraries and utilities) bluez-4.99-i586-1vl70 [inst=yes]: bluez (Bluetooth libraries and utilities) bluez-firmware-1.2-i486-1 [inst=yes]: bluez-firmware (Bluetooth(TM) firmware) bluez-hcidump-2.0-i486-1 [inst=yes]: bluez-hcidump (Bluetooth analyzer) bluez-libs-3.29-i586-1vl70 [inst=yes]: bluez-libs (Library files for Bluetooth layers) deskmenu-1.4.5-i586-1vl70 [inst=no]: deskmenu (root menu program for X) filelight-1.9.0-i586-1vl70 [inst=no]: filelight (Graphically represents diskspace usage) libbluedevil-1.9.1-i586-1vl70 [inst=no]: libbluedevil (A Qt wrapper for bluez) mate-bluetooth-1.4.0-i586-1vl70 [inst=no]: mate-bluetooth (MATE bluetooth application) obexd-0.47-i586-1vl70 [inst=no]: obexd (OBEX Server and Client) winefish-1.3.3-i586-9vl70 [inst=no]: LaTeX editor based on Bluefish with auto-completion and syntax highl obexftp-0.23-i486-5 [inst=yes]: obexftp (Access devices via ObexFTP, such as mobile phones)
Code:
root:# hcitool scan Scanning ... 50:56:63:A6:5E:06 HTC One X
Code:
root:# sdptool browse 50:56:63:A6:5E:06 Browsing 50:56:63:A6:5E:06 ... Service RecHandle: 0x10000 Service Class ID List: "PnP Information" (0x1200) Profile Descriptor List: "PnP Information" (0x1200) Version: 0x0102 Service Name: Audio Source Service RecHandle: 0x10001 Service Class ID List: "Audio Source" (0x110a) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 25 "AVDTP" (0x0019) uint16: 0x102 Profile Descriptor List: "Advanced Audio" (0x110d) Version: 0x0102 Service Name: AVRCP TG Service RecHandle: 0x10002 Service Class ID List: "AV Remote Target" (0x110c) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 23 "AVCTP" (0x0017) uint16: 0x103 Profile Descriptor List: "AV Remote" (0x110e) Version: 0x0100 Service Name: Voice Gateway Service RecHandle: 0x10003 Service Class ID List: "Headset Audio Gateway" (0x1112) "Generic Audio" (0x1203) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 11 Profile Descriptor List: "Headset" (0x1108) Version: 0x0100 Service Name: OBEX Object Push Service RecHandle: 0x10004 Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 12 "OBEX" (0x0008) Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100 Service Name: Voice Gateway Service RecHandle: 0x10005 Service Class ID List: "Handsfree Audio Gateway" (0x111f) "Generic Audio" (0x1203) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 10 Profile Descriptor List: "Handsfree" (0x111e) Version: 0x0106 Service Name: OBEX Phonebook Access Server Service RecHandle: 0x10006 Service Class ID List: "Phonebook Access - PSE" (0x112f) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 19 "OBEX" (0x0008) Profile Descriptor List: "Phonebook Access" (0x1130) Version: 0x0100 Service Name: OBEX Message Access Server Service RecHandle: 0x10007 Service Class ID List: "" (0x1132) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 21 "OBEX" (0x0008) Profile Descriptor List: "" (0x1134) Version: 0x0100 Service Name: Network service Service Description: Network service Service RecHandle: 0x10008 Service Class ID List: "Network Access Point" (0x1116) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 15 "BNEP" (0x000f) Version: 0x0100 SEQ16: 800 806 Language Base Attr List: code_ISO639: 0x656e encoding: 0x6a base_offset: 0x100 Profile Descriptor List: "Network Access Point" (0x1116) Version: 0x0100 Service Name: OBEX File Transfer Service RecHandle: 0x1000a Service Class ID List: UUID 128: 00001106-0000-1000-8000-00805f9b34fb Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 16 "OBEX" (0x0008)
add
Code:
rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device device 50:56:63:A6:5E:06; # RFCOMM channel for the connection channel 16; # Description of the connection comment "OBEX File Transfer"; }
now rfcomm should give an output similar to this:
Code:
server://home/ted root:# rfcomm rfcomm0: 50:56:63:A6:5E:06 channel 16 clean
Code:
root:# rfcomm bind hci0 50:56:63:A6:5E:06 16 clean
Try restarting bluetooth service again.
Now use obexftp to access the device directories:
Code:
root:# obexftp -b 50:56:63:A6:5E:06 -l / Browsing 50:56:63:A6:5E:06 ... Connecting..\done Tried to connect for 43ms Receiving "/"... Sending ""...|done /<?xml version="1.0"?><!DOCTYPE folder-listing SYSTEM"obex-folder-listing.dtd"><folder-listing version="1.0"><parent-folder/><folder name="gift"/><folder name="DCIM"/><folder name="Music"/><folder name=".data"/><folder name="LOST.DIR"/><folder name=".android_secure"/><folder name="My Documents"/><folder name="Android"/><folder name="XMS"/><folder name="Notifications"/><folder name="Podcasts"/><folder name="Ringtones"/><folder name="Alarms"/><folder name="Pictures"/><folder name="Movies"/><folder name="Download"/><folder name="media"/><folder name=".showme"/><folder name=".estrongs"/><folder name="downloads"/><folder name="soundhound"/><folder name=".clipboard"/><folder name=".polarisOffice"/><folder name="kkbox"/><folder name="WhatsApp"/><folder name="backups"/><folder name=".android_"/><folder name="KKBOX_Music_Store"/><folder name="tencent"/></folder-listing>done Disconnecting..-done
Total Comments 1
Comments
-
if you lack "OBEX File Transfer" or something like "OBEX FTP", ANND you are using an android fone, you could try downloading bluetooth file transfer by searching for "OBEX" in googleplay. And the service appears as:
Code:Service Name: OBEX FTP Service RecHandle: 0x10007 Service Class ID List: UUID 128: 00001106-0000-1000-8000-00805f9b34fb Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 30
Posted 03-03-2013 at 08:33 AM by ted_chou12