[wiki]通过蓝牙连接Hoary和诺基亚手机

参与到Ubuntu的翻译中来
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

[wiki]通过蓝牙连接Hoary和诺基亚手机

#1

帖子 oneleaf » 2005-05-29 15:54

This how to is tested with Hoary and Nokia 6630 and a Dongle Bluetooth (Usb Bluetooth)

With this How To you could :

- Send Files via Bluetooth from your Pc to your Nokia Phone
- Send Files via Bluetooth from your Nokia Phone to your Pc
- Do everything you want with Bluetooth

Let's Start


- Open Synaptics

Quote:
sudo synaptic


- Install this packages and their dependences

Quote:
gnome-bluetooth
obexserver
bluez-utils


- Load this modules into the kernel : l2cap, rfcomm

Quote:
sudo modprobe l2cap

Quote:
sudo modprobe rfcomm


- Create the new device of the Dongle. We create a virtual bind from the Usb to the Serial Device

Quote:
sudo mknod /dev/rfcomm0 c 216 0


- Activate the Bluetooth in your Phone . For the Nokia 6630 :

Quote:
Menu -> Connect. -> Bluetooth -> On

Quote:
Menu -> Connect. -> Bluetooth -> My phone's visibility -> Shown to all

Quote:
Menu -> Connect. -> Bluetooth -> My Phone's Name -> "Insert a name for your phone"


- Scan for your phone

Quote:
hcitool scan

This utils will scan the devices's Bluetooth ... it'll show something like this :

Quote:
Scanning ...
00:11:9F:C0:FE:21 YOUR_PHONE_NAME


The first number is your Phone's Address. Obviously yours will be different !
Copy your Address on a post-it !

- Edit your /etc/bluetooth/rfcomm.conf

Quote:
sudo gedit /etc/bluetooth/rfcomm.conf


Cancell all and insert this :

Quote:
rfcomm0 {

device ADDRESS_OF_YOUR_PHONE;
channel 10;
comment "What you want ";

}


In ADDRESS_OF_YOUR_PHONE you must insert the Address wich you have write in the Post it
For example :

Quote:
rfcomm0 {

device 00:11:9F:C0:FE:21;
channel 10;
comment "My Nokia Phone";

}


- Add the Nokia Channel (10) to communicate with your phone

Quote:
sudo sdptool add --channel=10 OPUSH


- Do the binding

Quote:
sudo rfcomm bind /dev/rfcomm0 ADDRESS_OF_YOUR_PHONE 10


for example : rfcomm bind /dev/rfcomm0 00:11:9F:C0:FE:21 10

- Now we can test the connectivity

To Send from the PC to your Nokia Phone
Quote:
gnome-obex-send filename

for example
gnome-obex-send /home/massi/Desktop/Video.3gp
It'll show a prompt with the Bluetooth Device. Select your Phone and Click OK.

To Send from Your Nokia Phone to your PC
Activate the ObexServer on your PC to accept connections from other Bluetooth Devices :
Quote:
obexserver

Go to your Gallery of the Phone and do Send file with Bluetooth. For Nokia 6630 :
Quote:
Menu -> Gallery -> Images -> NamePhoto.jpg -> Options -> Send -> Via Bluetooth

and Select your Pc and click SELECT
You can find your files into the temp directory /tmp/

Tips

This works perfectly on Nokia 6630 but i think it could works on ALL Nokia Phone with Bluetooth because we use the Channel number 10 which is the default channel of all Nokia Phone.
I think also that if you know the channel number of your Phones which isn't Nokia you could replace in the How To and it could works !

Everytime that you reboot you must re apply this things (which you could insert into a boot-script)
Quote:
modprobe l2cap
sudo modprobe rfcomm
sudo mknod /dev/rfcomm0 c 216 0
sdptool add --channel=10 OPUSH
sudo rfcomm bind /dev/rfcomm0 YOUR_PHONE_ADDRESS 10


Have Fun Ubuntu's user !!!
上次由 oneleaf 在 2005-06-01 10:15,总共编辑 1 次。
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
yongyi
帖子: 3025
注册时间: 2005-05-07 23:57
联系:

通过蓝牙连接Hoary和诺基亚手机

#2

帖子 yongyi » 2005-05-30 13:15

这个how to已经用Hoary、诺基亚6630和一个道尔芯片(Dongle)蓝牙(Usb蓝牙)测试过了。

通过这个How to,你可以:

-通过蓝牙,从你的电脑发送文件到你的诺基亚手机
-通过蓝牙,从你的诺基亚手机发送文件到你的电脑
-用蓝牙做任何你需要的事情



让我们开始吧!

-打开新立得软件包管理器

代码: 全选

sudo synaptic
-安装这些软件包和他们的依赖

代码: 全选

gnome-bluetooth
obexserver
bluez-utils


-加载这个模块到核心:l2cap, rfcomm

代码: 全选

sudo modprobe l2cap
sudo modprobe rfcomm
-建立一个新的Dongle设备。我们建立一个由Usb到串口设备的虚拟绑定

代码: 全选

sudo mknod /dev/rfcomm0 c 216 0


-激活你手机的蓝牙。对于诺基亚6630:

Menu -> Connect. -> Bluetooth -> On
菜单->连接->蓝牙->开

Menu -> Connect. -> Bluetooth -> My phone's visibility -> Shown to all
菜单->连接->蓝牙->本手机的可见性->全部

Menu -> Connect. -> Bluetooth -> My Phone's Name -> "Insert a name for your phone"
菜单->连接->蓝牙->我的手机名称->输入一个你手机的名称



-搜索你的手机

代码: 全选

hcitool scan
这个应用将扫描蓝牙的设备。它会显示一些像这样的信息:

代码: 全选

扫描中 ...
00:11:9F:C0:FE:21 你手机名称


开始的数字就是你手机的地址。显然,你的会不同!
复制你的地址到粘贴板!

-编辑 /etc/bluetooth/rfcomm.conf:

代码: 全选

sudo gedit /etc/bluetooth/rfcomm.conf



取消所有内容,并输入这些:

代码: 全选

rfcomm0 {

device 你的手机地址;
channel 10;
comment "What you want ";

} 

在“你的手机地址”,你必须输入你已经写在粘贴板的那个地址。例如:

代码: 全选

rfcomm0 {

device 00:11:9F:C0:FE:21;
channel 10;
comment "My Nokia Phone";

} 


-添加诺基亚频道(10),用来与你的手机通讯

代码: 全选

sudo sdptool add --channel=10 OPUSH
-绑定

代码: 全选

sudo rfcomm bind /dev/rfcomm0 你手机地址 10
例如:

代码: 全选

rfcomm bind /dev/rfcomm0 00:11:9F:C0:FE:21 10



-现在我们可以测试一下连通性

从电脑到你的诺基亚手机的传送

代码: 全选

gnome-obex-send 文件名
例如:

代码: 全选

gnome-obex-send /home/massi/Desktop/Video.3gp
它将会提示有蓝牙设备。选择你的手机,确定。



从你的诺基亚到你电脑的传送
激活你电脑上的ObexServer去接受来自其他蓝牙设备的连接:

代码: 全选

obexserver


去到你手机的图库,然后利用蓝牙传送文件。对于诺基亚6630:
Menu -> Gallery -> Images -> NamePhoto.jpg -> Options -> Send -> Via Bluetooth
菜单->图库->图像->图片名.jpg->选项->发送->通过蓝牙

接着选择你的电脑,并点击选择
你可以在临时文件夹 /tmp/里找到你的文件。



技巧:
这在诺基亚6630上工作得很完美,但我认为使用蓝牙,可以在全部诺基亚手机上工作。因为我们使用的频道号码10是诺基亚手机默认频道。

如果你的手机不是诺基亚,但你知道了你手机的频道号码,你可以在How To里替换,我想它也可以工作的!



每一次重启,你都必须重新应用这些(这些你可以写入一个启动脚本(boot-script))

代码: 全选

modprobe l2cap
sudo modprobe rfcomm
sudo mknod /dev/rfcomm0 c 216 0
sdptool add --channel=10 OPUSH
sudo rfcomm bind /dev/rfcomm0 YOUR_PHONE_ADDRESS 10

玩得开心,Ubuntu的用户!!!
独自看一看大海
总想起身边走在路上的朋友
Lenovo E290-420[Celeron-M420/256M/60G/Intel GMA950]
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#3

帖子 oneleaf » 2005-06-01 10:15

当净其意如虚空,远离妄想及诸取,令心所向皆无碍
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#4

帖子 oliver » 2006-02-24 11:55

在计算机上使用hcitool scan扫描蓝牙设备找不到任何设备,但是我在Nokia7610手机上面却能够通过蓝牙端口扫描到我的计算机——“Ubunto-0“ ,但是用手机与”ubuntu-0"配对却提示“无法与Ubuntu-0“配对……
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#5

帖子 firehare » 2006-02-24 11:57

驱动问题!
我心无畏,源自于我心无知。
图片
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#6

帖子 oliver » 2006-02-24 12:10

有解决的方法么?是我的蓝牙适配器不能够被Ubuntu驱动?可是我的手机能够发现我的蓝牙适配器设备,证明蓝牙适配器在正常工作了啊。又何来驱动问题呢?
不解。
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#7

帖子 oliver » 2006-02-24 14:19

还有,我打nokia客服电话,客服小姐说有可能是网络适配器和手机蓝牙不兼容。我也考虑过这个问题,查了相关资料,我的的蓝牙适配器是蓝牙1.2版本的协议,而手机是1.1版本的,1.2的协议向下兼容1.1版本协议。应该不是这方面原因。客服小姐说换个适配器试试(晕,我的这个适配器还是好不容易从外地买进的……)刚到手,是新的……就用不起来 ,不知道什么原因……还想等着通过蓝牙将一些文本文件传输到手机上头慢慢看来着……(用读卡器好麻烦,即使是一个文本文件也得将手机断电拆壳取下MMC卡……)
这不,我还等着蓝牙配置好用起来呢……
:(
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#8

帖子 firehare » 2006-02-24 18:59

驱动是联系你的蓝牙适配器与电脑之间的东东,与你蓝牙适配器和手机之间应该没有太大关系吧,插在电脑上,给蓝牙适配器供电,蓝牙适配器就应该可以发信号了吧!纯粹瞎想,供兄弟参考!
我心无畏,源自于我心无知。
图片
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#9

帖子 oliver » 2006-02-24 19:15

firehare兄,谢谢!~如果买错了蓝牙适配器导致和手机硬件不兼容我只能够自认晦气,破财。但是蓝牙适配器和电脑之间的驱动问题应该不成问题。蓝牙适配机附带windows驱动,我在windows平台也试过了,手机能够识别蓝牙适配器,但是计算机就是不能够通过兰芽适配器识别手机。而且我在windows的硬件管理里头看过,蓝牙适配器已经安装。
我最怕的是硬件不兼容,那就是我的问题了,就是我买错了东西,网上买的,退换时很麻烦的。
但是我想通讯协议应该是向下兼容的,我的手机蓝牙版本是1.1,而蓝牙适配器的蓝牙协议版本是1.2,我google了下,
在IBM蓝牙技术部分看到如下一段内容
目前市场上设备中运行的蓝牙协议有三个版本 —— 分别是版本 1.1、1.2 AFH 和 2.0+EDR。这没给开发人员带来任何问题,因为新版本的协议与以前的版本兼容。表 1 显示了目前可用的蓝牙版本的一些相似性与区别。
于是我放心了,但愿是我设置有问题吧,但是我设置似乎没有问题。我担心是否刚买的东西是个坏的……那岂不是麻烦了 :(
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#10

帖子 firehare » 2006-02-24 21:40

:)
兄弟你是说在 Windows 下也是如此??
我心无畏,源自于我心无知。
图片
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#11

帖子 oliver » 2006-02-25 7:26

对!~蓝牙适配器协议是1.2(第二版),手机蓝牙协议是1.1(第一版) 。手机能够搜索到蓝牙适配器,而配对则会提示“无法和**配对"。如果说Linux不能够驱动该蓝牙适配器,那么windows是能够的,应为包装上就写了支持windows,而且附带的光盘也有exe格式的驱动以及蓝牙应用程序。
但是在windows平台也是单方面,手机能够识别电脑,电脑不能够识别手机。
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#12

帖子 oliver » 2006-02-25 9:14

世上不如意事情十之八九,蓝牙事件可见一端。无奈……本来花钱就是图个便利,就是为了提高效率。
搞不清究竟是哪里出了问题,是我的设置问题?还是手机抑或是蓝牙适配器的硬件问题呢?
付完了钱,卖家就不理睬我了,无奈,发出的短信都是石沉大海。……不过即使是他回复我,恐怕也是解决不了问题的。原水解不了近火……
算了,就暂时将他(适配器)尘封起来了。
还是不厌其烦的关机,取出电池,掏出钱包,取出MMC卡以及适配器,连接好,然后通过读卡器传输好文件,然后拆解适配器,然后再他们归位……
如果Nokia公司能够开发Linux平台的PC套件以及数据线驱动就好了(做梦)

:(
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#13

帖子 firehare » 2006-02-25 9:20

同情中...
我心无畏,源自于我心无知。
图片
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#14

帖子 oliver » 2006-02-25 21:27

有进展了~ 我的手机型号是Nokia7610 ,输入命令:“*#2820#”取得手机的蓝牙设备号,然后直接在计算机上面添加这个地址的远端蓝牙设备(我先在windows上通过ivt程序操作,然后竟然发现手机设备了!)
曙光来了…… 选择配对……提示超时,重复几次依旧……
于是我切换到linux操作,添加频道,邦定手机……然后尝试从计算机向手机传送文件……
oliver@ubuntu:~$ gnome-obex-send ~/Desktop/test bluetooth.txt
** Message: inquiry complete
查询结束,难道也是超时?

于是我激活obexserer,尝试用手机连接计算机。
oliver@ubuntu:~$ obexserver
Waiting for connection..
.
手机能够搜索到计算机"ubuntu-0",然后提示“正在等待ubuntu-0",最后还是失败了——失败提示“无法和ubuntu配对“。
不定什么时候就能够搞定了…… ^_^ 先搁置。
头像
oliver
帖子: 775
注册时间: 2005-10-05 11:31
联系:

#15

帖子 oliver » 2006-04-01 17:17

这个问题搁置了好长时间。一直找不到解决的方法(windows下也用不了,不知道是我的手机问题还是蓝牙适配器问题亦或是蓝牙协议问题)。一个礼拜以前我还是与商家联系,添了钱换了一个更高协议的蓝牙适配器。
拿到手以后我在图形界面的蓝牙设备管理器里面能够搜索到手机了,然后我按照说明在命令行终端配置了下,提示不能连接,然后根据错误信息,我更改频道号为9(我的手机型号是Nokia7610)。然后能够成功连接上。于是我在文本界面尝试发送一个测试用文本文件:test.txt,于是手机上收到了一条蓝牙信息,文件发送成功了。
^_^
不过依旧还存在些问题,用手机不能够连接计算机。手机连接计算机要求输入配对密码,随便输入一个,提示不能配对。于是目前为止还只能从计算机往手机发送资料。另外,Applications->System Tools->Bluetooth File sharing是用来接受手机发送文件,而Bluetooth Manager则是用来管理蓝牙设备。难道没有用来向蓝牙手机发送文件的图形化界面程序么?如果发送文件能够更加便利就好了(例如右键选中文件然后选择“send to”直接能够通过蓝牙发送文件就好了)
回复