PyBluez'连接由同行重置'在树莓派上

时间:2014-10-04 16:47:09

标签: python bluetooth raspberry-pi raspbian bluez

我试图让PiTooth示例from here正常工作。我能够成功配对设备,但每当我在大约5秒后传输数据时,我会看到以下内容:

Traceback (most recent call last):
  File "./PiTooth.py", line 120, in <module>
    kb.event_loop(bt)
  File "./PiTooth.py", line 107, in event_loop
    bt.send_input(self.state)
  File "./PiTooth.py", line 80, in send_input
    self.cinterrupt.send(hex_str)
  File "<string>", line 5, in send
bluetooth.btcommon.BluetoothError: (104, 'Connection reset by peer')

知道我做错了吗?

修改

这是hcidump -a显示的内容:

> HCI Event: Command Complete (0x0e) plen 4
    Write Class of Device (0x03|0x0024) ncmd 1
    status 0x00
> HCI Event: Command Complete (0x0e) plen 4
    Write Local Name (0x03|0x0013) ncmd 1
    status 0x00
> HCI Event: Command Complete (0x0e) plen 252
    Read Local Name (0x03|0x0014) ncmd 1
    status 0x00 name 'PiToothFsr'
> HCI Event: Command Complete (0x0e) plen 4
    Write Scan Enable (0x03|0x001a) ncmd 1
    status 0x00
> HCI Event: Command Complete (0x0e) plen 5
    Read Scan Enable (0x03|0x0019) ncmd 1
    status 0x00 enable 3
> HCI Event: Command Complete (0x0e) plen 4
    Write Extended Inquiry Response (0x03|0x0052) ncmd 1
    status 0x00
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 28:CF:DA:D7:98:F3 class 0x38010c type ACL
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 12 bdaddr 28:CF:DA:D7:98:F3 type ACL encrypt 0x00
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr 28:CF:DA:D7:98:F3
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 12
    Features: 0xff 0xff 0xcf 0xfe 0x9b 0xff 0x79 0x83
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 12 page 1 max 1
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 28:CF:DA:D7:98:F3 name 'Macbook Pro'
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 12 encrypt 0x01
> HCI Event: Command Complete (0x0e) plen 4
    Write Extended Inquiry Response (0x03|0x0052) ncmd 1
    status 0x00
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 12 reason 0x16
    Reason: Connection Terminated by Local Host

0 个答案:

没有答案