dbus

Difference between DBus and other Interprocess Communications method

孤街浪徒 提交于 2019-12-11 10:44:17
问题 When i studied about Linux interprocess Communications, i have known there were some method as: pipe, message queue, socket, signal, shared memory, semaphore and there is no method named Dbus. But today, when i research about Dbus, i read that: "D-Bus is a system for interprocess communication (IPC)" (See that link: https://en.wikipedia.org/wiki/D-Bus) So my question is: What is the different between DBus and other IPC methods? 回答1: A one to one ipc method has a large group of cooperating

How to monitor usb devices insertion?

浪子不回头ぞ 提交于 2019-12-11 07:30:03
问题 I am trying to monitor for USB devices when they get plugged in. A couple of test scripts fail that I am pretty sure should of worked. import pyudev context = pyudev.Context() monitor = pyudev.Monitor.from_netlink(context) monitor.filter_by(subsystem='usb') for device in iter(monitor.poll, None): if device.action == 'add': print('{} connected'.format(device)) ^^Does nothing. No error, no output. I try import dbus bus = dbus.SystemBus() obj = bus.get_object('org.freedesktop.NetworkManager', '

using org.mpris.mediaplayer2.player PlaybackStatus property in python

◇◆丶佛笑我妖孽 提交于 2019-12-11 06:17:33
问题 The Specification page for this particular interface says: PlaybackStatus — s (Playback_Status) . . . May be "Playing", "Paused" or "Stopped". But when i read it like this: print "Song %s" % iPlayer.PlaybackStatus or if iPlayer.PlaybackStatus == "Playing": print "Song playing" It shows a very strange output like <dbus.proxies._ProxyMethod instance at 0x255f248> How can I access the String value of this variable? 回答1: You have to call the Get method to get the property. The method returns a

高并发与负载均衡-lvs-3种模型推导

試著忘記壹切 提交于 2019-12-11 06:14:57
[root@centos7-1 ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.159.10 netmask 255.255.255.0 broadcast 192.168.159.255 inet6 fe80::20c:29ff:fe99:5ef2 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:99:5e:f2 txqueuelen 1000 (Ethernet) RX packets 1137094 bytes 1121340388 (1.0 GiB) RX errors 101 dropped 0 overruns 0 frame 0 TX packets 293297 bytes 21587168 (20.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 19 base 0x2000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid

Role of Mainloops, Event Loops in DBus service

痞子三分冷 提交于 2019-12-11 04:08:25
问题 This is the standard example of DBus service. import dbus import gobject from dbus import service # from gi._gobject import MainLoop from dbus.mainloop.glib import DBusGMainLoop class DBusServer(service.Object): def __init__(self, name, object_path): # super(service.Object, self).__init__(name, object_path) dbus.service.Object.__init__(self, name, object_path) @dbus.service.method("com.test", in_signature='s', out_signature="s") def test(self, args): return args + " Sent by dbus client" @dbus

org.gnome.SessionManager in Ubuntu 12.04 chroot

℡╲_俬逩灬. 提交于 2019-12-11 03:26:05
问题 I'm trying to test totem in a minimal chroot (host and chroot both ubuntu 12.04 amd64). When I load a video, I get the error ** (totem:25660): WARNING **: Problem inhibiting the screensaver: GDBus.Error: org.freedesktop.DBus.Error.NameHasNoOwner: Name "org.gnome.SessionManager" does not exist Indeed, the screen will turn off (session idle) while watching a video. To confirm, I tested with python: >>> import dbus >>> bus = dbus.SessionBus() >>> bus.get_object('org.gnome.SessionManager','/org

Connect to DBus service via TCP

强颜欢笑 提交于 2019-12-11 03:07:51
问题 I'm new in work with interprocess communication. I need you help and clear explanation. I have 2 applications. One of them is a service and one is a client. I've used QT/C++ to write them. When they are working on the one local PC - all is good. But I need to separate them. So, I have a service on the PC with IP 192.30.82.101. I connect it to bus using next code: QDBusConnection connection = QDBusConnection::sessionBus(); connection.registerObject("/my/service/MyService", mySvc); connection

dbus - how to set include paths

血红的双手。 提交于 2019-12-11 02:31:02
问题 On my system dbus headers are placed in /usr/include/dbus-1.0/dbus/ and dbus-arch-deps.h is other location (what seems to be strange): /usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h In my program I include #include<dbus-1.0/dbus/dbus.h> but in every header file which include others path looks like this: #include<dbus/xxx.h> I can copy dbus-arch-deps.h to /usr/include/dbus-1.0/dbus/ but how to fix paths in dbus headers ? 回答1: Your system likely has pkg-config installed. g++ $

Accessing Clementine instance via D-Bus MPRIS in Java

醉酒当歌 提交于 2019-12-10 19:17:37
问题 I'm using Clementine as a music player. It can be controlled with D-Bus-commands. On the command-line, using qdbus, I can: Start Stop Pause the player Force it to skip a song in the playlist Check the length of the playlist Check the currently playing track in the playlist and its metadata. I want to do this in a Java program. I tried to get things working, but somehow I do not understand it and I cannot find a piece of example code that I can use for my program. Here's a sample session using

Access another user's D-Bus session

落爺英雄遲暮 提交于 2019-12-10 14:44:23
问题 Let's assume this kind of situation: we have one user logged in, executing some application through sudo or su . This user has got a dbus-daemon running. However, when an application running with root privileges tries to access D-Bus, it just spawns another dbus-daemon , owned by root user. That's not a desired situation. Is there a way to gain access to D-Bus session of user who ran the application through sudo or su ? 回答1: First, you need DBUS_SESSION_BUS_ADDRESS environment variable to be