ImNotAVirus

ImNotAVirus

For my first Nerves project, I would like to create a Phoenix application that would be available only via Bluetooth Personal Area Network (PAN).

I’ve never done this before, but from what I could understand it would be feasible.

During my researches, I came across this stackoverflow post explaining in detail how to setup a Bluetooth PAN on Raspbian.

So I tried to reproduce the steps for Nerves :

  • First, I created a new system based on nerves_system_rpi3
  • On this system I installed bluez-tools and bluez-utils packages
  • I’ve also activated the Bluetooth subsystem support in make linux-menuconfig → Networking Support

Once the firmware burn on my SD card and the Raspberry started, I executed the following commands :

# Run D-Bus & Bluetoothd daemons
mkdir -p /var/run/dbus
/usr/bin/dbus-daemon --system
/usr/libexec/bluetooth/bluetoothd &

# Create PAN interface
ip link add pan0 type bridge

# Configure interface
ifconfig pan0 192.168.50.1 netmask 255.255.255.0 up

Until then, no problem.
But when I tried to execute bt-agent -c NoInputNoOutput or bt-network -s nap pan0, I got the following error:

bt-agent: bluez service is not found
Did you forget to run bluetoothd?

However, when I display the list of processes, I can see bluetoothd running.

I would like to know if anyone has ever had this problem or if anyone has ever succeeded in setting up a Bluetooth PAN.

Thanks in advance.

Showing Posts 1 to 8

fhunleth

fhunleth

Co-author of Nerves

You’re following the steps that I’d take if I were doing this. As a sanity check, does this work on Raspbian? And I wonder if dmesg shows any errors?

Also, not that this is a bad thing, but this is an ambitious first project. I think that you’ll be the first person to get Bluetooth PANs working with Nerves, so I’m very curious to hear your progress.

ImNotAVirus

ImNotAVirus OP

First of all, thank you for your answer.

I just tried this afternoon on Raspbian and I was able to setup a working PAN.
For dmesg, there is no error.

I like to have ambitious projects when I try out a technology. It allows me to really try to understand how it works, especially when I’m trying to do something and there is little documentation on the topic ^^

I will try again and I will update this post if I manage to get the NAP working on Nerves.

ImNotAVirus

ImNotAVirus OP

Small progress: After several hours of debugging, it seems that the problem comes from bluetoothd.

When I run it on Raspbian with debug mode (bluetoothd -nd) it finds my Bluetooth controller:

bluetoothd[1249]: src/adapter.c:read_index_list_complete() Number of controllers: 1

but he doesn’t find it on Nerves:

bluetoothd[279]: src/adapter.c:read_index_list_complete() Number of controllers: 0

So I tried to attach it manually by following the documentation on the Alpine website with

btattach -B /dev/ttyAMA0 -P bcm -S 115200 -N &

But I now have the following errors (dmesg):

[  139.810619] Bluetooth: Core ver 2.22
[  139.823002] NET: Registered protocol family 31
[  139.835931] Bluetooth: HCI device and connection manager initialized
[  139.851048] Bluetooth: HCI socket layer initialized
[  139.864618] Bluetooth: L2CAP socket layer initialized
[  139.878279] Bluetooth: SCO socket layer initialized
[  226.396734] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  226.410839] Bluetooth: BNEP socket layer initialized
[  724.174859] Bluetooth: HCI UART driver ver 2.3
[  724.187883] Bluetooth: HCI UART protocol H4 registered
[  724.201545] Bluetooth: HCI UART protocol BCSP registered
[  724.215564] Bluetooth: HCI UART protocol Broadcom registered
---> [  726.312378] Bluetooth: hci0: command 0x0c03 tx timeout
---> [  734.552396] Bluetooth: hci0: BCM: Reset failed (-110)
outlog

outlog

think you need to comment out dtoverlay=pi3-miniuart-bt in config.txt

can’t really grasp it all - but believe that overlay moves BT to tttyS0 aka the mini-uart, so it’s not on ttyAMA0 - see https://github.com/raspberrypi/documentation/blob/master/configuration/uart.md

ImNotAVirus

ImNotAVirus OP

Thanks! You were right! My controller is now properly detected.

Unfortunately, I always get the same errors when I run bt-agent -c NoInputNoOutput and bt-network -s nap pan0:

(bt-agent:361): GLib-CRITICAL **: 22:56:40.140: PCRE library is compiled without UTF8 support   
(bt-agent:361): GLib-CRITICAL **: 22:56:40.140: PCRE library is compiled without UTF8 properties support
bt-agent: bluez service is not found
Did you forget to run bluetoothd?

It seems that bluetoothd wants to write to /var/lib/bluetooth but it can’t (read-only partition):

bluetoothd[333]: Unable to open adapter storage directory: /var/lib/bluetooth/XX:XX:XX:XX:XX:XX

I’ll keep digging.

GregMefford

GregMefford

Great work figuring that out so far! :rocket:

It’s been a while since I’ve done it, but I believe if you want to make that directory be writable, you can either configure the application to write to somewhere that is writable, mount a writable partition there, or use a symlink to redirect that directory to a place that is writable.

Advanced Configuration — nerves v1.14.3

I thought we used to have an example of doing that e.g. for making the /etc/resolv.conf file and friends be writable, but I’m having trouble finding a link to that now. Maybe someone else knows what I’m talking about and/or can fill in the gap.

ImNotAVirus

ImNotAVirus OP

Thanks for your help!

I think I’ll create a symlink to /tmp/bluetooth because I don’t think it’s necessary to make this folder persistent.

Currently I don’t really understand how to do it and I would be happy to have some documentation on the subject or a code to study.

ImNotAVirus

ImNotAVirus OP

Small progress: I added a symbolic link from /var/lib/bluetooth to /tmp/bluetooth (via rootfs_overlay) but I still have the same error.

(bt-agent:363): GLib-CRITICAL **: 13:30:51.254: PCRE library is compiled without UTF8          
(bt-agent:363): GLib-CRITICAL **: 13:30:51.255: PCRE library is compiled without UTF8 properties support
bt-agent: bluez service is not found
Did you forget to run bluetoothd?

Now I don’t understand what the problem is since I don’t have any error anymore (neither from dmesg nor from bluetoothd).

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
nseaSeb
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
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
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
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews