stevensonmt
Anyone have experience interacting with DBus from within an elixir app? I’m trying to think of the best way to make the app’s internal state available to other services and setting a DBus property seems like one way to do so. I just can’t find much information about doing so from within elixir/erlang.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
There is this project
But I haven’t used it yet.
tj0
I haven’t done this in Erlang/Elixir, but I got smacked real bad once because there’s a difference between the system and session dbus.
Here are some notes in case you are unfamiliar.
There are two different dbus types. There is a “system” dbus which usually runs under /run/dbus/system_bus_socket (or some close by location) as user
dbusand is typically not the source of problems.However, there is generally confusion when a program doesn’t work. That’s becaues the [system] dbus is running, but the program can’t find [user] dbus.
The user dbus runs as your regular user account and does not have a well-known location to listen. Usually, programs needing the user-dbus will read the location from environmental variable
DBUS_SESSION_BUS_ADDRESS.Note you might think that launching your program with
dbus-launchis a good idea because it will then easily find dbus. This thinking will get you in a world of hurt because now there will be three separate dbus interfaces running, none of which speak to the other.Good luck in your quest.
cblavier
We use
dbusfrom elixir on our Elixir Nerves project (running on raspberry pi3).We use it to control different omxplayer processes.
No special library involved, we have a
DBusServergenserver managing the state of our daemon. We use the Elixir Port API to monitor its stateWe start the daemon like this:
we parse the command output with this code to extract its
pidand interact with it like this
stevensonmt
This is excellent. Thank you so much!
@tj0 thanks for the tips about understanding which dbus interface to target.
tj0
BTW, regarding the comment from @cblavier , it looks like that they are starting their own dbus session on Nerves and then interacting with dbus-send. I think this is probably because they bring the system up from scratch.
If you are planning to run on Ubuntu for example, you can just use the already existing
DBUS_SESSION_BUS_ADDRESSin your environment.Anyway, I’m not really sure what you’re trying to build, so just remember that if the session/user dbus environmental variable already exists, that is the one you probably want.
stevensonmt
I think I should be able to rely on
DBUS_SESSION_BUS_ADDRESSexisting, but it doesn’t look likeDBUS_SESSION_BUS_PIDexists. I’m guessing they set that env var with the pid of the spawned process (system pid not BEAM pid).stevensonmt
This is going to be a dumb question, but I’ve not interacted with DBus directly before so please bear with me. How are you getting the destination and object name parameters for
dbus-send?cblavier
I don’t know the dbus protocol in details, but I guess that destination and object names are messaging conventions you need to establish between the process sending/receiving messages.
For my purpose, I used the destinations and parameters that omxplayer is expecting. The best documentation I found was this script: omxplayer/dbuscontrol.sh at master · popcornmix/omxplayer · GitHub
tj0
Yes, all the names are pretty random. I used emacs dbus interface to query and figure out what is happening on dbus. Also, a copious use of dbus-monitor to understand what events are being published.
For cli, I’ve used
busctl:Also, check out https://unix.stackexchange.com/questions/46301/a-list-of-available-d-bus-services
There’s a few examples in python there also for interaction. Also
qdbusandqdbusvieweras QT-based dbus tools. I’ve never used any of them as I couldn’t figure out the correct packages for my distro.stevensonmt
nice tips, thanks. Have you figured out how/where to define your interfaces and services? On Arch it looks like the systemwide installation occurs in
/usr/share/dbus-1/but I’m not sure where to define user-specific definitions that wouldn’t require root privileges. This question has been shockingly hard to find answers for on google.