Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* mesh: DBus NoReplay in Python script
       [not found] <30b2e8c6-e95f-29e0-2887-55a4b2eea004@gmx.at>
@ 2019-08-31  2:19 ` Fabian Mauroner
  0 siblings, 0 replies; only message in thread
From: Fabian Mauroner @ 2019-08-31  2:19 UTC (permalink / raw)
  To: linux-bluetooth

Hello dear bluez developers,

I have a problem with the Import function in bluetooth mesh:

I have a python program ble_mesh_node.py which runs as root started by
systemctl. I'm initializing all the required stuff (as in the mesh test
python script), start the mainloop in another thread, and then the
import function is called.
There I'm getting an Error.NoReply exception as you can seen in the output:

    /2019-08-30 14:23:52,883 - ble_mesh_node.py:729 - ERROR -
    org.freedesktop.DBus.Error.NoReply: Did not receive a reply.
    Possible causes include: the remote application did not send a
    reply, the message bus security policy blocked the reply, the reply
    timeout expired, or the network connection was broken.//
    //Traceback (most recent call last)://
    //  File "/home/pi/smarthome/gui/ble_mesh_node/ble_mesh_node.py",
    line 793, in <module>//
    //    with open('config.json', 'r') as f://
    //FileNotFoundError: [Errno 2] No such file or directory:
    'config.json'//
    //
    //During handling of the above exception, another exception occurred://
    //
    //Traceback (most recent call last)://
    //  File "/home/pi/smarthome/gui/ble_mesh_node/ble_mesh_node.py",
    line 724, in import_node//
    //    iv_index, unicast)//
    //  File
    "/home/pi/smarthome/local/env/lib/python3.7/site-packages/dbus/proxies.py",
    line 70, in __call__//
    //    return self._proxy_method(*args, **keywords)//
    //  File
    "/home/pi/smarthome/local/env/lib/python3.7/site-packages/dbus/proxies.py",
    line 145, in __call__//
    //    **keywords)//
    //  File
    "/home/pi/smarthome/local/env/lib/python3.7/site-packages/dbus/connection.py",
    line 651, in call_blocking//
    //    message, timeout)//
    //*dbus.exceptions.DBusException:
    org.freedesktop.DBus.Error.NoReply: Did not receive a reply.
    Possible causes include: the remote application did not send a
    reply, the message bus security policy blocked the reply, the reply
    timeout expired, or the network connection was broken.*/

That has the following relevant python code:

    /    token = -1//
    //    try://
    //        with open('config.json', 'r') as f://
    //            data = json.load(f)//
    //            token = int(data['token'])//
    //    except IOError://
    //        try://
    ////*token = bleMeshNode.import_node()*//
    //        except://
    //            pass//
    //        if token != -1://
    //            with open('config.json', 'w') as f://
    //                data = {}//
    //                data['token'] = token//
    //                data = json.dump(data, f)/


However, it seems that only the return value (token) cannot be sent
back, because the node.json file can be successfully created with
meaningful content and also a token is created which I printed in the
create_node_ready_cb function:

        /static void create_node_ready_cb(void *user_data, int status,//
        //struct mesh_node *node)//
        //{//
        //        struct l_dbus_message *reply;//
        //        struct l_dbus_message *pending_msg;//
        //        const uint8_t *token;//
        //
        //        pending_msg = l_queue_find(pending_queue,
        simple_match, user_data);//
        //        if (!pending_msg){//
        //                l_debug("pending msg\n");//
        //                return;//
        //        }//
        //
        //        if (status != MESH_ERROR_NONE) {//
        //                l_debug("status != \n");//
        //                reply = dbus_error(pending_msg, status, NULL);//
        //                goto done;//
        //        }//
        //
        //        node_attach_io(node, mesh.io);//
        //
        //        reply = l_dbus_message_new_method_return(pending_msg);//
        //        token = node_get_token(node);//
        ////*l_debug("token %i \n", *token);*//
        //
        //        l_debug();//
        //        l_dbus_message_set_arguments(reply, "t",
        l_get_be64(token));//
        //
        //done://
        //        l_dbus_send(dbus_get_bus(), reply);//
        //        l_queue_remove(pending_queue, pending_msg);//
        //}/


here the output from the journalctl:

    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS] < 6c 02 01
    01 c0 01 00 00 08 00 00 00 3d 00 00 00 l...........=...
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   06 01 73
    00 04 00 00 00 3a 31 2e 34 00 00 00 00  ..s.....:1.4....
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   05 01 75
    00 06 00 00 00 08 01 67 00 0d 61 7b 6f  ..u.......g..a{o
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   61 7b 73
    61 7b 73 76 7d 7d 7d 00 00 00 00 00 00  a{sa{sv}}}......
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   07 01 73
    00 04 00 00 00 3a 31 2e 38 00 00 00 00  ..s.....:1.8....
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   b8 01 00
    00 00 00 00 00 0d 00 00 00 2f 61 74 2f  ............/at/
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   73 6d 61
    72 74 68 6f 6d 65 00 00 00 6c 00 00 00  smarthome...l...
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   1b 00 00
    00 6f 72 67 2e 62 6c 75 65 7a 2e 6d 65  ....org.bluez.me
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   73 68 2e
    41 70 70 6c 69 63 61 74 69 6f 6e 31 00  sh.Application1.
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   44 00 00
    00 00 00 00 00 09 00 00 00 43 6f 6d 70  D...........Comp
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   61 6e 79
    49 44 00 01 71 00 00 fe ff 00 00 00 00  anyID..q........
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   09 00 00
    00 50 72 6f 64 75 63 74 49 44 00 01 71  ....ProductID..q
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   00 00 01
    00 00 00 00 00 09 00 00 00 56 65 72 73  ............Vers
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   69 6f 6e
    49 44 00 01 71 00 00 01 00 00 00 00 00  ionID..q........
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   13 00 00
    00 2f 61 74 2f 73 6d 61 72 74 68 6f 6d  ..../at/smarthom
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   65 2f 61
    67 65 6e 74 00 7e 00 00 00 00 00 00 00  e/agent.~.......
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   1e 00 00
    00 6f 72 67 2e 62 6c 75 65 7a 2e 6d 65  ....org.bluez.me
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   73 68 2e
    50 72 6f 76 69 73 69 6f 6e 41 67 65 6e  sh.ProvisionAgen
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   74 31 00
    00 56 00 00 00 0c 00 00 00 43 61 70 61  t1..V.......Capa
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   62 69 6c
    69 74 69 65 73 00 02 61 73 00 00 00 00  bilities..as....
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   10 00 00
    00 0b 00 00 00 6f 75 74 2d 6e 75 6d 65  ........out-nume
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   72 69 63
    00 00 00 00 00 0d 00 00 00 4f 75 74 4f  ric.........OutO
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   66 42 61
    6e 64 49 6e 66 6f 00 02 61 73 00 00 00  fBandInfo..as...
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   0a 00 00
    00 05 00 00 00 6f 74 68 65 72 00 00 00  ........other...
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   13 00 00
    00 2f 61 74 2f 73 6d 61 72 74 68 6f 6d  ..../at/smarthom
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   65 2f 65
    6c 65 30 30 00 70 00 00 00 00 00 00 00  e/ele00.p.......
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   17 00 00
    00 6f 72 67 2e 62 6c 75 65 7a 2e 6d 65  ....org.bluez.me
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   73 68 2e
    45 6c 65 6d 65 6e 74 31 00 50 00 00 00  sh.Element1.P...
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   05 00 00
    00 49 6e 64 65 78 00 01 79 00 00 00 00  ....Index..y....
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   06 00 00
    00 4d 6f 64 65 6c 73 00 02 61 71 00 00  ....Models..aq..
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   0a 00 00
    00 00 10 01 10 03 10 0b 10 11 10 00 00  ................
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   0c 00 00
    00 56 65 6e 64 6f 72 4d 6f 64 65 6c 73  ....VendorModels
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   00 05 61
    28 71 71 29 00 00 00 00 00 00 00 00 00  ..a(qq).........
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/node.c:get_app_properties() path /at/smarthome
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/node.c:get_element_properties() path /at/smarthome/ele00
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/mesh-config-json.c:mesh_config_create() New node config
    /tmp/0a0102030405060708090a0b0c0d0e0f/node.json
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/cfgmod-server.c:cfgmod_server_init() 00
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/keyring.c:keyring_put_remote_dev_key() Put Dev Key
    /tmp/0a0102030405060708090a0b0c0d0e0f/dev_keys/0070
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/keyring.c:keyring_put_net_key() Put Net Key
    /tmp/0a0102030405060708090a0b0c0d0e0f/net_keys/000
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: Register io cb
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: recv_register 1
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: recv_register 3
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: Send SNB on
    network 000
    *Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/mesh.c:create_node_ready_cb() token 239*
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]:
    mesh/mesh.c:create_node_ready_cb()
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS] > 6c 02 01
    01 08 00 00 00 07 00 00 00 1f 00 00 00  l...............
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   06 01 73
    00 04 00 00 00 3a 31 2e 38 00 00 00 00  ..s.....:1.8....
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   05 01 75
    00 07 00 00 00 08 01 67 00 01 74 00 00  ..u.......g..t..
    Aug 30 14:23:52 raspberrypi bluetooth-meshd[439]: [DBUS]   42 58 aa
    3b 7e e8 72 ef                          BX.;~.r.


When I'm starting the program once again, instead of the Error.NoReply I
get an AlreadyExists Error.
One thing what I'm a bit wondering is, that the exception is thrown at
the same time (14:23:52) as the node was created...
This brings me to the conclusion, that there is only a problem with the
return value/message.

In the past I tried also the attach, join, create_network etc. functions
and I got always the same NoReplay Error, although I'm running the
program as root..

I hope you can help me to bring my private smartHome to run...

Best regards from Austria,
Fabian Mauroner




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <30b2e8c6-e95f-29e0-2887-55a4b2eea004@gmx.at>
2019-08-31  2:19 ` mesh: DBus NoReplay in Python script Fabian Mauroner

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox