Coder Social home page Coder Social logo

Comments (6)

WebFreak001 avatar WebFreak001 commented on June 14, 2024 1

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.

WebFreak001 avatar WebFreak001 commented on June 14, 2024

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.

adnan449 avatar adnan449 commented on June 14, 2024

@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.

WebFreak001 avatar WebFreak001 commented on June 14, 2024

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.

adnan449 avatar adnan449 commented on June 14, 2024

@WebFreak001 It is, as far as I understand.

image

from ddbus.

adnan449 avatar adnan449 commented on June 14, 2024

https://stackoverflow.com/questions/63537158/how-to-list-all-the-removable-devices-with-dbus-and-udisks2/63580867#63580867

from ddbus.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.