Kodi Community Forum

Full Version: SonyEricsson Bluetooth HID to remote control XBMC?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi

I have xbmc running in a seprate x-screen on my TV. I want to be able to use my computer as normal and use xbmc at the same time. I use wmctrl to run xbmc in fullscreen while I can move the mouse (and keyboard control) to my normal monitor. I would like to use my Sony Ericsson phone as a remote to xbmc, using the HID feature via bluetooth. It works well if the focus is on the xbmc window, but as soon as I move the mouse back to my monitor it's not working. The control moves to the monitor instead. Any ideas how to solve this problem? To have the bluetooth HID to always operate on the TV screen and my normal keyboard and mouse on the monitor. I have tried to run two X-servers, but the nvidia driver isn't capable to do that.
How does this HID device interact with XBMC? Programs like LIRC offer features which allow actions to go explicately to a given application. Is the HID like an additional keyboard?
There is a J2ME eventclient aswell, I made it on a SE phone so it should hopefully work.

The sourcecode for the phone client is on svn and the event client (a program that translates the BT communication to XBMC communication) is available on either apt or svn.
Can you post a compiled version of the J2ME eventclient in this thread?
nika Wrote:Can you post a compiled version of the J2ME eventclient in this thread?

Sorry but no I can't, I don't have the buildtools and don't use a J2ME phone anymore, there is a thread were I have posted compiled versions before, so it might still be there.

If not it's rather "simple", it's an ant script, if else netbeans should compile it for sure.

Cheers,
Tobias.
Ok, now I 've compiled and installed it on the phone. I start the j2me_remote.py script and connects the phone. The phone's screen is black and when I press a button I can see this from the python script:
<button id="68">
<button id="68">
<button id="68">
<button id="82">
<button id="82">
<button id="76">
<button id="76">
...
I can also see that xbmc displays a message that my phone connected.
However I can't control xbmc. Is there something I forgot to do?

Thanks for your help.
nika Wrote:Ok, now I 've compiled and installed it on the phone. I start the j2me_remote.py script and connects the phone. The phone's screen is black and when I press a button I can see this from the python script:
<button id="68">
<button id="68">
<button id="68">
<button id="82">
<button id="82">
<button id="76">
<button id="76">
...
I can also see that xbmc displays a message that my phone connected.
However I can't control xbmc. Is there something I forgot to do?

Thanks for your help.

Nice to see you got it compiled, if you want posting it on a fileshare site here would be very nice Smile

Anyways, onwards to your question.
The remote works as so that it will send those ID's and to get it working you need to do
<joystick name="J2ME">
<button id="x">ACTION</button>
</joystick>
in keymap.xml. And replace line 2 with whatever the python script spits out. It might be even better explained in the readme somewere or wiki.

I made it this way so it should work on most J2ME phones, they miss a standard on most of the buttons.

Cheers,
Tobias.
I have now added:
<joystick name="J2ME">
<button id="85">Up</button>
<button id="68">Down</button>
<button id="76">Left</button>
<button id="82">Right</button>
<button id="53">Select</button>
<button id="250">PreviousMenu</button>
<button id="219">VolumeDown</button>
<button id="48">XBMC.ActivateWindow(Home)</button>
<button id="220">VolumeUp</button>
<button id="49">ContextMenu</button>
<button id="51">XBMC.ActivateWindow(PlayerControls)</button>
</joystick>

to Keymap.xml file in /usr/share/system/ but it is still not working. Nothing happens when I press the buttons. Is there a way to get debug info from the event server? I've activated the debug mode in xbmc, but I can't find the log file.

I will put the compiled j2me app on a file share when I got everything working.
You should do it to the one in ~/.xbmc

Don't forget to read really how the keymap should look like on http://wiki.xbmc.org/?title=Keymap.xml

If it still doesn't work (seeing as you get the output from python and that xbmc pops up a notification it should work) please post a Debug Log from xbmc.

EDIT: The log is in ~/.xbmc/temp/xbmc.log

Cheers,
Tobias
Cant get it to work. This is the Keymap.xml from .xbmc/userdata/
<keymap>
<Global>
<joystick name="J2ME">
<button id="53">Select</button>
<button id="246">ParentDir</button>
<button id="16">FullScreen</button>
<button id="55">Queue</button>
<button id="250">PreviousMenu</button>
<button id="76">Left</button>
<button id="82">Right</button>
<button id="58">Up</button>
<button id="68">Down</button>
<button id="248">XBMC.ActivateWindow(ShutdownMenu)</button>
<button id="35">XBMC.ActivateWindow(PlayerControls)</button>
</joystick>
</Global>
</keymap>

Here is the debug log, tried to find the most relevant parts.
...
17:13:03 T:974620736 M:3385073664 INFO: load language fileConfusedpecial://xbmc/language/English/strings.xml
17:13:03 T:974620736 M:3384459264 INFO: load keymapping
17:13:03 T:974620736 M:3384459264 INFO: Loading special://xbmc/system/Keymap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://profile/Keymap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://xbmc/system/Lircmap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://masterprofile/Lircmap.xml
...
17:13:10 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:14 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:16 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:18 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:18 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
...
nika Wrote:Cant get it to work. This is the Keymap.xml from .xbmc/userdata/
<keymap>
<Global>
<joystick name="J2ME">
<button id="53">Select</button>
<button id="246">ParentDir</button>
<button id="16">FullScreen</button>
<button id="55">Queue</button>
<button id="250">PreviousMenu</button>
<button id="76">Left</button>
<button id="82">Right</button>
<button id="58">Up</button>
<button id="68">Down</button>
<button id="248">XBMC.ActivateWindow(ShutdownMenu)</button>
<button id="35">XBMC.ActivateWindow(PlayerControls)</button>
</joystick>
</Global>
</keymap>

Here is the debug log, tried to find the most relevant parts.
...
17:13:03 T:974620736 M:3385073664 INFO: load language fileConfusedpecial://xbmc/language/English/strings.xml
17:13:03 T:974620736 M:3384459264 INFO: load keymapping
17:13:03 T:974620736 M:3384459264 INFO: Loading special://xbmc/system/Keymap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://profile/Keymap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://xbmc/system/Lircmap.xml
17:13:03 T:974620736 M:3384356864 INFO: Loading special://masterprofile/Lircmap.xml
...
17:13:10 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:14 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:16 T:688048464 M:3357437952 ERROR: ES: Could not map J2ME : 68 to a key
17:13:18 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:18 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
17:13:19 T:688048464 M:3357446144 ERROR: ES: Could not map J2ME : 85 to a key
...

Please don't truncate logs, so next time send full logs to a pastebin site Smile

That error from ES is IIRC if the event is generated (the script and phone communication works along with communication to XBMC) but the keymap is wrong

Not sure if it matters to be honest but try changing from Global to global in Keymap.xml
Changed G to g in global. Didn't work.

Have been doing some more debugging. In the python script (j2me_remote.py I changed send_key(key) to send with map_name="KB" and key="down". XBMC the responeded as it should. In the file xbmcclient.pyyou can read the following:
map_name -- a combination of map_name and button_name refers to a
mapping in the user's Keymap.xml or Lircmap.xml.
map_name can be one of the following:
"KB" => standard keyboard map ( <keyboard> section )
"XG" => xbox gamepad map ( <gamepad> section )
"R1" => xbox remote map ( <remote> section )
"R2" => xbox universal remote map ( <universalremote>
section )
"LI:devicename" => LIRC remote map where 'devicename' is the
actual device's name

I dont't know how the stuff works on the other side, in xbmc, but I can't see an entry in the text above for joystick (with name).
nika Wrote:Changed G to g in global. Didn't work.

Have been doing some more debugging. In the python script (j2me_remote.py I changed send_key(key) to send with map_name="KB" and key="down". XBMC the responeded as it should. In the file xbmcclient.pyyou can read the following:
map_name -- a combination of map_name and button_name refers to a
mapping in the user's Keymap.xml or Lircmap.xml.
map_name can be one of the following:
"KB" => standard keyboard map ( <keyboard> section )
"XG" => xbox gamepad map ( <gamepad> section )
"R1" => xbox remote map ( <remote> section )
"R2" => xbox universal remote map ( <universalremote>
section )
"LI:devicename" => LIRC remote map where 'devicename' is the
actual device's name

I dont't know how the stuff works on the other side, in xbmc, but I can't see an entry in the text above for joystick (with name).

If you don't specify it will do joystick mapping, however something seems to be very wrong here and you seems to be caught in a bug. I think I have an idea why so I'll debug it some more and hopefully have a solution for you tomorrow.

<EDIT> Appears I've missed some changes here, one must prefix Joystick with JSX: for it to work </EDIT>

<EDIT> Went quicker Smile http://pastebin.com/m7676fd4f
Use that instead of the ordinary j2me_remote.py

If that works please report back then I can commit that change.
</EDIT>

Cheers,
Tobias
Ok, this is a step in the right direction. When I press down key in the main menu, the selection enters a loop and goes downwards until the end of the menu where it wraps around. It never stops.

Jar if you have a Sony ericsson phone.
http://rapidshare.com/files/251964294/XB...e.jar.html

Log file: http://pastebin.com/m69c3e977
Try to in send_key alter to queue=0

or whole script incase you want Smile http://pastebin.com/m5bac3ef
Pages: 1 2