Skip to content

Commit 9fe7d75

Browse files
committed
update readme and some help print
1 parent 55aad7c commit 9fe7d75

File tree

6 files changed

+52
-103
lines changed

6 files changed

+52
-103
lines changed

README.md

+41-36
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,113 @@
11
BTLE
22
========
33

4-
BTLE is a free and open-source Bluetooth Low Energy (BLE) software suite developed by Xianjun Jiao.
4+
BTLE is a free and open-source Software Defined Radio Bluetooth Low Energy (BLE) software suite.
55

66
It includes:
7-
* btle_rx - a complete BLE sniffer. Besides sniff broadcasting/fixed channel, it also can track channel hopping of a communication link.
8-
* btle_tx - a universal BLE packet generator. Besides BLE standard, it also supports raw bit mode to generate arbitrary GFSK packet. In this way, you can test private protocol or planned standard feature even before ASIC is ready.
9-
10-
This project is based on [HackRF](https://github.com/mossmann/hackrf) and [bladeRF](https://github.com/Nuand/bladeRF).
11-
See [compatible version of HackRF and bladeRF libraries](compatible_hackrf_bladerf_lib.txt).
7+
* btle_rx - BLE sniffer. Besides sniff broadcasting/fixed channel, it can also track channel hopping of a communication link.
8+
* btle_tx - Universal BLE packet transmitter. Besides BLE standard, it supports also raw bit mode to generate arbitrary GFSK packet. In this way, you can test non-standard protocol or standard under discussion before chip in the market.
129

1310
Features
1411
---------------
1512

1613
* PHY and upper layer are implemented in software (C language). Full Software Defined Radio Flexibility.
17-
* BLE standard 1Mbps GFSK PHY rate.
14+
* BLE standard 1Mbps GFSK PHY.
1815
* All ADV and DATA channel link layer packet formats in Core_V4.0 (Chapter 2&3, PartB, Volume 6) are supported.
1916
* Sniffer is capable to parse and track channel hopping pattern automatically, not limited to broadcasting channel or fixed channel.
2017

2118
Hardware
2219
--------
2320

24-
* HackRF
25-
* bladeRF
21+
* [HackRF](https://github.com/mossmann/hackrf)
22+
* [bladeRF](https://github.com/Nuand/bladeRF)
23+
* [compatible version of HackRF and bladeRF libraries](compatible_hackrf_bladerf_lib.txt)
2624

2725
Build and Quick test
2826
------------------
2927

30-
* Mandatory requirements: check this link https://github.com/mossmann/hackrf/tree/master/host
31-
32-
* RF front-end driver:
33-
* HackRF: https://github.com/mossmann/hackrf
34-
* BladeRF: https://github.com/Nuand/bladeRF
28+
Make sure your SDR hardware environment (driver/lib) has been setup correctly before run this project.
3529

36-
Instructions:
3730
```
3831
git clone https://github.com/JiaoXianjun/BTLE.git
3932
cd BTLE/host
4033
mkdir build
4134
cd build
4235
cmake ../ (default. for HackRF)
43-
cmake ../ -DUSE_BLADERF=1 (for bladeRF)
44-
```
45-
without -DUSE_BLADERF=1 in above cmake means HACKRF will be used by default
46-
```
36+
cmake ../ -DUSE_BLADERF=1 (only for bladeRF)
37+
4738
make
4839
./btle-tools/src/btle_rx
4940
```
50-
Above command sniffs on channel 37. You should see many packets on screen.
41+
Above command sniffs on channel 37. You should see many packets on screen if you have BLE devices (phone/pad/laptop) around.
5142
```
5243
./btle-tools/src/btle_tx 37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040506-LOCAL_NAME09-SDR/Bluetooth/Low/Energy r500
5344
```
5445
Above command transmits discovery packets on ADV channel. You should see a device with name "SDR/Bluetooth/Low/Energy" in another BLE sniffer App (such as LightBlue).
5546

56-
~~**MAY NOT BE NECESSARY**: To support fast/realtime sender and scanner/sniffer, I have changed:~~
47+
~~**MAY NOT BE NECESSARY**: To support fast/realtime sender and scanner/sniffer, I ever changed:~~
5748

5849
~~lib_device->transfer_count to 4~~
5950

6051
~~lib_device->buffer_size to 4096~~
6152

62-
~~in hackrf driver: hackrf.c. You should also do that change to your HackRF driver source code and re-compile, re-install~~
63-
53+
~~in hackrf driver: hackrf.c. Maybe you should also do that change to your HackRF driver source code and re-compile, re-install~~
6454

6555
btle_rx usage
6656
------------------
6757
```
6858
btle_rx -c chan -g gain -a access_addr -k crc_init -v -r
6959
```
7060
```
71-
-c chan
61+
-h --help
62+
```
63+
Print this help screen
64+
```
65+
-c --chan
7266
```
7367
Channel number. Default value 37 (one of ADV channels). Valid value 0~39 (all ADV and DATA channels).
7468
```
75-
-g gain
69+
-g --gain
70+
```
71+
VGA gain. default value 6. valid value 0~62. Gain should be tuned very carefully to ensure best performance under your circumstance. Suggest test from low gain, because high gain always causes severe distortion and get you nothing.
72+
```
73+
-l --lnaGain
74+
```
75+
LNA gain in dB. HACKRF lna default 32, valid 0~40, lna in max gain. bladeRF default is max rx gain 32dB (valid 0~40). Gain should be tuned very carefully to ensure best performance under your circumstance.
7676
```
77-
VGA gain. default value 6. valid value 0~62. LNA has been set to maximum 40dB internally. Gain should be tuned very carefully to ensure best performance under your circumstance. Suggest test from low gain, because high gain always causes severe distortion and get you nothing.
77+
-b --amp
7878
```
79-
-a access_addr
79+
Enable amp (HackRF). Default off.
80+
```
81+
-a --access
8082
```
8183
Access address. Default 8e89bed6 for ADV channel 37 38 39. You should specify correct value for data channel according to captured connection setup procedure.
8284
```
83-
-k crc_init
85+
-k --crcinit
8486
```
8587
Default 555555 for ADV channel. You should specify correct value for data channel according to captured connection setup procedure.
8688
```
87-
-v
89+
-v --verbose
8890
```
8991
Verbose mode. Print more information when there is error
9092
```
91-
-r
93+
-r --raw
9294
```
9395
Raw mode. After access addr is detected, print out following raw 42 bytes (without descrambling, parsing)
94-
```
95-
-o --hop
96-
```
97-
This will turn on data channel tracking (frequency hopping) after link setup information is captured in ADV_CONNECT_REQ packet on ADV channel.
9896
```
9997
-f --freq_hz (need argument)
10098
```
10199
This frequency (Hz) will override channel setting (In case someone want to work on freq other than BTLE. More general purpose).
102100
```
103101
-m --access_mask (need argument)
104102
```
105-
If a bit is 1 in this mask, corresponding bit in access address will be taken into packet existing decision (In case someone want a shorter/sparser unique word to do packet detection. More general purpose).
103+
If a bit is 1 in this mask, corresponding bit in access address will be taken into packet existing decision (In case someone want a shorter/sparser unique word to do packet detection. More general purpose).```
104+
-o --hop
105+
```
106+
This will turn on data channel tracking (frequency hopping) after link setup information is captured in ADV_CONNECT_REQ packet on ADV channel.
107+
```
108+
-s --filename
109+
```
110+
Store packets to pcap file.
106111
107112
btle_tx usage
108113
------------------
@@ -212,7 +217,7 @@ Demos
212217
213218
See a comparison with TI's packet sniffer here: [http://sdr-x.github.io/BTLE-SNIFFER/](http://sdr-x.github.io/BTLE-SNIFFER/)
214219
215-
See <a href="https://youtu.be/9LDPhOF2yyw">btle_rx video demo</a> (youtube) or <a href="https://vimeo.com/144574631">btle_rx video demo</a> (in China) and <a href="http://youtu.be/Y8ttV5AEb-g">btle_tx video demo 1</a> (outside China) or <a href="http://v.youku.com/v_show/id_XNzUxMDIzNzAw.html">btle_tx video demo 2</a> (inside China)
220+
See <a href="https://youtu.be/9LDPhOF2yyw">btle_rx video demo</a> or <a href="https://vimeo.com/144574631">btle_rx video demo</a> (in China) and <a href="http://youtu.be/Y8ttV5AEb-g">btle_tx video demo 1</a> or <a href="http://v.youku.com/v_show/id_XNzUxMDIzNzAw.html">btle_tx video demo 2</a> (in China)
216221
217222
# Appendix: Packet descriptor examples of btle_tx for all formats
218223
------------------

compatible_hackrf_bladerf_lib.txt

+5-19
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,11 @@ Following versions were tested. Not means other versions won't work.
22

33
bladeRF:
44

5-
/usr/include/libbladeRF.h:
6-
#define LIBBLADERF_API_VERSION (0x01080000)
7-
8-
#apt-cache policy libbladerf-dev
9-
libbladerf-dev:
10-
Installed: 0.2016.06-2
11-
Candidate: 0.2016.06-2
12-
Version table:
13-
*** 0.2016.06-2 500
14-
500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
15-
100 /var/lib/dpkg/status
5+
bladeRF-cli --version
6+
1.8.0-0.2019.07-5
167

178
HackRF:
189

19-
apt-cache policy libhackrf-dev
20-
libhackrf-dev:
21-
Installed: 2018.01.1-2
22-
Candidate: 2018.01.1-2
23-
Version table:
24-
*** 2018.01.1-2 500
25-
500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
26-
100 /var/lib/dpkg/status
10+
hackrf_info
11+
hackrf_info version: git-f202160
12+
libhackrf version: git-f202160 (0.5)

host/btle-tools/src/btle_rx.c

+3-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
// BLE sniffer by Xianjun Jiao ([email protected])
1+
// Bluetooth Low Energy SDR sniffer by Xianjun Jiao ([email protected])
22

3-
/*
4-
* Copyright 2012 Jared Boone <[email protected]>
5-
* Copyright 2013-2014 Benjamin Vernoux <[email protected]>
6-
*
7-
* This file is part of HackRF and bladeRF.
8-
*
9-
* This program is free software; you can redistribute it and/or modify
10-
* it under the terms of the GNU General Public License as published by
11-
* the Free Software Foundation; either version 2, or (at your option)
12-
* any later version.
13-
*
14-
* This program is distributed in the hope that it will be useful,
15-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17-
* GNU General Public License for more details.
18-
*
19-
* You should have received a copy of the GNU General Public License
20-
* along with this program; see the file COPYING. If not, write to
21-
* the Free Software Foundation, Inc., 51 Franklin Street,
22-
* Boston, MA 02110-1301, USA.
23-
*/
243
#include <pthread.h>
254
#include "common.h"
265

@@ -694,6 +673,8 @@ static void print_usage() {
694673
printf(" If a bit is 1 in this mask, corresponding bit in access address will be taken into packet existing decision (In case someone want a shorter/sparser unique word to do packet detection. More general purpose)\n");
695674
printf(" -o --hop\n");
696675
printf(" This will turn on data channel tracking (frequency hopping) after link setup information is captured in ADV_CONNECT_REQ packet\n");
676+
printf(" -s --filename\n");
677+
printf(" Store packets to pcap file.\n");
697678
printf("\nSee README for detailed information.\n");
698679
}
699680
//----------------------------------print_usage----------------------------------
@@ -2174,7 +2155,6 @@ void receiver(IQ_TYPE *rxp_in, int buf_len, int channel_number, uint32_t access_
21742155
if(filename_pcap != NULL)
21752156
write_packet_to_file(fh_pcap_store, payload_len+2, tmp_byte, channel_number, access_addr);
21762157

2177-
21782158
if (adv_flag) {
21792159
printf("ADV_PDU_t%d:%s T%d R%d PloadL%d ", adv_pdu_type, ADV_PDU_TYPE_STR[adv_pdu_type], adv_tx_add, adv_rx_add, payload_len);
21802160

host/btle-tools/src/btle_tx.c

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,4 @@
1-
// BTLE packet sender tool by Xianjun Jiao ([email protected])
2-
3-
/*
4-
* Copyright 2012 Jared Boone <[email protected]>
5-
* Copyright 2013-2014 Benjamin Vernoux <[email protected]>
6-
*
7-
* This file is part of HackRF and bladeRF.
8-
*
9-
* This program is free software; you can redistribute it and/or modify
10-
* it under the terms of the GNU General Public License as published by
11-
* the Free Software Foundation; either version 2, or (at your option)
12-
* any later version.
13-
*
14-
* This program is distributed in the hope that it will be useful,
15-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17-
* GNU General Public License for more details.
18-
*
19-
* You should have received a copy of the GNU General Public License
20-
* along with this program; see the file COPYING. If not, write to
21-
* the Free Software Foundation, Inc., 51 Franklin Street,
22-
* Boston, MA 02110-1301, USA.
23-
*/
1+
// Bluetooth Low Energy SDR transmitter tool by Xianjun Jiao ([email protected])
242

253
#include "common.h"
264

usrp_replay_example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ replay above script generated btle_ch37_iq_float32_welcom_msg.bin in replay_for_
88

99
Install LightBlue in your iPhone or other similar things of Android, and open the App.
1010

11-
You will see a welcome message "imecUGent SDRgroup welcome u!" on your phone.
11+
You will see a welcome message "SDR Bluetooth LE welcome u!" on your phone.

usrp_replay_example/welcom_packets_discovery.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# r30
1515

16-
37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040506-LOCAL_NAME09-imecUGent SDRgroup welcome u!
16+
37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040506-LOCAL_NAME09-SDR Bluetooth LE welcome u!
1717

1818
#37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040500-LOCAL_NAME09-CA0000 11950 22.626 113.823 1
1919
#37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040501-LOCAL_NAME09-CA0001 11950 22.626 113.823 1

0 commit comments

Comments
 (0)