Commit graph

5 commits

Author SHA1 Message Date
torlando-tech
a0f361a3f4 feat: add Bluetooth adapter power state handling and auto-power-on
Addresses the common "Not Powered" error where Bluetooth adapters are
powered off, preventing BLE operations. This issue is particularly common
on Raspberry Pi after boot or system updates.

Changes:

1. README.md - Added comprehensive troubleshooting section
   - New section: "Bluetooth adapter not powered"
   - Documented symptoms, causes, and 4 solution methods
   - Instructions for automatic power-on at boot
   - Cross-referenced from other sections

2. BLEInterface.py - Enhanced error handling in _discover_peers()
   - Detect "Not Powered" errors specifically
   - Show clear, actionable error messages instead of stack traces
   - Provide direct solution commands
   - Link to troubleshooting documentation
   - Gracefully handle error without crashing

3. install.sh - Automatic power state checking
   - New "Step 5B: Bluetooth Adapter Power State" section
   - Check if adapter is powered using `bluetoothctl show`
   - Automatically power on adapter if needed
   - Verify operation succeeded
   - Provide troubleshooting steps if power-on fails
   - Check for rfkill blocks

4. examples/bluetooth-power-on.service - New systemd service
   - Ensures Bluetooth is powered on at boot
   - Optional but recommended for production
   - Includes installation instructions in README

5. examples/config_example.toml - Added troubleshooting entry #7
   - Documents power state issue in config comments
   - Cross-references systemd service example
   - Notes that installer (v1.x+) handles this automatically

Impact:
- Users get clear guidance instead of cryptic stack traces
- Installer automatically fixes the issue during setup
- Reduces support burden for common power state errors
- Enables automatic recovery at boot via systemd service

Fixes: "Not Powered" / "No powered Bluetooth adapters found" errors
Tested on: Raspberry Pi Zero 2 W with Raspberry Pi OS Lite 64-bit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 00:10:57 -04:00
torlando-tech
0e00fbf2d6 feat: enable BlueZ experimental mode by default to fix BLE connection issues
Fixes #3

BlueZ experimental mode is required for proper BLE connectivity. Without it,
BlueZ attempts Classic Bluetooth (BR/EDR) connections instead of BLE (LE)
connections, causing connection errors like "br-connection-profile-unavailable"
and immediate disconnections after pairing.

Changes:
- install.sh: Automatically enables BlueZ experimental mode during installation
  - Detects BlueZ version (requires >= 5.49)
  - Creates systemd override to add -E flag to bluetoothd
  - Checks if already enabled to avoid duplicate configuration
  - Shows strong warning if user skips with --skip-experimental flag
- Added --skip-experimental flag to opt-out (not recommended)
- Updated help text to document new flag
- tests/test_installer.sh: Added tests for experimental mode configuration
- README.md: Documented BlueZ experimental mode in installation sections
  - Added to automated installation description
  - Added as required step in manual installation
  - Added troubleshooting section for BR/EDR connection errors
- examples/config_example.toml: Added troubleshooting entry for BR/EDR errors

The installer now:
1. Detects BlueZ version >= 5.49 (required for experimental mode)
2. Checks if already enabled (graceful skip)
3. Enables experimental mode by default unless --skip-experimental is used
4. Shows prominent warning if skipped (may cause BLE to break)
5. Handles edge cases (no systemd, old BlueZ, container environments)

This addresses the root cause reported in issue #3 where devices were
connecting then immediately disconnecting with BR/EDR profile errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 23:25:52 -04:00
torlando-tech
80d8ff7c24 fix: support custom config directories via RNS.Reticulum.configdir
The BLE interface now dynamically resolves the interface directory
by checking RNS.Reticulum.configdir when loaded via exec() by Reticulum.
This allows users to specify custom config directories using the
--config flag without encountering import errors.

Changes:
- Update BLEInterface.py to use RNS.Reticulum.configdir when available
- Add fallback to default ~/.reticulum/interfaces for backward compatibility
- Add comprehensive test coverage for config directory resolution
- Update documentation to mention custom config directory support

Fixes #2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 19:09:48 -04:00
torlando-tech
42c2ab701f add missing integration test script 2025-10-27 00:33:57 -04:00
torlando-tech
486f210ae4 Initial commit: BLE Reticulum interface 2025-10-26 19:14:14 -04:00