Open kclim2 opened 8 years ago
looks like getInterface
returns error - could you
1) check which version of UDisk you aare running ( start d-feet
and see what services look like UDisk ? )
2) verify err
before using ud
there is no error returned by getInterface (err == null)
using the d-feet, i found that the only available UDisks Object path is /org/freedesktop/UDisks2
the interfaces under org.freedesktop.DBus are: org.freedesktop.DBus.Introspectable org.freedesktop.DBus.ObjectManager org.freedesktop.DBus.Peer org.freedesktop.DBus.Properties
another UDisks related Object path is /org/freedesktop/UDisks2/Manager the interfaces under this object path are: org.freedesktop.DBus.Introspectable org.freedesktop.DBus.Peer org.freedesktop.DBus.Properties org.freedesktop.UDisk2.Manager
anyway, now the error message is: node test-dbus_native.js
err == null
/home/ubuntu/node_modules/dbus-native/node_modules/xml2js/lib/xml2js.js:216 throw ex; ^
TypeError: Cannot read property 'on' of undefined
at /home/ubuntu/test-dbus_native.js:14:5
at /home/ubuntu/node_modules/dbus-native/lib/bus.js:274:17
at /home/ubuntu/node_modules/dbus-native/lib/bus.js:267:17
at /home/ubuntu/node_modules/dbus-native/lib/introspect.js:167:11
at Parser.
`var dbus = require('dbus-native');
var bus = dbus.systemBus(); udservice = bus.getService('org.freedesktop.UDisks2'); try { udservice.getInterface('/org/freedesktop/UDisks2', 'org.freedesktop.UDisks2', function(err, ud) { console.log('err == ',err); if(err){ console.lorg('error getting interface!'); throw(err) } /* Event, which gets called, if a usb-device has been found. //*/ ud.on('DeviceAdded', function(deviceObjectPath) { udservice.getInterface(deviceObjectPath, 'org.freedesktop.DBus.Properties', function(err, diskProperties) { diskProperties.Get('DeviceMountPaths', function(err, mountPointPaths) { console.log(mountPointPaths); }); }) }); }); }catch(ex){ console.log(ex); } `
Hi,
I tried to replicate the work as discussed in issue #8 for USB mounting but get the following errors:
the code:
cat test-dbus_native.js
The detail of my system is as follow: ubuntu@ubuntu-lenovo:~$ cat node_modules/dbus-native/package.json
ubuntu 14.04LTS 64-bit
uname -a Linux ubuntu-lenovo 3.16.0-62-generic #83~14.04.1-Ubuntu SMP Fri Feb 26 22:52:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux