현재 GDBus를 사용하여 ConsoleKit과 통신 중입니다. ConsoleKit2 XML 파일과 gdbus-codegen
을 사용하여 코드를 생성했습니다. 모든 것이 잘 작동합니다. 그러나 객체가 있는지 어떻게 확인할 수 있습니까? 예를 들어 /org/freedesktop/ConsoleKit/Session2
이 있는지 알고 싶습니다 (예를 들어, Seat 객체의 모든 세션을 열거 할 수 있음을 알고 있습니다).D 버스 개체가 존재하는지 확인하십시오.
은 내가 org.freedesktop.DBus.Peer.Ping
기능을 사용하여 시도,하지만
dbus-send --system --print-reply --reply-timeout=2000 --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/ConsoleKit/Seat1 org.freedesktop.DBus.Peer.Ping
Error org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.168" (uid=1000 pid=18279 comm="dbus-send --system --print-reply --reply-timeout=2") interface="org.freedesktop.DBus.Peer" member="Ping" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
도움 주셔서 감사합니다. 2 번 아이디어는 내 마음을 가로 질러 왔지만 추악 할 것이라고 생각했습니다. 그렇다면 숫자 1이 될 것입니다. 결정적이지는 않지만 하드 코딩 된 경로를 예제로 사용했습니다. 나 또한 logind가 이것을하는 새로운 방법이고 애플리케이션의 다음 단계는 logind 지원이 될 것이지만 일부 배포판은 콘솔 킷 (예 : Gentoo Linux는 여전히 Consolekit을 사용할 수 있음)을 사용하므로 두 가지를 모두 지원하고자합니다. 다시 감사합니다. – Nidhoegger