【问题标题】:Disable AT command on rfcomm connect在 rfcomm 连接上禁用 AT 命令
【发布时间】:2015-10-24 19:24:54
【问题描述】:

从 Ubuntu 连接到蓝牙串行端口时:

adi@Poppy:~$ sudo rfcomm -r connect 0
Connected /dev/rfcomm0 to 1C:3E:84:FE:4F:69 on channel 8
Press CTRL-C for hangup

在客户端,我收到以下数据,这些数据是在连接时从 Ubuntu 自动发送的:

41 54 5e 53 51 50 4f 52 54 3f 0d 41 54 0d 41 54 0d 41 54 0d 7e 00 78 f0 7e 7e 00 78 f0 7e

AT^SQPORT?
AT
AT
AT
~

这会干扰我想要做的事情,因此我需要阻止 Ubuntu 向客户端发送任何未经请求的数据。

谢谢。

【问题讨论】:

    标签: linux ubuntu bluetooth rfcomm ubuntu-15.04


    【解决方案1】:

    连接到端口后,minicom 只能在 root 下运行(这让我很困惑)。对于我得到的任何其他用户:

    adi@Poppy:~$ minicom -D /dev/rfcomm1
    minicom: cannot open /dev/rfcomm1: Device or resource busy
    
    adi@Poppy:~$ ls -lsa /dev/rfcomm1 
    0 crw-rw-rw- 1 root dialout 216, 1 aug  3 19:46 /dev/rfcomm1
    

    所以我这样做了:

    adi@Poppy:~$ sudo fuser /dev/rfcomm1
    [sudo] password for adi: 
    /dev/rfcomm1:          696
    
    adi@Poppy:~$ ps -p 696
      PID TTY          TIME CMD
      696 ?        00:00:00 ModemManager
    

    啊哈,明白了!

    杀死进程后,你怎么看?连接时没有 AT 命令。

    【讨论】:

      【解决方案2】:

      另一种方法,在 udev 系统中设置新规则会有所帮助。

      在 /etc/udev/rules.d/90-rfcomm.rules 中,请输入以下行:

      KERNEL=="rfcomm[0-9]*", ENV{ID_MM_DEVICE_IGNORE}="1"

      【讨论】:

        猜你喜欢
        • 2013-09-05
        • 1970-01-01
        • 1970-01-01
        • 2013-03-25
        • 2011-08-23
        • 1970-01-01
        • 1970-01-01
        • 2018-07-08
        • 1970-01-01
        相关资源
        最近更新 更多