随笔-113  评论-835  文章-1  trackbacks-0


授权方式:署名,非商业用途,保持一致,转载时请务必以超链接(http://www.fwolf.com/blog/post/393)的形式标明文章原始出处和作者信息及本声明。

Ubuntu 7.10 Gutsy,手机Nokia 6120c,蓝牙适配器是让朋友帮买的,朋友不懂Linux,卖这个的也不懂,随便买了一个叫什么艾思凯(issk)蓝牙博士(BLUETOOTH DOCTOR)的,还行,一插机器上就认出来了,就是不知道各种参数如何,初步使用感觉传输距离或者说穿透力不强:

$ lsusb
Bus 001 Device 002: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter

首先安装一些必要的东东:

sudo aptitude install gnome-bluetooth gnome-phone-manager

然后配置/etc/bluetooth/hcid.conf

# Security Manager mode
# 安全设置模式,改成auto
security auto;
...
# Default PIN code for incoming connections
# 匹配码/通行码,为安全起见,建议自己设一个。
passkey "1234";
...
# Local device name
# %d - device id
# %h - host name
# 电脑在蓝牙设备中显示的名称,改不改无所谓,自己认识就行。
name "%h-%d";

重启服务/etc/init.d/bluetooth,从手机上查找匹配设备,找到电脑以后,输入刚才设定的匹配码;匹配成功之后,提示“授权设备自动连接”选“是”。

配置/etc/bluetooth/rfcomm.conf

rfcomm0 {
# 启动时自动绑定地址(什么意思?)
bind yes;
# 蓝牙设备地址(用$ hcitool scan查找,用$ sdptool browse [地址]查看频道)
device 00:1C:D6:AC:7D:88;
# 通迅频道
channel 11;
# 说明,自己随便写
comment "Fwolf Nokia 6120c";
}

然后就可以用rfcomm connect 0连接手机了(测试一下):

$ rfcomm connect 0
Connected /dev/rfcomm0 to 00:1C:D6:AC:7D:88 on channel 1
Press CTRL-C for hangup
Disconnected

现在就可以传文件了:从电脑向手机发送文件用gnome-obex-send 文件名,按照提示选择蓝牙设备后,成功完成文件传输;从手机向电脑发送文件,电脑上要先运行gnome-obex-server,收到文件发送信号之后,会提示是否接收,接收完成后还会弹出一个如何处理的提示框,同时传多个文件的时候会比较烦人。传过来的文件都保存在$HOME/Desktop下,重名文件会自动更名。不过两个方向的传送方式传中文文件名都会乱码,文件内容没事(用usb数据线传没这问题)。

但gnome-phone-manager能发现手机但就是连不上,不知道是不是channel设置的问题,又好像是软件本身的问题,不知道回头升级到Hardy能好些不。

下面是一些网上搜到可能有用的东东:

电脑上寻找蓝牙设备:
$ hcitool scan
Scanning ...
00:1C:D6:AC:7D:88 Fwolf Nokia 6120c
电脑上查询蓝牙手机(有时候只在适配器刚插上的时候能查询出数据,后来再用就连接超时):
$ sdptool browse 00:1C:D6:AC:7D:88
Service Name: AVRCP Target
Service Description: Audio Video Remote Control
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10000
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x100
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100

Service Name: Hands-Free Audio Gateway
Service RecHandle: 0x10004
Service Class ID List:
"Handfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0105

Service Name: Headset Audio Gateway
Service RecHandle: 0x10005
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100

Service Name: Audio Source
Service RecHandle: 0x10011
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x100
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0100

Service Name: AVRCP Controller
Service Description: Audio Video Remote Control
Service Provider: Symbian Software Ltd.
Service RecHandle: 0x10012
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x100
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100

Service Name: SyncMLClient
Service RecHandle: 0x10013
Service Class ID List:
UUID 128: 00000002-0000-1000-8000-0002ee000002
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 10
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x00000002-0000-1000-8000-0002ee000002)
Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x10014
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 11
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"OBEX File Transfer" (0x1106)
Version: 0x0100

Service Name: Nokia OBEX PC Suite Services
Service RecHandle: 0x10015
Service Class ID List:
UUID 128: 00005005-0000-1000-8000-0002ee000001
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 12
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x00005005-0000-1000-8000-0002ee000001)
Version: 0x0100

Service Name: Nokia SyncML Server
Service RecHandle: 0x10016
Service Class ID List:
UUID 128: 00005601-0000-1000-8000-0002ee000001
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 13
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x00005601-0000-1000-8000-0002ee000001)
Version: 0x0100

Service RecHandle: 0x10017
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3

Service Name: OBEX Object Push
Service RecHandle: 0x10018
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 9
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100

Service Name: Dial-Up Networking
Service RecHandle: 0x10019
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

Service Name: Imaging
Service RecHandle: 0x1001a
Service Class ID List:
"Imaging Responder" (0x111b)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 15
"OBEX" (0x0008)
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Imaging" (0x111a)
Version: 0x0100

这个可以用来查channel号码,不同手机的号码可能会不同,大概是要选择OBEX File Transfer所在的channel(我的手机是11),也有人说是用OBEX Object Push的频道(我的手机是9),再好像有时候瞎设一个或者干脆用1也能进行文件传输,总之有点深奥没弄明白,期待明白人发言。

在手机上查看蓝牙设备地址:*#2820
备注:gnome-obex-send找不到手机的解决办法(未测试)
sudo hciconfig hci0 inqmode 0

参考

Tags: , , , ,

posted on 2008-04-25 12:55 老韩 阅读(1632) 评论(2)  编辑  收藏 所属分类: 技术角落

评论:
# re: Ubuntu和手机通过蓝牙互传文件 2008-04-29 21:27 | 晚儿
Ubuntu 很漂亮 可惜linux 我很是不通  回复  更多评论
  
# re: Ubuntu和手机通过蓝牙互传文件 2008-04-30 10:15 | 老韩
@晚儿
用多了就好来。我是逼不得已才用的。哈哈
  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: