ejpcmac
I am using Bluex to communicate with a BLE device from an Elixir application. It works great on a Linux host with a Bluetooth dongle, but I have troubles to get it work on a Raspberry Pi with the same dongle.
So far, I have built a custom Nerves system, including Bluetooth support in the Kernel and bluez-utils. Using the CLI utils, I am able to scan and view my device, so the system is OK. Now, the issue is that Bluex is not finding the DBus socket. There is effectively no /run/dbus/system_bus_socket.
Is there something I can do to have the DBus socket present? As Nerves systems are really minimalistic, I assume nothing is started apart from the BEAM, so I should start DBus and bluetoothd myself, isn’t it? If you have hints on how I should do that properly, I’m all ears!
Trending in Questions
Other Trending Topics
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
- #elixirconf-us
- #ai
- #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 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ConnorRigby
Great to see some bluetooth love.
You are on the right track. You will have to start
dbusandbluetoothdmanually as part of your supervision tree. Check out muontrapejpcmac
Yes, I am writing a tiny app to test that a BLE device works properly, and Elixir is a great language to get things done quickly.
Thanks for the tip, I’ll check muontrap and see what I can do from that.
OvermindDL1
Ooo, this looks awesome, many uses for it! Deserves it’s own post!
ConnorRigby
I believe it was announced on the forum here a while back. Its really useful for this kind of thing.
OvermindDL1
Hmm, I checked the forum via a quick search and there was no result, did a bigger google search on the site and no result, so not yet.
ConnorRigby
hm maybe i made that up then. I’ll poke Frank
atoncetti
Hey there
. I’m on the footsteps of @ejpcmac in setting up bluetooth an I’m following @ConnorRigby 's advice of using muontrap. I am stuck at creating the
/run/dbusdirectory thatdbus-daemon --systemneeds. I’ve tried multiple approaches:post-build.shwithmkdir -p /run/dbusrootfs_overlay/etc/dbus.configwith content-d /run/dbusAll of them failed in providing a
/run/dbusdirectory at boot time.Can someone steer me back on the right path?
Your help is much appreciated! Thanks!
fhunleth
In your Elixir application’s start function, call
File.mkdir("/run/dbus").Here’s the longer answer:
The default Nerves configuration mounts several different filesystems. The main one,
/, is read-only and contains OTP, Linux programs, and your Elixir application and all of its dependencies. You can add to that one via therootfs_overlay. However, some directories are made writable at runtime. Anything placed in those directories at compile-time isn’t accessible at runtime and that’s what you’re running into. Examples are the/tmp,/dev,/run, and/rootdirectories. In the case of/tmp,/dev, and/run, Nerves mounts small in-memory filesystems. They’ll lose their contents on reboots so if you’re going to create a directory in them, you need to do it each boot. This is generally desirable since if something gets messed up in them, a reboot returns you to a good state. In the case of/root, a writable filesystem is mounted there so that iex prompt history and other things survive reboots.As a general rule of thumb, I try to avoid using the
rootfs_overlayfeature. Usually Linux programs have a way to tell them where their configuration files are. That lets me put the config file in a more convenient location - like in my OTP application’sprivdirectory and tell it to read it from there. If programs need to write data, I can redirect them some place on/data, etc. Of course, it’s nice to see things work once before moving paths around, so this might be something to consider after the dust settles.atoncetti
Thanks for the great answer! That explains everything. Happy New Year, cheers!