我正在进行一项设置,希望将 RaspberryPi-3 连接到另一台机器。大多数时候它是一台 Windows 机器。在 Pi 上,我想通过蓝牙将所有键盘敲击转发到另一台(Windows)机器。
因此我做了一些研究,几年前一个叫 Liam 的人写了一个 Python 脚本,显然它在 BlueZ 4 上运行得很好。所以我决定在 BlueZ 5 上尝试一下。到目前为止还没有运气。
好吧,我想,好吧,我们降级版本吧。所以我从源代码编译了它,版本 4.10。没有运气。树莓派甚至不知道它安装了蓝牙适配器,可能是一些驱动程序出了问题。
于是我开始接触 BlueZ 5,一开始很简单。但实际上我现在正在努力注册 sdp_Record.xml。以及稳定的连接。
首先是 BlueZ 4 实现的参考文件:
BlueZ4.py:
#!/usr/bin/python2.7
#
# PiTooth allows the Raspberry Pi to act as a Bluetooth keyboard, and relays
# keypresses from a USB keyboard to a Bluetooth client. Written by Liam Fraser
# for a Linux User & Developer tutorial.
#
import os # Used to call external commands
import sys # Used …Run Code Online (Sandbox Code Playgroud)