[分享]蓝牙配置过程,大家参考下

CPU/显卡/打印机/USB设备等硬件问题
回复
big
帖子: 5
注册时间: 2006-12-24 14:12

[分享]蓝牙配置过程,大家参考下

#1

帖子 big » 2006-12-26 18:12

我机器是ibm t43+ubuntu 6.10,手机是nokia n70,symbian8.1 series 60
1,开启蓝牙
2.6版本的内核,应该都支持ibm-acpi的,不行的话,可以自己重新编译内核,加入ibm-laptop的支持。这样我们可以轻松的通过Fn+F5的组合键开启蓝牙,或者是# echo enable > /proc/acpi/ibm/bluetooth
关闭的话就用disable好了
2,配置内核
这个现在默认的一般都会配置好的,重新编译的话自己检查下吧,没选的就选上吧,主要是:usb 和 bluetooth的相关选项,最后执行
modprobe uhci_hcd ; modprobe ehci_hcd ; modprobe hci_usb
准备好后,我简单介绍下文件传输和使用p3nfd把手机mount到机器的过程吧,还可以通过把手机当作moderm,通过gprs连接internet,这个我没试大家实验下吧。

实现文件传输

文件传输是通过obex传输实现的,其实操作到很简单的
#/etc/init.d/bluetooth start
#hcitool scan
这样我们可以找到设备了,我运行后显示的是:
00:15:A0:EB:BC:C3 Nokia N70
前一个是手机的mac地址,后面则是蓝牙设备名称可以在手机上自定义的
直接运行
obexftp -b 00:15:A0:EB:BC:C3 -l
就可以显示手机的根目录,传输文件的话就用命令
obexftp -b 00:15:A0:EB:BC:C3 -p ~/....就可以了
当然手机也是可以传送给电脑的,只需要找到想传送的文件,选择传输-通过蓝牙 就可以了很方便的

实现将手机mount到本地的目录


这个我们需要一些工具的支持,网上查了下,现在手机系统很多有symbian,linux等等,nokia的基本都是用的symbian,moto则用 linux的很多,根据你手机的系统,若是symbian选择安装p3nfs,其他的话选则fuse吧,用过ntfs-3g的朋友应该不会陌生吧,当然还有一些工具我们也是不能少的,bluez-utils,
obexfs,直接apt-get吧
然后修改/etc/bluetooth/hcid.conf文件,我的文件最后是这样的:
################hcid.conf################################
#
# HCI daemon configuration file.
#

# HCId options
options {
# Automatically initialize new devices
autoinit yes;

# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security user;

# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;

# Default PIN code for incoming connections
passkey "8888";

}

# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h-%d";

# Local device class
class 0x3e0100;

# Default packet type
#pkt_type DH1,DM1,HV1;

# Inquiry and Page scan
iscan enable; pscan enable;
discovto 0;

# 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;

# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
}
##########end of hcid.conf########################
其中都有说明,大家看下就可以了,有一点要注意的是手机的pin码要记得哦,第一次连接的时候要输入的,默认的是1234,我改成了8888
然后加载如下的模块
# modprobe fuse
# modprobe bluetooth
# modprobe ehci-hcd
# modprobe uhci-hcd
# modprobe hci_usb
# modprobe l2cap
# modprobe rfcomm
最后,启动蓝牙
(1) fn+F5,或者echo enable >/proc/acpi/ibm/bluetooth
(2) # /etc/init.d/bluetooth start
(3) hcitool scan
(4) 非symbian用户可以直接挂接了
例如,执行
#mkdir /mnt/phone
#mount -t fuse "obexfs#-b00:15:A0:EB:BC:C3 -B6" /mnt/phone
symbian用户需要在你的内核中开启network file system的支持,这个很重要,没有的话切到源码目录下,编译加进去吧
接着需要安装p3nfs,apt-get应该可以的,我的是原来debian下拷贝过来的
还要修改/etc/bluetooth/rfcomm.conf文件
我的内容大致为:
rfcomm0 {
bind yes;
device 00:15:A0:EB:BC:C3;
channel 13;
comment "symbian connection"
}
这个可能有人会没有/dev/rfcomm0文件,没有的话创建个吧
接着要执行:
# /etc/init.d/bluetooth restart
# modprobe nfs
# modprobe nfsd
# /etc/init.d/portmap start
还需要在你的手机上安装一个nfsapp,到p3nfs主页上下吧http://www.koeniglich.de/p3nfs.html 接着是执行: obexftp -b 00:15:A0:EB:BC:C3 -p /home/titan/nfsapp*这时手机会提示安装,安装后运行nfsapp,
接着我们可以mount手机了:
p3nfsd -series60 -tty /dev/rfcomm0 -dir /mnt/phone
成功后应该有这个提示:
p3nfsd: version 5.19, using /dev/rfcomm0 (115200), mounting on /mnt/phone/
p3nfsd: to stop the server do "ls /mnt/bluetooth//exit". (pid 20642)
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#2

帖子 skyx » 2006-12-31 17:15

传文件可以不用这么麻烦
安装blue tooth obex client就可以了,也就是bluetooth file transfer ,当前的新版是0.99beta1,完全图形界面,装好后应用点程序--->internet---->blue tooth obex client

打开后让手机可被查找,然后在blue tooth obex client上点 serching就可以搞定文件传输。

个人认为这是最简单的办法了。
Sa
帖子: 9
注册时间: 2007-04-07 19:17

#3

帖子 Sa » 2007-04-12 17:59

这个是笔记本必须内置蓝牙才可以用bluez-utils的吧?
Sa
帖子: 9
注册时间: 2007-04-07 19:17

#4

帖子 Sa » 2007-04-12 18:02

Sa 写了:这个是笔记本必须内置蓝牙才可以用bluez-utils的吧?
如何电脑没有蓝牙,就必须用蓝牙适配器是这个意思吗?
头像
skyx
论坛版主
帖子: 9202
注册时间: 2006-12-23 13:46
来自: Azores Islands
联系:

#5

帖子 skyx » 2007-04-13 14:53

skyx 写了:传文件可以不用这么麻烦
安装blue tooth obex client就可以了,也就是bluetooth file transfer ,当前的新版是0.99beta1,完全图形界面,装好后应用点程序--->internet---->blue tooth obex client

打开后让手机可被查找,然后在blue tooth obex client上点 serching就可以搞定文件传输。

个人认为这是最简单的办法了。

刚才有会员发站内短讯问这个问题:

安装:

sudo apt-get install kdebluetooth

如果安装时系统有推荐或建议,都装上吧。


no security measure is worth anything if an attacker has physical access to the machine
回复