Re: BLE Advertisement frustrations with pydbus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On May 8, 2017, at 1:01 AM, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> wrote:
> 
> Hi Travis,
> 
> On Sat, May 6, 2017 at 1:28 AM, Travis Griggs <travisgriggs@xxxxxxxxx> wrote:
>> I’m trying to switch to using pydbus (instead of deprecated dbus-python, which the bluez examples are based on). I’m running on stretch with bluez 5.43. My code is at the bottom (and here -> https://gist.github.com/travisgriggs/d8e14dcccf46751804456dc74da1e5e6). I’m running into a problem when I try to RegisterAdvertisement. What I can’t seem to discern is what is different between this and the old approach. The bluetooth driver fails around advertising:c:175
>> 
>>    DBusMessageIter iter;
>>    const char *msg_type;
>> 
>>    if (!g_dbus_proxy_get_property(proxy, "Type", &iter))
>>        return false;
>> 
>> The g_dbus_proxy_get_property() call fails. What I don’t understand though is this. If I modify my program to NOT RegisterAdvertisement(), but just sit there with the advertisement object on the bus, I can do the following:
>> 
>> $ sudo busctl get-property :1.5 /nic/twigpilot org.bluez.LEAdvertisement1 Type
>> s “peripheral"
>> 
>> So I *am* able to get the Type using busctl. Why is that bluetoothd cannot? Using busctl introspect, I see that the pydbus variant automagically makes a lot more available than the dubs-python variant did.
>> 
>> Any hints? Pointers? Help?
> 
> Does pydbus have ObjectManager support? What about GetAll properties?
> You could perhaps try to sniff the message with eavesdrop option:
> 
> https://wiki.ubuntu.com/DebuggingDBus
> 
>> 

That’s a great question. My neophyte skills with dbus are not that strong, but the following DOES seem odd to me:

$ sudo busctl introspect :1.5 /nic/twigpilot
NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
org.bluez.LEAdvertisement1          interface -         -            -
.Release                            method    -         -            no-reply
.IncludeTxPower                     property  b         true         emits-change
.ManufacturerData                   property  a{sv}     0            emits-change
.ServiceData                        property  a{sv}     0            emits-change
.ServiceUUIDs                       property  as        0            emits-change
.SolicitUUIDs                       property  as        0            emits-change
.Type                               property  s         "peripheral" emits-change
org.freedesktop.DBus.Introspectable interface -         -            -
.Introspect                         method    -         s            -
org.freedesktop.DBus.Peer           interface -         -            -
.GetMachineId                       method    -         s            -
.Ping                               method    -         -            -
org.freedesktop.DBus.Properties     interface -         -            -
.Get                                method    ss        v            -
.GetAll                             method    s         a{sv}        -
.Set                                method    ssv       -            -
.PropertiesChanged                  signal    sa{sv}as  -            -

So it seems to think it does… And as aforementioned, I can get the Type:

$ sudo busctl get-property :1.5 /nic/twigpilot org.bluez.LEAdvertisement1 Type
s “peripheral"

BUT… if I try to access as GetAll as you suggest:

$ sudo busctl call :1.5 /nic/twigpilot org.freedesktop.DBus.Properties GetAll
No such interface 'org.freedesktop.DBus.Properties' on object at path /nic/twigpilot

Which is really weird, because the `introspect` command seems to show it is there. 

(sorry if this is sent twice, I got a weird response back the first time I submitted this message)--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux