2014-07-11 11 views
6

ho provato la mia fortuna con:Utilizzando dbus-send chiamare GetAll

dbus-send --system --print-reply \ 
    --dest=org.freedesktop.UDisks \ 
     /org/freedesktop/UIDisks/devices/md0 \ 
     org.freedesktop.DBus.Properties.GetAll \ 
     string:"" 

Se sto utilizzando D-Free e inviare "" come parametro getall ho una lunga lista di uscita

Cercando il codice di cui sopra dà solo un errore:

Error org.freedesktop.DBus.Error.UnknownMethod: Method "GetAll" with signature "s" on 
interface "org.freedesktop.DBus.Properties" doesn't exist 

così sto facendo qualcosa di sbagliato, ma non ho idea di che cosa c'è che non va. Ho cercato una soluzione ma non ho trovato una soluzione decente. Forse è banale, ma non ne ho idea ....

risposta

2

È necessario specificare il nome dell'interfaccia come parametro per GetAll. Questo esempio funziona per me (ho UDisks2 invece di UDisks ma per il resto è simile):

dbus-send --system --print-reply \ 
    --dest=org.freedesktop.UDisks2 \ 
    /org/freedesktop/UDisks2/block_devices/loop0 
    org.freedesktop.DBus.Properties.GetAll 
    string:"org.freedesktop.UDisks2.Block" 
+0

Scusate se io do in una stringa vuota in D-piedi ottengo: { 'DeviceAutomountHint': '', 'DeviceBlockSize': 512L, 'DeviceDetectionTime': 1405083881L, 'file_dispositivo': '/ dev/md0 ', ' DeviceFileById ': ['/dev/disk/id-id/md-uuid-d56d4165: 72b8959a: ea459adc: 678b0998 ', '/dev/disk/by-uuid/0bfac438-3d04-4d4e -a71c-2f4a3e63a8e9' ], 'DeviceFileByPath': [], 'DeviceFilePresentation': '/ dev/md0', 'DeviceIsDrive': vero, 'DeviceIsLinuxDmmp': Falso, 'DeviceIsLinuxDmmpComponent': Falso, 'DeviceIsLinuxLoop': False, 'DeviceIsLinuxLvm2LV': False, 'DeviceIsLinuxLvm2PV': False, .... – Friedrich

+0

Quindi ci deve essere un awy per davvero GetAll Properties in una volta. – Friedrich

0

Error org.freedesktop.DBus.Error.UnknownMethod: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist

ho problema simile, corro d-piedi, introspezione interfaccia, e scoprire, che avrei dovuto scrivi non "full/path/to/object", ma solo "/ object", nel tuo caso non "/ org/freedesktop/UIDisks/devices/md0", ma "/ md0".

Se questo non è d'aiuto, prova a confrontare tutti i parametri nella chiamata dbus con quale d-feet mostra, sono sicuro che hai trovato il tuo problema.

0

I tried my luck with:

dbus-send --system --print-reply \ 
    --dest=org.freedesktop.UDisks \ 
    /org/freedesktop/UIDisks/devices/md0 \ 
    org.freedesktop.DBus.Properties.GetAll \ 
    string:"" 

Hai un errore di battitura nel percorso dell'oggetto: si mette al posto di UIDisksUDisks. Correzione che dovrebbe correggere il tuo errore.


Affrontare i suoi commenti su this answer di ottenere tutte le proprietà in una sola volta, il D-Bus specification non specifica che GetAll dovrebbe accettare una stringa vuota per il suo argomento interface_name, quindi è un bug se eventuali servizi fanno accettare questo. Invece, è necessario chiamare GetAll una volta per ciascuna delle interfacce sull'oggetto.

Il modo più semplice per farlo consiste nell'utilizzare un'utilità D-Bus di livello superiore, ad esempio gdbus o D-Feet (come si stava tentando). dbus-send è progettato per un'interazione semplice e di basso livello con i servizi D-Bus.

$ gdbus introspect --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sda1 --only-properties 
node /org/freedesktop/UDisks2/block_devices/sda1 { 
    interface org.freedesktop.UDisks2.Partition { 
    properties: 
     readonly u Number = 1; 
     … 
    }; 
    interface org.freedesktop.UDisks2.Filesystem { 
    properties: 
     readonly aay MountPoints = [b'/boot/efi']; 
    }; 
    … 
} 
Problemi correlati