Implementing Bluetooth Classic (RFCOMM) Socket with Auto-Pairing on Raspberry Pi OS (Rust + Bluer Crate)

⚓ rust    📅 2025-04-26    👤 surdeus    👁️ 1      

surdeus

I'm developing a Bluetooth server on a Raspberry Pi 5 running Debian Bookworm (64-bit) and targeting Bluetooth Classic (RFCOMM) communication. I'm using the bluer crate in Rust for Bluetooth support.

So far:

  • Device discovery, scanning, and SPP profile registration are working correctly.
  • I’ve successfully set the adapter to discoverable, pairable, and powered.

What I need help with:

  • I want to implement the Classic mode using RFCOMM socket, so that Android devices can auto-pair and initiate a connection with no PIN or dialog (e.g., using "NoInputNoOutput").
  • I need the server (Raspberry Pi) to handle auto-pairing and allow seamless data transfer over RFCOMM.
  • bluer provides some support via the agent and rfcomm modules, but the documentation and examples are limited for Bluetooth Classic Setup.
  • There is very little available documentation on how to build a complete Classic Bluetooth stack in Rust using bluer or another crate.

Questions:

  1. Is it possible to fully implement auto-pairing and auto-authorization logic for Bluetooth Classic in Rust using bluer?
  2. If not, are there alternative crates or libraries (Rust or C interop) that support this?
  3. How can I manage trusted device behavior and simplify or skip pairing dialogs programmatically?

1 post - 1 participant

Read full topic

🏷️ rust_feed