4

I'm trying to get the PiTooth example from here working. I'm able to get the devices to pair successfully, but whenever I transmit data after approximately 5 seconds, I see the following:

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')

Any idea what I'm doing wrong?

EDIT:

Here's what hcidump -a shows:

> 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
Justin Ramos
  • 116
  • 10
  • Possibly related: [How can I make a connection between Raspberry Pi and a Bluegiga WT11i Bluetooth Module using Python?](http://stackoverflow.com/questions/17831211/how-can-i-make-a-connection-between-raspberry-pi-and-a-bluegiga-wt11i-bluetooth) – Lukas Graf Oct 04 '14 at 16:53
  • I don't believe they're related. I'm getting a 104; he's getting a 111. – Justin Ramos Oct 04 '14 at 17:28
  • You're right. I could have sworn I read `Connection reset by peer` in that question (that's what I googled for). – Lukas Graf Oct 04 '14 at 17:29
  • I've made sure that I've disabled pnat for Bluetooth, but I can't seem to maintain a connection for longer than 4-5 seconds. – Justin Ramos Oct 05 '14 at 16:06

0 Answers0