From: Pavel Machek <pavel@ucw.cz>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Barry Byford <31baz66@gmail.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
Marcel Holtmann <marcel@holtmann.org>
Subject: Re: low energy: does gatt client/server work in current version? How to test?
Date: Fri, 5 Oct 2018 11:15:30 +0200 [thread overview]
Message-ID: <20181005091530.GA17069@amd> (raw)
In-Reply-To: <CABBYNZ+R5M+gDyFZ6+fuJyXtNbvPiM7bh+BVeYQOn8oP9JJgSQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3283 bytes --]
Hi!
> > > My attempt at launching server is below (using python gatt-server, (1)
> > > ). I was doing "hciconfig leadv 0" manually at some point.
> > >
> > > Using hciconfig while bluetoothd is running sounds kind-of
> > > dangerous. Stackoverflow (2) suggests using btmgmt (3) instead, and
> > > things got slightly different, but did not start to work for me. Is
> > > there documentation how to get this to work somewhere?
>
> Have a look at bluetoothctl first, all the necessary commands are
> there to enable to act as peripheral:
And indeed it does, and it does work when done this way.
> > > (3)
> > > sudo tools/btmgmt -i hci0 power off
> > > sudo tools/btmgmt -i hci0 le on
> > > sudo tools/btmgmt -i hci0 connectable on
> > > sudo tools/btmgmt -i hci0 name "some friendly name"
> > > sudo tools/btmgmt -i hci0 advertising on
> > > sudo tools/btmgmt -i hci0 power on
> > > tools/btgatt-server -i hci0 -s low -t public -r -v
>
> No need to use btmgmt, applications should use the D-Bus API which has
> pretty much everything you are doing with btmgmt.
Yes, that works, thanks.
As far as I understand, with bluetoothd running, neither btmgmt nor
hciconfig should be used. Unfortunately they are easy to find and
"seem" to work.
[bluetooth]# agent KeyboardDisplay
Agent is already registered
[bluetooth]# info FC:CE:56:3B:D1:6C
Device FC:CE:56:3B:D1:6C not available
[NEW] Device FC:CE:56:3B:D1:6C FC-CE-56-3B-D1-6C
[FC-CE-56-3B-D1-6C]# info FC:CE:56:3B:D1:6C
Device FC:CE:56:3B:D1:6C (random)
Alias: FC-CE-56-3B-D1-6C
Paired: no
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
Attempting to pair with FC:CE:56:3B:D1:6C
Request passkey
[agent] Enter passkey (number in 0-999999): 000000
[FC-CE-56-3B-D1-6C]# info FC:CE:56:3B:D1:6C
Device FC:CE:56:3B:D1:6C (random)
Alias: FC-CE-56-3B-D1-6C
Paired: no
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
If I retry the pairing, nothing happens:
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
Attempting to pair with FC:CE:56:3B:D1:6C
If I retry, it is busy:
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
Attempting to pair with FC:CE:56:3B:D1:6C
Failed to pair: org.bluez.Error.InProgress
Failed to pair: org.freedesktop.DBus.Error.NoReply
Failed to pair: org.freedesktop.DBus.Error.NoReply
I tried power cycling the device, re-connect and re-pair.
[CHG] Device FC:CE:56:3B:D1:6C Connected: no
[bluetooth]#
[CHG] Device FC:CE:56:3B:D1:6C Connected: no
[CHG] Device FC:CE:56:3B:D1:6C Connected: yes
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
Attempting to pair with FC:CE:56:3B:D1:6C
[FC-CE-56-3B-D1-6C]# info FC:CE:56:3B:D1:6C
Device FC:CE:56:3B:D1:6C (random)
Alias: FC-CE-56-3B-D1-6C
Paired: no
Trusted: no
Blocked: no
Connected: yes
LegacyPairing: no
[FC-CE-56-3B-D1-6C]# pair FC:CE:56:3B:D1:6C
Attempting to pair with FC:CE:56:3B:D1:6C
Failed to pair: org.bluez.Error.InProgress
[FC-CE-56-3B-D1-6C]#
Which does not work :-(.
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2018-10-05 9:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 10:24 low energy: does gatt client/server work in current version? How to test? Pavel Machek
2018-10-01 13:53 ` Barry Byford
2018-10-02 8:53 ` Luiz Augusto von Dentz
2018-10-02 12:26 ` Pavel Machek
2018-10-05 9:15 ` Pavel Machek [this message]
2018-10-14 21:40 ` Pavel Machek
2018-10-02 12:09 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181005091530.GA17069@amd \
--to=pavel@ucw.cz \
--cc=31baz66@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).