Linux bluetooth development
 help / color / mirror / Atom feed
* How to test/debug bluetooth advertising [with hciconfig]?
@ 2013-08-28 10:22 Richard Neill
  2013-08-28 10:39 ` Andrei Emeltchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Neill @ 2013-08-28 10:22 UTC (permalink / raw)
  To: linux-bluetooth

Dear All,

I'm trying to get "hello world" working from the shell between 2 
Bluetooth 4 dongles, in LE advertising mode. I wonder whether I could 
ask for some pointers?

As I understand it, Bluetooth low-energy supports up to 31 bytes of 
arbitrary text in the advertising packet. So it should be possible to 
set one dongle up in LE-advertising mode, and a second in LE-scan mode, 
and to transfer the "hello world" message from one to the other.

I'm rather stuck at the moment. I've discovered that there is an "LE Set 
Advertising Data" command, 0xcf (from "hciconfig hci0 commands_list"), 
and that "hcitool -i hci0 cmd 0xcf XXX YYY ZZZ" is how to send it. But I 
can't find any more documentation for the command set used by hcitool.

Can anyone help, with the commands I need, or by pointing me to the 
appropriate documentation/tutorial?

Thanks for your help,

Richard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 10:22 How to test/debug bluetooth advertising [with hciconfig]? Richard Neill
@ 2013-08-28 10:39 ` Andrei Emeltchenko
  2013-08-28 11:09   ` Richard Neill
  2013-08-28 11:10   ` Richard Neill
  0 siblings, 2 replies; 9+ messages in thread
From: Andrei Emeltchenko @ 2013-08-28 10:39 UTC (permalink / raw)
  To: Richard Neill; +Cc: linux-bluetooth

Hi Richard,

On Wed, Aug 28, 2013 at 11:22:01AM +0100, Richard Neill wrote:
> Dear All,
> 
> I'm trying to get "hello world" working from the shell between 2
> Bluetooth 4 dongles, in LE advertising mode. I wonder whether I
> could ask for some pointers?
> 
> As I understand it, Bluetooth low-energy supports up to 31 bytes of
> arbitrary text in the advertising packet. So it should be possible
> to set one dongle up in LE-advertising mode, and a second in LE-scan
> mode, and to transfer the "hello world" message from one to the
> other.
> 
> I'm rather stuck at the moment. I've discovered that there is an "LE
> Set Advertising Data" command, 0xcf (from "hciconfig hci0
> commands_list"), and that "hcitool -i hci0 cmd 0xcf XXX YYY ZZZ" is
$ hcitool cmd --help
Usage:
	cmd <ogf> <ocf> [parameters]

Check ogf and ocf from the Bluetooth Specification.

Best regards 
Andrei Emeltchenko 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 10:39 ` Andrei Emeltchenko
@ 2013-08-28 11:09   ` Richard Neill
  2013-08-28 11:10   ` Richard Neill
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Neill @ 2013-08-28 11:09 UTC (permalink / raw)
  To: linux-bluetooth


> On Wed, Aug 28, 2013 at 11:22:01AM +0100, Richard Neill wrote:
>> Dear All,
>>
>> I'm trying to get "hello world" working from the shell between 2
>> Bluetooth 4 dongles, in LE advertising mode. I wonder whether I
>> could ask for some pointers?
>
> Check ogf and ocf from the Bluetooth Specification.

Dear Andrei,

Thanks for your reply. That was actually very helpful: by searching 
specifically for "ogf ocf Bluetooth specification", I was able to locate 
the right part of the relevant document (a 600 page PDF of Bluetooth 4.0 
core).

However, before I delve into this in great detail, I wonder whether I am 
about to "re-invent the wheel".  For example, if I wanted to use "ping" 
in a shell-script, I wouldn't normally begin by poking registers in the 
ethernet card.

If nobody else has written the utility, I'm happy to do so, (and I'll 
publish the results), but I wonder whether it has already been done?

Best wishes,

Richard


P.S. I sent a patch to hciconfig yesterday: was it sufficient to just 
post it to this list, or is there anything else I should do in order to 
get feedback and to have it considered for acceptance into bluez ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 10:39 ` Andrei Emeltchenko
  2013-08-28 11:09   ` Richard Neill
@ 2013-08-28 11:10   ` Richard Neill
  2013-08-28 11:54     ` Andrei Emeltchenko
  2013-08-28 12:12     ` Andrei Emeltchenko
  1 sibling, 2 replies; 9+ messages in thread
From: Richard Neill @ 2013-08-28 11:10 UTC (permalink / raw)
  To: linux-bluetooth


> On Wed, Aug 28, 2013 at 11:22:01AM +0100, Richard Neill wrote:
>> Dear All,
>>
>> I'm trying to get "hello world" working from the shell between 2
>> Bluetooth 4 dongles, in LE advertising mode. I wonder whether I
>> could ask for some pointers?
>
> Check ogf and ocf from the Bluetooth Specification.

Dear Andrei,

Thanks for your reply. That was actually very helpful: by searching 
specifically for "ogf ocf Bluetooth specification", I was able to locate 
the right part of the relevant document (a 600 page PDF of Bluetooth 4.0 
core).

However, before I delve into this in great detail, I wonder whether I am 
about to "re-invent the wheel".  For example, if I wanted to use "ping" 
in a shell-script, I wouldn't normally begin by poking registers in the 
ethernet card.

If nobody else has written the utility, I'm happy to do so, (and I'll 
publish the results), but I wonder whether it has already been done?

Best wishes,

Richard


P.S. I sent a patch to hciconfig yesterday: was it sufficient to just 
post it to this list, or is there anything else I should do in order to 
get feedback and to have it considered for acceptance into bluez ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 11:10   ` Richard Neill
@ 2013-08-28 11:54     ` Andrei Emeltchenko
  2013-08-28 14:35       ` Richard Neill
  2013-08-28 12:12     ` Andrei Emeltchenko
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Emeltchenko @ 2013-08-28 11:54 UTC (permalink / raw)
  To: Richard Neill; +Cc: linux-bluetooth

Hi Richard,

On Wed, Aug 28, 2013 at 12:10:43PM +0100, Richard Neill wrote:
> 
> >On Wed, Aug 28, 2013 at 11:22:01AM +0100, Richard Neill wrote:
> >>Dear All,
> >>
> >>I'm trying to get "hello world" working from the shell between 2
> >>Bluetooth 4 dongles, in LE advertising mode. I wonder whether I
> >>could ask for some pointers?
> >
> >Check ogf and ocf from the Bluetooth Specification.
> 
> Dear Andrei,
> 
> Thanks for your reply. That was actually very helpful: by searching
> specifically for "ogf ocf Bluetooth specification", I was able to
> locate the right part of the relevant document (a 600 page PDF of
> Bluetooth 4.0 core).
> 
> However, before I delve into this in great detail, I wonder whether
> I am about to "re-invent the wheel".  For example, if I wanted to
> use "ping" in a shell-script, I wouldn't normally begin by poking
> registers in the ethernet card.

Then you should not use "hcitool cmd". Better use high level API.

Best regards 
Andrei Emeltchenko 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 11:10   ` Richard Neill
  2013-08-28 11:54     ` Andrei Emeltchenko
@ 2013-08-28 12:12     ` Andrei Emeltchenko
  2013-08-28 14:10       ` Claudio Takahasi
  1 sibling, 1 reply; 9+ messages in thread
From: Andrei Emeltchenko @ 2013-08-28 12:12 UTC (permalink / raw)
  To: Richard Neill; +Cc: linux-bluetooth

Hi Richard,

> Thanks for your reply. That was actually very helpful: by searching
> specifically for "ogf ocf Bluetooth specification", I was able to
> locate the right part of the relevant document (a 600 page PDF of
> Bluetooth 4.0 core).
> 
> However, before I delve into this in great detail, I wonder whether

Those ogf and ocf are just command identifiers, search by command you want
to run and you will find them.

Best regards 
Andrei Emeltchenko 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 12:12     ` Andrei Emeltchenko
@ 2013-08-28 14:10       ` Claudio Takahasi
  2013-08-28 14:45         ` Richard Neill
  0 siblings, 1 reply; 9+ messages in thread
From: Claudio Takahasi @ 2013-08-28 14:10 UTC (permalink / raw)
  To: Andrei Emeltchenko, Richard Neill, BlueZ development

Hi Richard:

On Wed, Aug 28, 2013 at 9:12 AM, Andrei Emeltchenko
<andrei.emeltchenko.news@gmail.com> wrote:
> Hi Richard,
>
>> Thanks for your reply. That was actually very helpful: by searching
>> specifically for "ogf ocf Bluetooth specification", I was able to
>> locate the right part of the relevant document (a 600 page PDF of
>> Bluetooth 4.0 core).
>>
>> However, before I delve into this in great detail, I wonder whether
>
> Those ogf and ocf are just command identifiers, search by command you want
> to run and you will find them.
>
> Best regards
> Andrei Emeltchenko
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Sets the advertising data:
$sudo hcitool -i hci0 cmd 0x08 0x0008 03 02 01 06 $(perl -e 'print "00
" x 28 . "\n"')
Remember that the data needs to follow the EIR/AD format: see Core Spec page1761

Enable adv
$sudo hciconfig hci0 leadv

BR,
Claudio

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 11:54     ` Andrei Emeltchenko
@ 2013-08-28 14:35       ` Richard Neill
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Neill @ 2013-08-28 14:35 UTC (permalink / raw)
  To: linux-bluetooth

Dear Andrei,

Thanks for your help.

>>
>> However, before I delve into this in great detail, I wonder whether
>> I am about to "re-invent the wheel".  For example, if I wanted to
>> use "ping" in a shell-script, I wouldn't normally begin by poking
>> registers in the ethernet card.
>
> Then you should not use "hcitool cmd". Better use high level API.

I'd love to use a high level API. But where can I find it? There doesn't 
seem to be any documentation, or any example code for Bluetooth Low 
Energy on Linux.

BTLE documentation only seem to be documented for Windows, iOS, or 
Android. I'm sorry if I seem to be being dense, but while I can find 
lots of references to 2007-era bluetooth tutorials, lots of information 
on how wonderful BTLE is, and a lot of questions on eg stackexchange 
asking *how* to do this, there doesn't seem to be any starting point for 
actually doing it.

hciconfig looks to be the natural place to start (it has the commands to 
enable and disable LE advertising, but appears to have omit the command 
to set the advertising data itself).

Regards,

Richard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to test/debug bluetooth advertising [with hciconfig]?
  2013-08-28 14:10       ` Claudio Takahasi
@ 2013-08-28 14:45         ` Richard Neill
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Neill @ 2013-08-28 14:45 UTC (permalink / raw)
  Cc: BlueZ development



On 28/08/13 15:10, Claudio Takahasi wrote:

> Sets the advertising data:
> $sudo hcitool -i hci0 cmd 0x08 0x0008 03 02 01 06 $(perl -e 'print "00
> " x 28 . "\n"')
> Remember that the data needs to follow the EIR/AD format: see Core Spec page1761
>
> Enable adv
> $sudo hciconfig hci0 leadv
>
> BR,
> Claudio

Dear Claudio,

Thanks very much - that's really helpful :-)

Best wishes,

Richard



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-28 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 10:22 How to test/debug bluetooth advertising [with hciconfig]? Richard Neill
2013-08-28 10:39 ` Andrei Emeltchenko
2013-08-28 11:09   ` Richard Neill
2013-08-28 11:10   ` Richard Neill
2013-08-28 11:54     ` Andrei Emeltchenko
2013-08-28 14:35       ` Richard Neill
2013-08-28 12:12     ` Andrei Emeltchenko
2013-08-28 14:10       ` Claudio Takahasi
2013-08-28 14:45         ` Richard Neill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox