dbus

Register a “Hello World” DBus service, object and method using Python

我只是一个虾纸丫 提交于 2019-12-13 11:50:58
问题 I'm trying to export a DBus service named com.example.HelloWorld , with an object /com/example/HelloWorld , and method com.example.HelloWorld.SayHello that prints "hello, world" if the method is called using dbus-send --system --type=method_call --dest=com.example.HelloWorld /com/example/HelloWorld com.example.HelloWorld.SayHello So my question is how do you make a simple DBus service with a single method that prints "hello, world" (on its own stdout). 回答1: When using dbus-python the

Qt QDbus Sending Custom Types with QVariant

假如想象 提交于 2019-12-13 04:17:44
问题 I'm trying to send a custom class ( "Span" ) inside a QVariant across the Dbus session bus in Qt between 2 simple applications. Span is a simple class that contains 2 double type properties. I have successfully sent and recovered a QVariant containing just a QString across the dbus interface in the same manner I am trying to do below with a QVariant of a custom class. Span contains the following declaration for the QMETATYPE QVariant registration in the class header file: Q_DECLARE_METATYPE

DBus how to start service

我的未来我决定 提交于 2019-12-13 00:35:07
问题 I am curious how to start my own service for DBus. On official site I have found a lot of information regarding working with DBus services from client point of view, but how to start and develop service not enough: 1) Where should be located interface file ServiceName.xml 2) Where should be located service file ServiceName.service 3) How to launch service manually, not on start of system. Can anybody help me or provide some usefull links ? 回答1: Make a service that is started by the service

Where to find information about Nautilus D-Bus interface

孤人 提交于 2019-12-12 20:48:01
问题 I am planning to develop a command line application that interact with Nautilus, but I cannot find a reference for the D-Bus interface that Nautilus exposes. 回答1: For the time being, the only DBUS interface that nautilus implements is this: http://www.freedesktop.org/wiki/Specifications/file-manager-interface/ 回答2: Although I haven't found any doc on this either, at least you can use sth like d-feet to find out what interface/method/etc. nautilus has. (and I don't think there are a lot of

Starting a users systemd service via python and dbus

故事扮演 提交于 2019-12-12 04:19:58
问题 It is possible to use systemd's manager via dbus to control services, e.g: Starting a systemd service via python using this: import dbus sysbus = dbus.SystemBus() systemd1 = sysbus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1') manager = dbus.Interface(systemd1, 'org.freedesktop.systemd1.Manager') job = manager.RestartUnit('test.service', 'fail') However, systemd can also handle user's service files with the --user flag, e.g.: systemctl --user start test.service How can

Compilation error dbus-ping-pong

亡梦爱人 提交于 2019-12-12 02:29:58
问题 I have downloaded files from http://cgit.collabora.com/git/user/alban/dbus-ping-pong.git/tree/ I am trying to compile it using the command gcc pkg-config --libs --cflags dbus-1 dbus-glib-1-2 glib-2.0 -o dbus-ping-pong dbus-ping-pong.c But i am getting the below linker errors /tmp/ccmJkxXb.o: In function g_once_init_enter': dbus-ping-pong.c:(.text+0x22): undefined reference tog_once_init_enter_impl' /tmp/ccmJkxXb.o: In function dbus_glib_marshal_echo_srv__BOOLEAN__STRING_POINTER_POINTER': dbus

Only react to last `dbus-monitor` event within a group

谁都会走 提交于 2019-12-11 21:25:40
问题 I'm writing a script to react to dbus-monitor but there are a group of 17 events logged in 8/100th of a second. I don't want to react to all 17 events. Only the last event assuming another event doesn't occur within a second or two. I'm not sure how to code this in bash though? Sample event log (condensed with grep): $ cat "dbus-monitor-plugin.txt" | grep time= | grep xrandr method call time=1538331767.151461 sender=:1.59 -> destination=:1.11 serial=1242 path=/org/freedesktop/ColorManager

Passing non PODs [ Plain old DataTypes ] over IPC

元气小坏坏 提交于 2019-12-11 19:07:42
问题 I am writing an implementation for doing IPC. User do a call, I take all these parameters and pass them onto other process. I have written an automatic code generator for such functions based on logic which works something like this : Take all the parameters and put them inside a structure. Add other information required for IPC. Pass the size and pointer of this struct to POSIX message queue. Data from this address, till the size specified, is read and send to other process. De-construct the

using dbus and polkit to run a root privilege python service that calls a root script

巧了我就是萌 提交于 2019-12-11 16:49:42
问题 I have written a python script that downloads deb files from launchpad, and then calls out to a shell script to use alien to convert the debs to rpms. The shell script uses alien, and so it needs to be run as root. The program uses a thread pool to download the deb files asynchronously, using threadpool.apply_async, and then uses a processing pool to call the shell script asynchronously, so the whole thing happens reasonably quickly. It all works well, but the shell script that calls alien

How export methods with dbus in a extended class in python, inherited methods?

夙愿已清 提交于 2019-12-11 15:23:31
问题 I have a top class and classes that extend the top class, but almost all methods from the child classes are from the top class (using inheritance, without reimplementation), so I don't have the methods in the child classes, how could I export them with dbus for each child class (with the name of each child class as part of dbus path)? I will show a example code for clarify, my class structure is: Window (main class) |--WindowOne (child class) |--WindowTwo |--WindowThree My interface for dbus