6

I recently was trying to configure ibeacon on a BLE dongle (cambridge silicon radio) on a raspberry pi. Reference: http://developer.radiusnetworks.com/2013/10/09/how-to-make-an-ibeacon-out-of-a-raspberry-pi.html

I get this message :

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 C9 00 00 00 00 00 00 00 00 00
  00 00 00 00
> HCI Event: 0x0e plen 4
  01 08 20 12

And the app does not even locate the beacon. Though I can see the dongle flashing some light on this command:

sudo hciconfig hci0 leadv 0

But nothing gets detected.

So go an APP named LIGHTBLUE from the appstore and it detects the bluetooth with a different UUID.

I have tried this a number of times now. And have completed all the steps in the tutorial. But this bluetooth device just wont show up.

Also, I am curious to know what is 0x08 and 0x0008 and if I want to cast a different UUID what should I do? But thats a later part...

Right now, THE BLUETOOTH wont cast the Estimote UUID as said by Radius Networks' tutorial.

Hope to receive some reply soon.

Command I wrote (after this not working I changed the power to C9):

$ 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

and surprisingly, the error is: Error: Invalid HCI Command Parameters; How come its invalid? Is it because CSR supports 128bit rather than 64bit hex?

Thanks!

Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
Videep Mishraa
  • 169
  • 2
  • 8
  • Does it work with the exact uuid provided in the tutorial, or do you see the same result? – davidgyoung Nov 30 '13 at 14:26
  • Hey! nope, nothing works I even tried updating from Bluez 5.8 to 5.11; and am completely confused now. BTW I am using a CSR(Cambridge Silicon Radio 4.0). Does it make a difference? – Videep Mishraa Dec 02 '13 at 12:47
  • what do you mean by "I changed the power to C9"? You changed something in the hcitool command? – Tim Tisdall Dec 02 '13 at 14:28
  • Tim : yes, I changed the c5 to c9 (guess thats what is the power if you check the start script on the blog). – Videep Mishraa Dec 03 '13 at 04:11

6 Answers6

11

I saw the same issue as memoryhole where I had to remove the extra zeros. I also had to enable advertising before I configured the advertising data for it to work properly with my dongle.

Here is the exact sequence/commands that worked for me:

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

This is what my version of the Radius script ended up looking like:

#!/bin/sh
. ./ibeacon.conf
echo "Launching virtual iBeacon..."
sudo hciconfig $BLUETOOTH_DEVICE up
sudo hciconfig $BLUETOOTH_DEVICE leadv 3
sudo hcitool -i $BLUETOOTH_DEVICE cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $UUID $MAJOR $MINOR $POWER 00
echo "Complete"

This was on a Rasberry Pi with a ORICO BTA-402-BK branded BLE dongle (CSR8510 A10)

(I would have left this as a comment, but didn't have enough rep)

3

I also have a CSR based USB Dongle bought in Hong Kong. I got the LE Set Advertising Data command to work by removing the extra padding at the end. According to the Bluetooth 4.0 Specification the data field should be 31 octets long. I'm not sure why the Radius Networks tutorial adds the extra zeroes. Try this:

$ 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

Note: I didn't run this on a Raspberry Pi, but an Ubuntu 12.04 laptop with bluez-4.98.

memoryhole
  • 31
  • 3
  • Interesting. I'm the co-author of the tutorial. I will gladly update if somebody else can confirm this works. The reason the extra zeroes were added is because that is exactly what we saw when we did BLE sniffing of the output of an iPad transmitting as an iBeacon. I didn't even read the spec to verify the advertisement was well-formed. Perhaps the CSR is simply picky about compliance. – davidgyoung Dec 08 '13 at 05:59
  • same here. It won't work with the extra 00's. Removing the 00s made it work for me: sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 $UUID $MAJOR $MINOR $POWER and export POWER="C5 00" in the conf file. Used the CSL dongle available from amazon for $11 – woens Jan 31 '14 at 20:15
2

I bought a few of these from amazon:

http://www.amazon.de/CSL-Bluetooth-Adapter-Technologie-neuester-Standard/dp/B00C68IQ3C

and did not get it to work in the beginning following the Radius tut. Running hcidump in another window showed an error message when giving the hcitool command:

> HCI Event: Command Complete (0x0e) plen 4
    LE Set Advertising Data (0x08|0x0008) ncmd 1
    status 0x12
    Error: Invalid HCI Command Parameters

After removing the extra 00's at the end of the hcitool command, it worked. My config file is:

export BLUETOOTH_DEVICE=hci0
# E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
# export UUID="e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0"
export UUID="92 77 83 0A B2 EB 49 0F A1 DD 7F E3 8C 49 2E DE"
export MAJOR="00 00"
export MINOR="00 00"
export POWER="C5 00"

note the extra 00 in POWER! this extra 00 is important.

My beaconstart script is:

#!/bin/sh
. ./ibeacon.conf
echo "Launching virtual iBeacon..."
sudo hciconfig $BLUETOOTH_DEVICE up
sudo hciconfig $BLUETOOTH_DEVICE noleadv
sudo hciconfig hci0 noscan
sudo hciconfig $BLUETOOTH_DEVICE leadv 3
sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 $UUID $MAJOR $MINOR $POWER
# sudo hciconfig $BLUETOOTH_DEVICE leadv 3
echo "Complete"

While try-and-erroring I also added the noscan and put the leadv 3 in FRONT of the hcitool command. But only after removing the extra 00s it started to work.

woens
  • 1,058
  • 9
  • 20
0
HCI Event: 0x0e plen 4 01 08 20 12

translate into: set advertising data command has finished running with error 0x12 "Invalid HCI Command Parameters"

ogf 0x08, ocf 0x0008 is the command to set the advertising packet's data, so you change the arguments to that command to modify the UUID. You want to change the part of the string of hex that corresponds to the UUID. Notice this:

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

iBeacon broadcasting Profile UUID E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 with a major of 0 and a minor of 0

Are you sure you have a Bluetooth 4.0 dongle? What's the exact command you typed in? (cut-n-copy it into your question)

Tim Tisdall
  • 9,914
  • 3
  • 52
  • 82
  • Hey, yes I have a Cambridge Silicon Radio(CSR) 4.0. What all do we need to know: 1) Advertising Mode on off? 2) slave or master the dongle? I am very new to this dongle and programming in UNIX too. What should be kept in mind while using the CSR? – Videep Mishraa Dec 02 '13 at 12:44
  • The `0x08 0x0008` is to set the LE advertising data, but doesn't turn it on/off. If you cut-n-copied the command directly from that host website then it _should_ work fine. Are you able to try it with another dongle? It's very common for Chinese companies to make fake CSR dongles which have bugs (I've bought them). – Tim Tisdall Dec 02 '13 at 14:31
  • I ordered another dongle will be shipped by Monday they say! Will update the status once I try that out. May be the CSR is not a genuine one. Thanks for helping out. – Videep Mishraa Dec 03 '13 at 04:12
  • Hi Tim, I am curious about the meaning of the codes in the HCI event. I have found that `0x12` is the Invalid HCI Command Parameters from the Core specification. But what does the `0x20` mean before `0x12`? I asked the question at https://stackoverflow.com/questions/61415732/raspberry-pi-bluetooth-hci-event-code-meaning. Could you help? Thanks a lot! – Chang Apr 24 '20 at 21:52
0

Unfortunately, you need a different bluetooth dongle. There have been other reports of the CSR not working with the Bluez stack on the Raspberry Pi for iBeacon advertising. See here and here

I have verified the command you have above does not give an error when using the recommended IOGear GBU521.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • I just tried it with my fake "CSR" dongle and got the same error as the original poster. I'm wondering if it occurs with legit CSR dongles. – Tim Tisdall Dec 02 '13 at 21:09
  • Radius Networks has not heard any report of this working with "legitimate" CSR dongles. If we hear anything to the contrary, I will gladly add it to the supported devices page. – davidgyoung Dec 02 '13 at 22:15
  • I shall be getting the IOGear GBU521 BLE Dongle soon(Monday) and will update you. Thanks for helping out. – Videep Mishraa Dec 03 '13 at 04:13
0

I was successful with a Raspberry Pi and a Inateck csr4b5 BT Dongle which should contain CRS 8510. By complying to the BT specs 31 octets length just like memoryhole said and omitting the extra 00 octets at the end it worked.

Edit: Also worked with a Pearl Dongle Model PX-1632-675 and a CSL USB Bluetooth Nano Dongle CSL-Nr. 23996

Give it a try.

Cheers

Tschenser
  • 347
  • 3
  • 15