taoso / btk

虚拟蓝牙键盘(BlueTooth Keyboard)
MIT License
273 stars 42 forks source link

Connect (and reconnect) upon keypress #4

Open hh opened 9 years ago

hh commented 9 years ago

From https://github.com/lkundrak/btkbdd/blob/master/btkbdd.pod#options

-t addr

Attempt connecting to given address upon key press, if no connection has been
estabilished yet. This can be used to effectively "hardwire" the keyboard to a
given host.

Once an incoming connection is estabilished and terminated, btkbdd always tries
to restore it upon a key press event.
hh commented 9 years ago

I've been looking at reconnects here:

https://github.com/hh/btk/commit/9595a46f16368a794cebc3beb13c1648996dea53

But I'm not sure how to reach NewConnection https://github.com/lvht/btk/blob/master/btk.py#L104

Seems it only get's called when devices connect to us, not when we connect out.

hh commented 9 years ago

What documentation did you refer to when working on this? It's been difficult to find good bluez docs.

taoso commented 9 years ago

http://www.bluez.org/bluez-5-api-introduction-and-porting-guide/ . Most material on the internet is about bluez 4 api.

And,

http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc

hh commented 8 years ago

I've looked at these, still trying to figure out to do get the keyboard to connect. (I've trusted both directions, but I'm still not sure how to plumb the python code to jump into NewConnection correctly.

micsurin commented 4 years ago

Instead of a command line parameter, this could work so that the the most recent connection is retried. This address could be stored (/var/lib?) so it is remembered between restarts.