Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5114814
  • 博文数量: 1210
  • 博客积分: 12961
  • 博客等级: 上将
  • 技术积分: 14586
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-09 11:25
  • 认证徽章:
个人简介

偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.

文章分类

全部博文(1210)

文章存档

2019年(187)

2018年(81)

2017年(80)

2016年(70)

2015年(52)

2014年(41)

2013年(51)

2012年(85)

2011年(45)

2010年(231)

2009年(287)

分类: Android平台

2016-06-29 11:14:16

1. Ubuntu12.04查看BlueZ版本:
#dpkg --status bluez | grep '^Version:'
Version: 4.98-2ubuntu7

http://www.ioncannon.net/linux/1570/bluetooth-4-0-le-on-raspberry-pi-with-bluez-5-x/

2.查看蓝牙适配器:
root@wv-ThinkPad-SL:/home/wv# hciconfig
hci1:    Type: BR/EDR  Bus: USB
    BD Address: 00:23:4D:FD:01:9C  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING PSCAN 
    RX bytes:856 acl:0 sco:0 events:36 errors:0
    TX bytes:886 acl:0 sco:0 commands:36 errors:0

root@wv-ThinkPad-SL:/home/wv# hciconfig
hci0:    Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING PSCAN 
    RX bytes:822 acl:0 sco:0 events:33 errors:0
    TX bytes:877 acl:0 sco:0 commands:33 errors:0

hci1:    Type: BR/EDR  Bus: USB
    BD Address: 00:23:4D:FD:01:9C  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING PSCAN 
    RX bytes:856 acl:0 sco:0 events:36 errors:0
    TX bytes:886 acl:0 sco:0 commands:36 errors:0

3. 扫描LE设备:
root@wv-ThinkPad-SL:/home/wv# hcitool lescan
LE Scan ...
90:59:AF:27:B6:C9 (unknown)
90:59:AF:27:B6:C9 Keyfobdemo

4. 配置Advertise:
其中: HELLO WORLD" would use: 48 45 4c 4c 4f 57 4f 52 4c 44
sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00

5. 激活Advertising:
开始广播并可连接:
sudo hciconfig hci0 leadv 0
只开始广播不可连接:
sudo hciconfig hci0 leadv 3

6. 停止Advertising:
sudo hciconfig hci0 noleadv

7. 升级BlueZ:
sudo apt-get install build-essential libdbus-1-dev check
./configure --prefix=/home/wv/source/bluez/bin/bluez --mandir=/home/wv/source/bluez/bin/man --sysconfdir=/home/wv/source/bluez/bin/etc --localstatedir=/home/wv/source/bluez/bin/var --enable-library --enable-test --with-dbusconfdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 --with-dbussystembusdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 --with-dbussessionbusdir=/home/wv/source/bluez/bin/dbus/etc/dbus-1 这个路径有问题,还没有成功
make && make install

报错:configure: error: D-Bus >= 1.6 is required
wv@wv-ThinkPad-SL:~/source/bluez/bluez-5.15$ dbus-daemon --version
D-Bus Message Bus Daemon 1.4.18
需要升级DBus:
下载DBus: https://launchpad.net/ubuntu/+source/dbus/1.6.12-0ubuntu10
    ./configure --prefix=/home/wv/source/bluez/bin/dbus
    make
    su make install

configure: WARNING: unrecognized options: --enable-library, --enable-test

                    D-Bus 1.6.12
                  ==============

    prefix:                   /home/wv/source/bluez/bin/bluez
    exec_prefix:              ${prefix}
        libdir:                   /home/wv/source/bluez/bin/bluez/lib
        libexecdir:               /home/wv/source/bluez/bin/bluez/libexec
        bindir:                   /home/wv/source/bluez/bin/bluez/bin
        sysconfdir:               /home/wv/source/bluez/bin/etc
        localstatedir:            /home/wv/source/bluez/bin/var
    datadir:                  /home/wv/source/bluez/bin/bluez/share
    source code location:      .
    compiler:          gcc
    cflags:                   -Wall -Wextra -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wno-address -Wfloat-equal -Wdeclaration-after-statement -Wno-unused-label -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare -Wno-pointer-sign -Wno-type-limits -fno-common -fno-strict-aliasing -g -O2
    cppflags:          
    cxxflags:          -g -O2
    64-bit int:          long
    32-bit int:          int
    16-bit int:          short
        Doxygen:                  no
        xmlto:                    no
        man2html:                 not found

        Rebuilding generated files: yes
        gcc coverage profiling:   
        Building embedded tests:  no
        Building modular tests:   auto
            - with GLib:          no
        Building verbose mode:    no
        Building assertions:      no
        Building checks:          yes
        Building bus stats API:   no
        Building SELinux support: no
        Building inotify support: yes
        Building dnotify support: no
        Building kqueue support:  no
        Building systemd support: no
        Building X11 code:        
        Building Doxygen docs:    no
        Building XML docs:        no
        Building cache support:   yes
        Building launchd support: no
        Using XML parser:         
        Init scripts style:       none
        Abstract socket names:    yes
        System bus socket:        /home/wv/source/bluez/bin/var/run/dbus/system_bus_socket
        System bus address:       unix:path=/home/wv/source/bluez/bin/var/run/dbus/system_bus_socket
        System bus PID file:      /home/wv/source/bluez/bin/var/run/dbus/pid
        Session bus address:      unix:tmpdir=/tmp
        Console auth dir:         /var/run/console/
        Console owner file:       no
        Console owner file path:  
    System bus user:          messagebus
    Session bus services dir: /home/wv/source/bluez/bin/bluez/share/dbus-1/services
        'make check' socket dir:  /tmp
阅读(1972) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册