Import os import dbus from import DBusGMainLoop import gobject uid = None def device_added ( device ): print ( "-added-" ) device_dump ( device ) def device_removed ( device ): print ( "-removed-" ) print ( str ( device )) device_dump ( device ) pass def device_changed ( device ): print ( "-changed-" ) device_dump ( device ) pass def device_dump ( device ): device_obj = system_bus. The relevant udisk documentation URL for 1.0.5 (Rhel6 is at 1.0.1) is here Otherwise use the udisk2 monitor API to just look at mount events. Glib style event loops in order for the code to also be able to run on a RedHat or Centos system. The following code is an example of listening to udisk on the system D-Bus for device events. udisksctl smart-simulate - Set SMART data for a driveĪ more detailed explanation of an existing udisksctl command can be achieved by using udisksctl COMMAND -help.udisksctl power-off - Safely power off a drive.udisksctl loop-delete - Delete a loop device.udisksctl loop-setup - Set-up a loop device.udisksctl lock - Lock an encrypted device.udisksctl unlock - Unlock an encrypted device.udisksctl unmount - Unmount a filesystem.udisksctl monitor - Monitor changes to objects.udisksctl status - Shows high-level status.udisksctl dump - Shows information about all objects.udisksctl info - Shows information about an object. udisksctl help - Shows a help list with general commands.Udisks can be controlled with the udisksctl command:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |