-
Notifications
You must be signed in to change notification settings - Fork 29
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
can't connect to system bus #3
Comments
That's the expected result (i think). Look at 'system-server-addresses' function. It retrieves DBUS address from the environment variables. The 'standard' way to retrieve the bus address is to read the file ".dbus/session-bus/[machine-id]-[display]". try (defun get-machine-id ()
(with-open-file (machine-id-file "/var/lib/dbus/machine-id"
:direction :input)
(read-line machine-id-file)))
(defun get-display-number ()
(let ((display (getenv "DISPLAY")))
(if (null display)
(error "DISPLAY variable not set.")
(handler-case
(parse-integer (subseq display (1+ (position #\: display)) (position #\. display)))
(parse-error () (error "Can not parse DISPLAY variable."))))))
(defun update-environment-variables ()
"Sets the 'DBUS_SESSION_BUS_ADDRESS' environment variable (if not present)."
(when (not (getenv "DBUS_SESSION_BUS_ADDRESS"))
(let (machine-id display)
(setq machine-id (get-machine-id))
(setq display (format nil "~d" (get-display-number)))
(iolib.syscalls:setenv
"DBUS_SESSION_BUS_ADDRESS"
(get-session-bus-address-from-file
(concatenate 'string "~/.dbus/session-bus/" machine-id "-" display))
t)))) That is how i got it working (take a look at my fork, i also have EXTERNAL auth method) |
I appreciate the thorough response. The system bus connection is obtained through /var/run/dbus/system_bus_socket by default. This seems the correct approach, but it doesn't work. I will try your fork. |
That does in fact work! Is it the external auth that makes the difference? I will need to investigate further to eliminate the mystery. |
After playing around some more, I discovered the proper syntax for variant type signatures: (with-open-bus (bus (system-server-addresses))
(with-introspected-object (wicd-wireless bus "/org/wicd/daemon/wireless" "org.wicd.daemon")
(wicd-wireless "org.wicd.daemon.wireless" "GetWirelessProperty" '((:int32) 0) '((:string) "bssid")))) This is cumbersome for auto-generating functions to the interface. Is there a mechanism to introspecting further into a variant type, or is the only way to guess from the type of arguments passed in? |
The external SASL authentication method fixes this issue. I would suggest pulling this in from lucashpandolfo. |
I can verify this issue as well. The most basic replication method is to run (notify-example) from examples/notify.lisp. |
Hello (after a long vacation :)
|
Debian squeeze, dbus 1.2.24-4
Example:
(dbus:with-open-bus (bus (dbus:system-server-addresses))
(dbus:with-introspected-object (wicd-wireless bus "/org/wicd/daemon/wireless" "org.wicd.daemon")))
Error: No more mechanisms to try.
Seems to be related to cookie sha1 auth
Python and scheme bindings via libdbus are working
Working example in scheme:
(define wicd-wireless-context (dbus:make-context
bus: dbus:system-bus
service: 'org.wicd.daemon
interface: 'org.wicd.daemon.wireless
path: '/org/wicd/daemon/wireless))
(dbus:call wicd-wireless-context "GetWirelessProperty" 0 "bssid")
("88:43:E1:13:FC:B2")
I don't yet know enough to attempt a fix unfortunately.
The text was updated successfully, but these errors were encountered: