I am doing project in which i need to detect all available usb drives
and its info. Mainly i am interested in USB device (flash drive and
external hard disk), mount point, uuid, total size, available space,
label, and is the usb mounted or not. I thought ruby-dbus would be
better to go with udisk. So installed with out an error. However i am
unable to proceed further. I need to use this on linux. Here is the
sample code
However i get this error
undefined method `DeviceIsRemovable’ for nil:NilClass (NoMethodError)
which i don’t understand. Could some one help me on this?
Useful links:-
ruby-usb
However i get this error
undefined method `DeviceIsRemovable’ for nil:NilClass (NoMethodError)
which i don’t understand. Could some one help me on this?
It means that rb_udisk_iface' is nil and you are trying to callnil.DeviceIsRemovable’ in your last line, which does not exist.
Seems rb_udisk[“org.freedesktop.UDisks.Device”] returns nil
for some reason. Can’t help you there, though.
and the output is
/org/freedesktop/UDisks/devices/sr0
/org/freedesktop/UDisks/devices/sda
/org/freedesktop/UDisks/devices/sda1
/org/freedesktop/UDisks/devices/sda2
/org/freedesktop/UDisks/devices/sda3
/org/freedesktop/UDisks/devices/sdb
/org/freedesktop/UDisks/devices/sda5
/org/freedesktop/UDisks/devices/sda6
/org/freedesktop/UDisks/devices/sda7
/org/freedesktop/UDisks/devices/sda8
/org/freedesktop/UDisks/devices/sdb1
Howver if i provide other that listed in the following manual results
some error.