Comments (6)
you are in the system bus there, I think in your code you are trying to use the session bus.
So you need to do:
Connection conn = connectToBus(DBusBusType.DBUS_BUS_SYSTEM);
from ddbus.
you are passing the wrong bus name, you need to pass org.freedesktop.UDisks2
as bus name, see http://storaged.org/doc/udisks2-api/latest/ref-dbus-overview.html#ref-dbus-well-known-name
Also Variant!string
means the type is serialized as variant but it may only contain a string. If you want to support other values than strings, you will want to use Variant!DBusAny
(lightweight and full protocol data introspection) or std.variant : Variant
(wider compatibility) instead.
Also tip: you can use busName("..."), ObjectPath("/..."), interfaceName("...")
for calling the API in a type-safe and more readable way, see https://github.com/WebFreak001/DWin-Bar/blob/master/source/dwinbar/widgets/battery.d#L54
from ddbus.
@WebFreak001 I initially tried that particular bus name before. But it looks like udisks2 service is not running while it's not the case.
import std.stdio, ddbus;
import ddbus: Variant, DBusAny;
void main()
{
Connection conn = connectToBus();
PathIface obj = new PathIface(conn, "org.freedesktop.UDisks2",
"/org/freedesktop/UDisks2/Manager", "org.freedesktop.UDisks2.Manager");
Variant!DBusAny[string] arg;
writeln(obj.call!string("GetBlockDevices", arg));
}
$ ./dbed
ddbus.exception.DBusException@../../.dub/packages/ddbus-2.3.0/ddbus/source/ddbus/thin.d(833): The name org.freedesktop.UDisks2 was not provided by any .service files
$ systemctl status udisks2
● udisks2.service - Disk Manager
Loaded: loaded (/lib/systemd/system/udisks2.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-08-21 21:44:17 AEST; 3 days ago
Docs: man:udisks(8)
Main PID: 1075 (udisksd)
Tasks: 5 (limit: 19046)
Memory: 8.6M
CGroup: /system.slice/udisks2.service
└─1075 /usr/lib/udisks2/udisksd
from ddbus.
have you verified that the service does indeed exist in DBus yet? I recommend trying some application like D-Feet to try first.
from ddbus.
@WebFreak001 It is, as far as I understand.
from ddbus.
from ddbus.
Related Issues (19)
- dub build failure HOT 5
- Add support for dictionary types HOT 2
- New release HOT 1
- Support for dynamic variants
- What is the intended meaning of isVariant? HOT 2
- Code readability HOT 3
- DBusAny.get templates for array types don't compile HOT 1
- Crash when using registerMethods HOT 3
- Systembus HOT 1
- Add support for meson HOT 5
- Where is the documentation of Get? HOT 1
- New release since the current one is broken HOT 2
- canDBus returns false for structs HOT 7
- Translate Exception to DBus error Message in MessageRouter.setHandler HOT 1
- API for emitting a signal via dbus?
- Signals are not received (missing a call to dbus_bus_add_match?)
- Unregister signals / router handlers HOT 2
- Add support for emitting signals and properties for server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ddbus.