dbus

shutting down computer (linux) using python

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to write a script that will shut down the computer if a few requirements are filled with the command os.system("poweroff") also tried os.system("shutdown now -h") and a few others. but nothing happens when I run it, the computer goes through the code without crashing or producing any error messages and terminates the script normally, without shutting down the computer. How does one shutdown the computer in python? edit: Seems that the commands I have tried requires root access. Is there any way to shut down the machine from the

DBus .service file missing

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am building custom dbus service for my own demands and want it to start automatically when someone need it. For that purpose I've created .service file like this [ D - Bus Service ] Name = com . mycompany . servicename Exec = /home/ myuser / Workspace / service - start User = myuser Here I just changed the actual name of service and executable but this is not the point. I've double checked real names - it matches exactly. I've placed this file under name com.mycompany.servicename.service to /usr/share/dbus-1/services folder (I am

How to compile a basic D-Bus/glib example?

纵然是瞬间 提交于 2019-12-03 02:57:09
I'm trying to learn how to use D-Bus with C bindings. I've never used D-Bus before. I'm following this tutorial , which I assume is the official one (Freedesktop.org). I've read it until this paragraph that gives a first sample program , but unfortunately I don't see any indication on this page about how to compile it or which libraries to include. Did I miss something ? My OS is Ubuntu 10.04 32bit. I installed the libdbus-glib-1-dev package. I tried to add #include <dbus/dbus.h> at the beginning of the source file, and to compile with $ gcc -ldbus-1 -I/usr/include/dbus-1.0/ -I/usr/lib/i386

How to use a variant dictionary (`a{sv}`) in dbus-send

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some trouble with dbus-send when using a{sv} Calling a method with in_signature='a{ss}' seems to work using the following command line: dbus-send --dest="org.test.TestService" /org/test/TestService/object org.test.TestService.method1 dict:string:string:"a","1","b","2" Now I would like to have a dictionary with a variant type for values ( in_signature=a{sv} ), How can I use it in dbus-send ? 回答1: Although D-Bus supports signatures such as a{sv} , dbus-send does not. This is from the dbus-send man page : "...D-Bus supports more types

dbus_to_python() takes exactly 1 argument?

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm attempting to control firewalld via the Python dbus module. I'd like to add an ip address to the trusted zone for both my current runtime as well as my permanent configuration. Here's the documentation for firewalld 's dbus interface: http://manpages.ubuntu.com/manpages/wily/man5/firewalld.dbus.5.html What works: The runtime configuration I'm able to add it to the runtime configuration just fine with this: def trustIP(ip): ''' firewalld must already be running ''' from dbus import SystemBus bus = SystemBus() runtimeProxy = bus.get_object

dbus_bus_request_name (): Connections are not allowed to own the service

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I built a root filesystem on arm. It should run dbus-daemon and avahi-daemon, but when I try to run avahi-daemon $ dbus-daemon --system $ avahi-daemon I get this message: Found user 'avahi' (UID 4) and group 'avahi' (GID 4). Successfully dropped root privileges. avahi-daemon 0.6.28 starting up. WARNING: No NSS support for mDNS detected, consider installing nss-mdns! dbus_bus_request_name(): Connection ":1.0" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file WARNING: Failed to contact

Gsettings with cron

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wrote a bash script that changes the wallpaper (for GNOME3). #!/bin/bash # Wallpaper's directory. dir="${HOME}/images/wallpapers/" # Random wallpaper. wallpaper=`find "${dir}" -type f | shuf -n1` # Change wallpaper. # http://bit.ly/HYEU9H gsettings set org.gnome.desktop.background picture-options "spanned" gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}" Script executed in a terminal emulator (eg gnome-terminal) works great. During the execution by cron, or ttyX terminal getting the error: ** (process:26717):

How can BlueZ be configured to require a connecting device to enter a matching pass key?

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to setup Bluetooth on an embedded Linux device such that SSP mode is used, with my device generating and displaying a passcode on it's display, and the remote end (e.g. user's phone) being required to enter the matching passcode to be able to successfully pair. I'm written/registered an agent that sets it's mode to DisplayOnly; I expected that when a device connects the "RequestPasskey" callback would be called and that my agent would then be able to generate and return a new passcode, and that the remote end would be required to

BlueZ 5.30: D-Bus GATT API - Simply Discover and Connect to a BLE device in C

删除回忆录丶 提交于 2019-12-03 00:38:07
With the last release of BlueZ (5.30) the highlight was the completion of the GATT D-Bus apis. My goal is to programmatically (in C), as a BLE client: scan for ble devices (which I can do with the hci layer) Connect to an advertising BLE device Get the UUIDs Execute Read and Write to handles The BlueZ community is strongly suggesting to use the GATT-Dbus api to accomplish this. After multiple searches and head scratching I was not successful to find a proper way or example that would perform this through GATT-DBUs api. It seems more complicate than just use directly the GATT layer.

基于GDbus与QDbus的DBUS小练习

匿名 (未验证) 提交于 2019-12-03 00:29:01
QDbus API:QT 的帮助文档 任务描述: proxy 获取 adaptor的数据,修改数据,接收数据修改的信号并查看新的值。 文件结构: 接口文件 XML: <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> < node name = "/com/examples/qdbus/wtest" > < interface name = "org.example.qdbus.wtest" > < signal name = "valueChanged" > < arg name = "newValue" type = "d" direction = "out" /> </ signal > < method name = "setValue" > < arg name = "newValue" type = "d" direction = "in" /> </ method > < method name = "getValue" type = "d" direction = "out" /> </ interface > </ node >