-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firefly linux node 8.9.4 example fails unknown bus address #229
Comments
|
I think you're correct, as I was running it from a shell and it appears to work when run in an xterm. One thing I wish for is better errors, or a troubleshooting type doc to help in these matters. I've spent the better part of the day trying to get notification of a USB mount event and I'm only slightly closer to a resolution. |
Yes, fully agree with you. This is something that definitely needs improvement |
@sidorares I'm working on the udisk2 interface. Really, I just need to have a function called when a USB stick is inserted and the system mounts it (using automount). Using dbus-monitor I can see the following message for the insertion:
When the filesystem mount starts I see this: signal time=1525065831.741319 sender=:1.59 -> destination=(null destination) serial=2190 path=/org/freedesktop/UDisks2; interface=org.freedesktop.DBus.ObjectManager; member=InterfacesAdded As job 206 runs, I see the mount point show up and the job completes. signal time=1525065831.775012 sender=:1.59 -> destination=(null destination) serial=2191 path=/org/freedesktop/UDisks2/block_devices/sdb1; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged The trouble is, I can't figure out how to get the contents of these through dbus-native. I've messed with the code for a good 6 hours and every way I've tried to call GetAll it either dies with an exception or just returns an undefined var. Can you give me any pointers? thanks |
As these are all signal the easiest way is just to listen all messages and check if message is from service var dbus = require('dbus-native');
var conn = dbus.createConnection();
conn.on('message', function(msg) {
if (msg.path === '/org/freedesktop/UDisks2' && msg.member === 'InterfacesAdded' ) {
console.log('Interface added: ', msg.body);
}
}); |
Not sure why, but that code does not seem to fire at all. Adding debugging in there shows it never runs. Any ideas? var conn = dbus.createConnection(); |
I'll try to test this code in couple of hours when I beck home at my desktop computer |
This morning I tried a variety of things but the conn never seems to fire with messages. I'm not sure if it's a permissions thing or something else failing silently. |
@sidorares I put another 5-6h of work into it. Still not getting anywhere. I wonder if you tested the script on your side? If it worked there, is there anything permissions-wise that could be interfering? |
so my example is definitely not enough. In order to receive signals client must send AddMatch message first try this to see listen for all events: var dbus = require('dbus-native');
var bus = dbus.sessionBus();
bus.connection.on('message', console.log);
bus.addMatch("type='signal'");
bus.addMatch("type='method_call'");
bus.addMatch("type='method_return'");
bus.connection.on('message', function(msg) {
console.log(msg);
}); |
Thanks, the addMatch part really made a difference! Is there anything documented on how to manage the msg object? |
Message is plain object, to better understand semantics of what's there best start is dbus spec: https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages Also if you want to continue with "low level" approach (not via automatic introspection) section on match rules also useful: https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules |
I didn't know where to find the session bus address at first. This worked for me on Arch linux: |
I'm trying to get the module to run on a small embedded device. I've installed it as per instructions. I took the example below directly from the README.
var dbus = require('dbus-native');
var sessionBus = dbus.sessionBus();
sessionBus.getService('org.freedesktop.Notifications').getInterface(
'/org/freedesktop/Notifications',
'org.freedesktop.Notifications', function(err, notifications) {
});
It fails with the following error:
/home/miker/test1/node_modules/dbus-native/index.js:22
if (!busAddress) throw new Error('unknown bus address');
^
Error: unknown bus address
at createStream (/home/miker/test1/node_modules/dbus-native/index.js:22:26)
at createConnection (/home/miker/test1/node_modules/dbus-native/index.js:76:31)
at Object.module.exports.createClient (/home/miker/test1/node_modules/dbus-native/index.js:136:20)
at Object.module.exports.sessionBus (/home/miker/test1/node_modules/dbus-native/index.js:149:25)
at Object. (/home/miker/test1/test.js:2:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
miker@firefly:
/test1$ node -v/test1$ npm -vv8.9.4
miker@firefly:
6.0.0
The text was updated successfully, but these errors were encountered: