5

So I am writing a python script that is attempting to use UDisk to mount and unmount devices. I'm using something like this:

disk_dev_func = dbus.Interface(self.device_obj, "org.freedesktop.UDisks.Device")
disk_dev_func.FilesystemUnmount('')
disk_dev_func.FilesystemMount()

So the unmount works just fine, my question, however is how to get the last line (mount) to work. I want to know what arguments I need to mount a device READ ONLY and I cannot for the life of me find any adequate examples of how to do this.

2

1 Answer 1

2

Ok, so I found a way to make it work.

Instead of

disk_dev_func.FilesystemMount()

I use

subprocess.call(['udisk', '--mount-options', 'ro', '--mount', '/dev/sdd1'])

It seems to mount correctly as read-only with this command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .