Questions tagged [udisks]

udisks is a daemon that implements well-defined D-Bus interfaces that can be used to query and manipulate storage devices.

11 questions
3
votes
1 answer

How to use zbus to list block devices?

I want to list all the available block devices in the system using a dbus implementation called zbus. The UDisks2 documentation mentions a method call on org.freedesktop.UDisks2.Manager interface called GetBlockDevices which accepts IN a{sv}…
noconst
  • 639
  • 4
  • 15
2
votes
1 answer

How to list all the removable devices with DBus and UDisks2?

I need to list, filter and open block devices with UDisks2. I am trying to list all the removable devices. The GetBlockDevices method provided by UDisks2 requires a a{sv} type. If I am not mistaken, it's a HashTable of string keys and Variant…
noconst
  • 639
  • 4
  • 15
1
vote
1 answer

What is the interface I have to inspect for detecting connected USB?

I'm trying to detect that a USB device was plugged or removed from within a qt programm via the method: http://doc.qt.io/qt-4.8/qdbusconnection.html#connect My current code of the corresponding class looks like this: #include "usbhandler.h" #include…
dhein
  • 6,431
  • 4
  • 42
  • 74
0
votes
1 answer

Unmount a drive with python with udisks2 via dbus

I'm trying to achieve the title. Here is my code: from dbus_next.aio import MessageBus async def unmount_device(device_path): bus = await MessageBus().connect() udisk_obj = bus.get_proxy_object('org.freedesktop.UDisks2', device_path) …
Daniel
  • 2,318
  • 2
  • 22
  • 53
0
votes
1 answer

is there a way to determine udisks default mount path?

It can be /media/ or /media/$USER or /run/media/$USER depends on distro or customization. Is there a unified way to get its value programmatically regardless distros?
Wang
  • 7,250
  • 4
  • 35
  • 66
0
votes
2 answers

Conditional actions depending on error output

Is there a way to perform an if statement based on the error output of a command? For example, I want to use udisksctl in a script which mounts a USB drive and then perform some action on the drive contents. The drive is not mounted: it should…
0
votes
1 answer

(auto-)mount (usb-)drives through udisk2 dbus api from python

I've got a python daemon that controls an audio player. Now I want this daemon to monitor USB disks inserted and add their content to the mpd media library. One part of this is a udisk client that waits for disks inserted and then immediately mounts…
JPT
  • 410
  • 2
  • 7
  • 18
0
votes
1 answer

How to confirm whether a block device is not being written anymore after a file write?

When I finish writing a file into a device block (for example, /dev/sda), I have to wait a while to ensure that the buffer is still not being written anymore to the device. I have to set a callback to trigger a UI event when that finishes. I have…
noconst
  • 639
  • 4
  • 15
0
votes
1 answer

How to correctly manage references returned by g_dbus_interface_get_object()

I have an application in which I'm using UDisks to handle some drives and partitions. In my application I have a situation where I have a pointer to a UDisksDrive that I need to convert to a UDisksObject pointer through which I can access other…
Matthew
  • 685
  • 8
  • 18
0
votes
1 answer

How to mount a device read-only with Python3 and Udisks2?

I need to (temporary) mount a device read-only with Python3 and the Udisks2 API. What is the correct GLib.Variant for this? I've created the below script to test with a USB pen drive. It assumes /dev/sdc1 as this device. #! /usr/bin/env…
0
votes
1 answer

Udisk - Error creating mount point no such file or directory

I'm trying to automatically mount a USB drive on linux. With all default settings it works and the drive is mounted to /run/media/username/drivename. I tried to change the default mount point to /media/drivename by following the guide linked here:…
wcroughan
  • 76
  • 1
  • 10