首页 > 解决方案 > 在ubuntu 20.04上连接后蓝牙断开连接

问题描述

我正在尝试使用使用蓝牙和染料升华类型的即时照片打印机制作我自己的照相亭。为此,需要在 python 或 node js 代码中实现 BT 连接。基本上,我打算只使用系统命令。然而,目前已经测试了宝丽来 Hi-print 和柯达 P300R,但这些都没有连接。具体来说,它在连接后被远程用户(设备)断开连接。(实际上,它们只支持Android或iOS等移动平台)

现在,即使我很困惑,这也是可能的。你们能帮我度过难关吗?

这是使用“hcitool cc [btaddr]”连接的 btmon 日志。

@ RAW Open: hcitool (privileged) version 2.22              {0x0002} 3407.844746
@ RAW Close: hcitool                                       {0x0002} 3407.844761
@ RAW Open: hcitool (privileged) version 2.22       {0x0002} [hci0] 3407.844771
< HCI Command: Create Connection (0x01|0x0005) plen 13  #196 [hci0] 3407.844787
    Address: 00:15:83:41:DB:94 (IVT corporation)
    Packet type: 0xcc18
      DM1 may be used
      DH1 may be used
      DM3 may be used
      DH3 may be used
      DM5 may be used
      DH5 may be used
    Page scan repetition mode: R2 (0x02)
    Page scan mode: Mandatory (0x00)
    Clock offset: 0x0000
    Role switch: Allow slave (0x01)
> HCI Event: Command Status (0x0f) plen 4               #197 [hci0] 3407.982359
  Create Connection (0x01|0x0005) ncmd 2
    Status: Success (0x00)
> HCI Event: Role Change (0x12) plen 8                  #198 [hci0] 3408.627344
    Status: Success (0x00)
    Address: 00:15:83:41:DB:94 (IVT corporation)
    Role: Slave (0x01)
> HCI Event: Connect Complete (0x03) plen 11            #199 [hci0] 3408.633340
    Status: Success (0x00)
    Handle: 3
    Address: 00:15:83:41:DB:94 (IVT corporation)
    Link type: ACL (0x01)
    Encryption: Disabled (0x00)
@ RAW Close: hcitool                                {0x0002} [hci0] 3408.633412
< HCI Command: Read Remote Supp.. (0x01|0x001b) plen 2  #200 [hci0] 3408.633427
    Handle: 3
> HCI Event: Command Status (0x0f) plen 4               #201 [hci0] 3408.637320
  Read Remote Supported Features (0x01|0x001b) ncmd 2
    Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3             #202 [hci0] 3408.638316
    Handle: 3
    Max slots: 5
> HCI Event: Max Slots Change (0x1b) plen 3             #203 [hci0] 3408.644343
    Handle: 3
    Max slots: 5
> HCI Event: Read Remote Supported Fe.. (0x0b) plen 11  #204 [hci0] 3408.646313
    Status: Success (0x00)
    Handle: 3
    Features: 0xff 0xff 0xc9 0xfa 0x83 0xa7 0x79 0x87
      3 slot packets
      5 slot packets
      Encryption
      Slot offset
      Timing accuracy
      Role switch
      Hold mode
      Sniff mode
      Park state
      Power control requests
      Channel quality driven data rate (CQDDR)
      SCO link
      HV2 packets
      HV3 packets
      u-law log synchronous data
      A-law log synchronous data
      CVSD synchronous data
      Transparent synchronous data
      Flow control lag (most significant bit)
      Broadcast Encryption
      Enhanced Data Rate ACL 2 Mbps mode
      Enhanced inquiry scan
      Interlaced inquiry scan
      Interlaced page scan
      RSSI with inquiry results
      Extended SCO link (EV3 packets)
      EV4 packets
      EV5 packets
      3-slot Enhanced Data Rate ACL packets
      5-slot Enhanced Data Rate ACL packets
      Sniff subrating
      Pause encryption
      Enhanced Data Rate eSCO 2 Mbps mode
      3-slot Enhanced Data Rate eSCO packets
      Extended Inquiry Response
      Secure Simple Pairing
      Encapsulated PDU
      Erroneous Data Reporting
      Non-flushable Packet Boundary Flag
      Link Supervision Timeout Changed Event
      Inquiry TX Power Level
      Enhanced Power Control
      Extended features
< HCI Command: Read Remote Exte.. (0x01|0x001c) plen 3  #205 [hci0] 3408.646327
    Handle: 3
    Page: 1
> HCI Event: Command Status (0x0f) plen 4               #206 [hci0] 3408.647314
  Read Remote Extended Features (0x01|0x001c) ncmd 2
    Status: Success (0x00)
> HCI Event: Read Remote Extended Fea.. (0x23) plen 13  #207 [hci0] 3408.678320
    Status: Success (0x00)
    Handle: 3
    Page: 1/1
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
      Secure Simple Pairing (Host Support)
< HCI Command: Remote Name Req.. (0x01|0x0019) plen 10  #208 [hci0] 3408.678378
    Address: 00:15:83:41:DB:94 (IVT corporation)
    Page scan repetition mode: R2 (0x02)
    Page scan mode: Mandatory (0x00)
    Clock offset: 0x0000
< ACL Data TX: Handle 3 flags 0x00 dlen 10              #209 [hci0] 3408.678386
  L2CAP: Information Request (0x0a) ident 1 len 2
    Type: Extended features supported (0x0002)
> HCI Event: Command Status (0x0f) plen 4               #210 [hci0] 3408.680339
  Remote Name Request (0x01|0x0019) ncmd 2
    Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5  #211 [hci0] 3408.706320
    Num handles: 1
    Handle: 3
    Count: 1
> ACL Data RX: Handle 3 flags 0x02 dlen 16              #212 [hci0] 3408.708440
  L2CAP: Information Response (0x0b) ident 1 len 8
    Type: Extended features supported (0x0002)
    Result: Success (0x0000)
    Features: 0x00000080
      Fixed Channels
< ACL Data TX: Handle 3 flags 0x00 dlen 10              #213 [hci0] 3408.708483
  L2CAP: Information Request (0x0a) ident 2 len 2
    Type: Fixed channels supported (0x0003)
> HCI Event: Number of Completed Packets (0x13) plen 5  #214 [hci0] 3408.712315
    Num handles: 1
    Handle: 3
    Count: 1
> ACL Data RX: Handle 3 flags 0x02 dlen 20              #215 [hci0] 3408.714439
  L2CAP: Information Response (0x0b) ident 2 len 12
    Type: Fixed channels supported (0x0003)
    Result: Success (0x0000)
    Channels: 0x0000000000000002
      L2CAP Signaling (BR/EDR)
> HCI Event: Remote Name Req Complete (0x07) plen 255   #216 [hci0] 3408.733311
    Status: Success (0x00)
    Address: 00:15:83:41:DB:94 (IVT corporation)
    Name: Hi-Print 2×3 - DB94
@ MGMT Event: Device Connected (0x000b) plen 35     {0x0003} [hci0] 3408.733351
    BR/EDR Address: 00:15:83:41:DB:94 (IVT corporation)
    Flags: 0x00000000
    Data length: 22
    Name (complete): Hi-Print 2×3 - DB94
@ MGMT Event: Device Connected (0x000b) plen 35     {0x0001} [hci0] 3408.733351
    BR/EDR Address: 00:15:83:41:DB:94 (IVT corporation)
    Flags: 0x00000000
    Data length: 22
    Name (complete): Hi-Print 2×3 - DB94
< HCI Command: Disconnect (0x01|0x0006) plen 3          #217 [hci0] 3410.692257
    Handle: 3
    Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4               #218 [hci0] 3410.693261
  Disconnect (0x01|0x0006) ncmd 2
    Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4          #219 [hci0] 3410.790256
    Status: Success (0x00)
    Handle: 3
    Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8   {0x0003} [hci0] 3410.790295
    BR/EDR Address: 00:15:83:41:DB:94 (IVT corporation)
    Reason: Connection terminated by local host (0x02)
@ MGMT Event: Device Disconnected (0x000c) plen 8   {0x0001} [hci0] 3410.790295
    BR/EDR Address: 00:15:83:41:DB:94 (IVT corporation)
    Reason: Connection terminated by local host (0x02)

标签: bluetoothubuntu-20.04bluetooth-gatt

解决方案


推荐阅读