如何在linux下获得蓝牙串口状态?

时间:2015-02-03 21:19:46

标签: linux bash bluetooth console rfcomm

通过linux终端获取串口(ttyS *)的状态很简单:

sudo cat /proc/tty/driver/serial

然后它显示serinfo所有uart的列表,其中包含有关状态和缓冲区的信息。当我打电话

sudo cat /proc/tty/drivers

然后我可以看到rfcomm驱动程序可用:

rfcomm   /dev/rfcomm   216 0-255 serial

当然,读取配对蓝牙设备的数据不是问题。

问题是:如何获取rfcomm串口的状态(例如Blueotooth SPP设备)?这些信息是否可以在/proc目录中的某个位置获得,例如ttyS *,还是可以使用完全不同的方式?

1 个答案:

答案 0 :(得分:0)

这取决于您要寻找的状态。 " rfcomm" bluez附带的命令确实有一些状态信息。这取决于你是否足够。

% rfcomm -h
RFCOMM configuration utility ver 4.101
Usage:
        rfcomm [options] <command> <dev>

Options:
        -i [hciX|bdaddr]      Local HCI device or BD Address
        -h, --help            Display help
        -r, --raw             Switch TTY into raw mode
        -A, --auth            Enable authentication
        -E, --encrypt         Enable encryption
        -S, --secure          Secure connection
        -M, --master          Become the master of a piconet
        -f, --config [file]   Specify alternate config file
        -a                    Show all devices (default)

Commands:
        bind     <dev> <bdaddr> [channel]       Bind device
        release  <dev>                          Release device
        show     <dev>                          Show device
        connect  <dev> <bdaddr> [channel]       Connect device
        listen   <dev> [channel [cmd]]          Listen
        watch    <dev> [channel [cmd]]          Watch
相关问题