1

Followed by the sample, I started my Pi with the command:

pi@raspberrypi ~ $ sudo hciconfig hci0 up
pi@raspberrypi ~ $ 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
    RX bytes:1094 acl:0 sco:0 events:54 errors:0
    TX bytes:768 acl:0 sco:0 commands:54 errors:0

pi@raspberrypi ~ $ 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
< HCI Command: ogf 0x08, ocf 0x0008, plen 44
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
> HCI Event: 0x0e plen 4
01 08 20 12
pi@raspberrypi ~ $ sudo hciconfig hci0 leadv 3

Then, turned on my Android 4.4 phone which works perfectly with the Ibeacon devices I ordered from online retailers(no brand).

works perfectly means I can see all the advertising data in Java code(by following onLeScan(...) callback), as well as the RSSI, and parsing them(UUID, major, minor and etc.).

The strange thing is I put a debug info into:

public synchronized void onLeScan(final BluetoothDevice device,
                int rssi, byte[] scanRecord)

the byte[] scanRecord I got from PI is:

02 01 0A 02 0A 08 0C 09 43 53 52 38 35 31 30 20 41 31 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

I can't read these bytes which seems totally mismatched with the one set via Pi command line, I tried with the App IBeacon Locate, still couldn't find my Pi, please help, thanks.

Add more details: Only the BLE dongle is a different brand from the sample since I'm not in US, and I'm not sure if its drivers were installed correctly in PI and actually I didn't explicitly installed any drivers for it(I'm a new guy for Linux), I just pulg in and started the command line.

Shawn
  • 702
  • 1
  • 9
  • 36

1 Answers1

1

Some folks with different bluetooth dongles have reported having to alter the order of the commands and disabling advertising before enabling it. Try:

sudo hciconfig hci0 up
sudo hciconfig hci0 noleadv
sudo hciconfig hci0 leadv 
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

You might also let us know the model of your bluetooth dongle and what it reports itself as to Linux. You can see this by typing lsusb

BTW, nice job capturing the bytes read by Android's onLEScan method. Super helpful!

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • `lsusb` say: `Bus 001 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)`, I tried your new sequence of command, but seems the scanRecord are the same as before, any idea? – Shawn Jun 10 '14 at 03:10
  • I got another issue with the Pi in Ibeacon 'sensor mode', I turned on my Ibeacon broadcasting device, but now the `sudo hcidump --raw` show: `7C:66:9D:9F:C5:8B Bytereal > 04 3E 1E 02 01 04 00 8B C5 9F 9D 66 7C 12 09 09 42 79 74 65 72 65 61 6C 00 00 00 00 00 00 00 00 AD `, You can see it read the correct device name, but the hex data is far from the correct one in android scanResult: `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 0A 00 08 C5 09 09 42 79 74 65 72 65 61 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00` – Shawn Jun 11 '14 at 08:35
  • What version of Bluez do you have? – davidgyoung Jun 11 '14 at 11:59
  • I followed all the command in your [post](http://developer.radiusnetworks.com/2013/10/09/how-to-make-an-ibeacon-out-of-a-raspberry-pi.html) – Shawn Jun 11 '14 at 14:26
  • I saw this [post](http://stackoverflow.com/questions/20300334/raspberry-ibeacon-not-detecting?rq=1) which talking about the same issue as my original question for Pi broadcasting the unexpected data, they said they removed some '0' and then works. I'll try tomorrow, but how explain the issue for 'sensor mode' wrong data?? – Shawn Jun 11 '14 at 15:10
  • Can you post a new question for the 'sensor mode' issue, including the exact commands you enter to get the output shown? Seems like this is a different issue that needs more detail. – davidgyoung Jun 11 '14 at 18:03