如何从无音量/电源键的初代亚马逊Fire TV遥控器读取语音数据?
Hey there! Let's get that Fire TV Remote's built-in mic working on your Pi. The hangup after receiving AT+BRSF=253 is all about missing required AT command responses—this remote uses Bluetooth HFP (Hands-Free Profile) for audio, so we need to complete the initial handshake before it sends audio data.
Step 1: Understand the AT Command Handshake
When you connect via rfcomm, the remote starts an HFP initialization sequence. If you don't respond correctly to each command, it stops dead. Here's the full expected handshake you need to handle:
- Remote sends:
AT+BRSF=253- Reply with:
+BRSF: 253\r\nfollowed byOK\r\n
- Reply with:
- Next, remote sends:
AT+CIND=?(queries indicator statuses)- Reply with:
+CIND: ("service",(0,1)),("call",(0,1))\r\nthenOK\r\n
- Reply with:
- Then:
AT+CIND?(checks current indicator state)- Reply with:
+CIND: 0,0\r\nthenOK\r\n
- Reply with:
- Finally:
AT+CMEE=1(enables extended error messages)- Reply with:
OK\r\n
- Reply with:
Step 2: Test the Handshake Manually
First, confirm this works with a terminal tool like screen:
- Connect the rfcomm port:
sudo rfcomm connect /dev/rfcomm1 FC:65:DE:E8:E8:FD 1 - Open another terminal to interact with the port:
screen /dev/rfcomm1 115200 - When you see
AT+BRSF=253appear, type the responses exactly as listed (press Enter after each line). Once the handshake is done, the remote should activate the mic and start sending audio over the SCO channel.
Step 3: Automate the Handshake with a Script
Manually typing responses isn't practical. Here's a simple Python script to handle the AT commands automatically. First install the pyserial library:
sudo apt install python3-serial
Create firetv_mic_handshake.py:
import serial import time ser = serial.Serial('/dev/rfcomm1', 115200, timeout=1) try: while True: line = ser.readline().decode('utf-8').strip() if not line: continue print(f"Received: {line}") if line == "AT+BRSF=253": ser.write("+BRSF: 253\r\nOK\r\n".encode('utf-8')) elif line == "AT+CIND=?": ser.write("+CIND: (\"service\",(0,1)),(\"call\",(0,1))\r\nOK\r\n".encode('utf-8')) elif line == "AT+CIND?": ser.write("+CIND: 0,0\r\nOK\r\n".encode('utf-8')) elif line == "AT+CMEE=1": ser.write("OK\r\n".encode('utf-8')) time.sleep(0.1) except KeyboardInterrupt: ser.close() print("Disconnected")
Run the script right after connecting the rfcomm port:
python3 firetv_mic_handshake.py
Step 4: Capture the Audio Stream
Once the handshake is complete, the remote uses a Bluetooth SCO channel for audio. Use bluealsa to capture this stream (install it first if needed):
sudo apt install bluealsa
Start recording with:
bluealsa-record -d FC:65:DE:E8:E8:FD -f S16_LE -r 16000 -c 1 -t wav -f firetv_mic_recording.wav
This records 16-bit, 16kHz mono audio to a WAV file.
Step 5: Tie It to the Mic Button
Since you already detect the mic button press, automate the workflow:
- Write a shell script that runs
rfcomm connect, starts the Python handshake script, and launchesbluealsa-record. - Use your existing button event listener to trigger this script when the mic button is pressed, and stop all processes when it's released.
Quick Bluetooth Config Check
Make sure your Pi's Bluetooth stack supports HFP/SCO:
- Edit
/etc/bluetooth/main.confand ensure these lines are set:Enable=Source,Sink,Media,Socket SCOMTU=64 - Restart Bluetooth:
sudo systemctl restart bluetooth
内容的提问来源于stack exchange,提问作者Dennis Zierahn

