Closed blindlight86 closed 7 years ago
@blindlight86 you can't run sudo hcitool -i <device_no> lecc <mac_str>
and then gattool? I thought hcitool is needed to connect to the bluetooth device?
@leopck yep. After reading Yee Light 2 not responding? #2, i run this:
sudo hciconfig hci0 down
sudo hciconfig hci0 up
sudo hcitool -i hci0 lecc <your_mac_addr>
sudo gatttool -i hci0 -b <your_mac_addr> -I
[LE]> connect
An error shows that device has already connected. And can't disconnect it in the gatttool.
So I run sudo hcitool -i hci0 con
to get connection handle and disconnect it by runing sudo hcitool -i hci0 ledc <handle>
Then I find just sudo gatttool -i hci0 -b <your_mac_addr> -I
can do the trick.
There're other issues I got.
After gatttool connect it should wait at least 2s before sending first command or it'll ignore every command before connection is made.
And disconnect() function is not working properly. Maybe hcitool ledc?
I can't figure out how to get call[...hcitool..] response coz my poor coding skill. (Just get to know python for two days)
THANK YOU for your time and sorry for my english.
@blindlight86 No issue, thanks for helping out with this project! No worries, your english is fine.
After gatttool connect it should wait at least 2s before sending first command or it'll ignore every command before connection is made.
You can create a timer delay in Python by using time.sleep(2)
. This creates a 2 second delay.
And disconnect() function is not working properly. Maybe hcitool ledc?
Maybe try exit
instead of disconnect
. I'll help you make the changes for this.
I can't figure out how to get call[...hcitool..] response coz my poor coding skill. (Just get to know python for two days)
What do you want to call? Just drop the command here I'll help to convert into python for you.
I've commented out the disconnect
command from the disconnect() function. And I've pushed this PR into the yeelightblue2 branch. Please git clone and try this again. If there's any issues, post on issues or create another PR 👍
can't gatttool connect after hcitool lecc