1
votes

There is a well known blog post going around on how to set a usb bluetooth 4 dongle to be an iBeacon. It boils down to this magical command:

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 12 34 56 00 C8 00

Now I want to edit E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 12 34 56 00 C8 00 these values import from a csv file,anyone know how can I do that ?
I have try

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $new.csv

But it's not work.

1
Just realised you've tagged it with sh but presumably it's bash? - Nick

1 Answers

0
votes

I've just tried this on a pi and it works with just the values in the file:

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $(< new.csv)

If it's a genuine CSV file then it isn't sufficient because you will need to strip out a header line (if present) and replace the commas with spaces.

You will need to do this (assuming no header):

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $(tr , \ < new.csv)

And finally, if you have a header line:

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 $(tr , \ < new.csv | tail -n +2)