锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

Ubuntu和手机通过蓝牙互传文件

时间:2022-08-03 17:19:00 110a手摇带式电容截断机

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下面,重名文件会自动更名。传递的文件保存在$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)

Chnnel: 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

参考

[[原创]linux下手机与蓝牙的连接配置](http://forum.ubuntu.org.cn/viewtopic.php?t=43475)

Update @ 2008-07-04

升级到Ubuntu 8.04 hardy后,可以用bluetooth-sendto从电脑向手机发送文件,但从手机向电脑发总是不成功,可能和适配器有关系,[也有人遇到了同样的问题](http://forum.ubuntu.org.cn/viewtopic.php?p=826513),[还有很多](http://www.google.cn/search?aq=f&complete=1&hl=zh-CN&newwindow=1&as_qdr=all&q=bluetooth+conn_complete%3A+status+0x00+bluetooth+gnome-obex-server+not+working),怀疑是[和无线局域网的信号有干扰](http://lists.gnomehack.com/pipermail/gnome-bluetooth/2007-June/001270.html),但关闭无线网之后仍不行;最后,终于发现是[bluz-utils](https://bugs.launchpad.net/ubuntu/+source/obex-data-server/+bug/211252)的问题,按照其中有一个留言的提示,把[intrepid里的bluez-utils包](https://launchpad.net/ubuntu/intrepid/i386/bluez-utils/3.30-3ubuntu2)下载下来装上,就ok啦。

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章