简体   繁体   中英

How to get bluetooth serial port status under linux?

Getting status of serial ports (ttyS*) via linux terminal is simple:

sudo cat /proc/tty/driver/serial

Then it shows serinfo with list of all uarts with info about status and buffers. When I call

sudo cat /proc/tty/drivers

then I can see that rfcomm drivers are available:

rfcomm   /dev/rfcomm   216 0-255 serial

And, of course, reading data comming from paired bluetooth device is not a problem.

The question is: how to get status of rfcomm serial ports (eg Blueotooth SPP devices)? Is this information available somewhere in the /proc directory like for ttyS* or could I use totally different way?

It depends what status you are looking for. The "rfcomm" command that comes with bluez does have some status info. It depends if that is adequate for you.

% 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM