To use my Nokia 5530 as a remote for a computer, I used the wonderful SmartTouch program from kaist 'a, but the server part only works with Windows, and I also wanted to have a Linux version as well. Well, in the presence of source codes (SmartTouch extends under GPL), to make ee for Ubuntu did not seem a challenge.
Firstly, the server had to receive / send data via bluetooth, for which there was an excellent python-bluez module. Well, it is also due to the fact that under it it was not necessary to rewrite the code responsible for bluetooth.
Secondly, the program was supposed to somehow report the appearance / break of communication. The original server hangs in the tray and shows popups, but Canonical instructions ( 1 , 2 , 3 ) do not recommend clogging up the tray with useless icons, so it was decided to use only libnotify messages, especially since there were excellent examples of using python-notify directly in the guidelines. So now the device connection alert looks like: ')
Thirdly, it was necessary to somehow reproduce keyboard and mouse messages, for this the Gnome project has a PythonATSPI module. Using its pyatspi.Registry.generateKeyboardEvent and pyatspi.Registry.generateMouseEvent functions, this turned out to be not at all difficult.
Finally, the client program directly sends key codes that are different from those found in Linux. For the necessary actions, I had to code the code compliance table: with the help of xmodmap -pk I received a list of the necessary codes, and then checked its performance with the help of xev .
Now I have the remote control always at hand, regardless of the OS.
As a bonus, a small and black video work:
You can download it here . Depends on: python-bluez, python-pyatspi, python-notify.