scripts: setup-bt.sh + run.py --no-llm mode for first ELM test

This commit is contained in:
“Naeel”
2026-05-25 19:44:02 +04:00
parent b3b044572c
commit 5a3cd6e0b3
2 changed files with 85 additions and 18 deletions
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
# setup-bt.sh — найти и подключить ELM327 по Bluetooth
# Запуск: bash scripts/setup-bt.sh
echo "🔍 Ищем Bluetooth-адаптер..."
if ! command -v bluetoothctl &>/dev/null; then
echo "❌ bluetoothctl не найден. Установи: sudo apt install bluez"
exit 1
fi
echo "📡 Включаем Bluetooth..."
rfkill unblock bluetooth 2>/dev/null
sleep 1
echo "🔍 Сканируем устройства (5 сек)..."
bluetoothctl --timeout 5 scan on 2>/dev/null &
sleep 6
bluetoothctl scan off 2>/dev/null
echo ""
echo "📋 Найденные устройства:"
bluetoothctl devices | while read -r line; do
echo " $line"
done
echo ""
echo "⚡ Если ELM327 в списке — введи его MAC (например 11:22:33:44:55:66):"
read -r MAC
if [ -z "$MAC" ]; then
echo "❌ MAC не введён. Попробуй ещё раз."
exit 1
fi
echo "🔗 Сопряжение с $MAC..."
bluetoothctl pair "$MAC" 2>&1
bluetoothctl trust "$MAC" 2>&1
echo "📡 Привязка к /dev/rfcomm0..."
sudo rfcomm bind 0 "$MAC" 2>&1
if [ -e /dev/rfcomm0 ]; then
echo "✅ /dev/rfcomm0 готов"
else
echo "⚠️ /dev/rfcomm0 не создался. Попробуй: sudo rfcomm bind 0 $MAC"
fi
echo ""
echo "✅ Готово. Запускай: DEEPSEEK_API_KEY=sk-... python run.py"
echo " Или без LLM: python run.py --no-llm"