ntanenho
Posts: 3
Joined: Fri Sep 29, 2017 3:42 pm

Bluetoothctl connect timeout error

Fri Jan 19, 2018 4:19 pm

This is the error I am getting when I connect to my mobile phone using the connect method in this documentation: https://gist.github.com/egorf/66d88056a9d703928f93,

raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0xb62e3ab0>
command: /usr/bin/bluetoothctl
args: ['/usr/bin/bluetoothctl']
buffer (last 100 chars): 'mCHG\x1b[0m] Device 98:5F:D3:57:1A:BD RSSI: -47\r\n[\x 1b[0;93mCHG\x1b[0m] Device 98:5F:D3:57:1A:BD TxPower: 4\r\n'
before (last 100 chars): 'mCHG\x1b[0m] Device 98:5F:D3:57:1A:BD RSSI: -47\r\n[\x 1b[0;93mCHG\x1b[0m] Device 98:5F:D3:57:1A:BD TxPower: 4\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 544
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile("Failed to connect")
1: re.compile("Connection successful")
2: EOF

The connection is supposed to fail since my phone is connected to another device, however it should return "failed to connect" and move on to the next paired-device that I have in my loop which calls the connect method. Unfortunately I cannot show my code. What should I do in the connect method to bypass the exception and return false for failed to connect?

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Bluetoothctl connect timeout error

Fri Jan 19, 2018 4:57 pm

Unfortunately I cannot show my code.
That isn't going to help.

Dave.
Apple say... Monkey do !!

ntanenho
Posts: 3
Joined: Fri Sep 29, 2017 3:42 pm

Re: Bluetoothctl connect timeout error

Fri Jan 19, 2018 5:01 pm

It's clearly a pexpect issue, all I do is a simple method call on the connect method in the Github repository using a mac address of a device that has bluetooth enabled. This is a fix that needs to be applied in that code not my own that only calls the method, so I don't really need to provide my code.

User avatar
elParaguayo
Posts: 1936
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Bluetoothctl connect timeout error

Fri Jan 19, 2018 7:34 pm

Doesn't that mean you'd be better posting your question on that github page?
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 6 guests