Why XBMC response for Wiimote control in difference active for each machine?
#1
Hi I'm writing simple c# program to send key event to XBMC , I use WiimoteLib from http://www.codeplex.com/WiimoteLib.

some code is here.

Code:
// key pressed event
private void HandleWiiPress(WiimoteState ws){
            // handle signal
            if (ws.ButtonState.A){
                    SendKeys.SendWait("{ENTER}");
            }
            else if (ws.ButtonState.B){
                    SendKeys.SendWait("{ESC}");
            }
            else if (ws.ButtonState.Home){
                    SendKeys.SendWait("{ESC}");
            }
            else if (ws.ButtonState.Right) {
                SendKeys.SendWait("{RIGHT}");
            }
            else if (ws.ButtonState.Left){
                SendKeys.SendWait("{LEFT}");
            }
            else if (ws.ButtonState.Up)
            {
                SendKeys.SendWait("{UP}");
            }
            else if (ws.ButtonState.Down) {
                SendKeys.SendWait("{DOWN}");
            }
            else if (ws.ButtonState.Plus)
            {
                SendKeys.SendWait("=");
            }
            else if (ws.ButtonState.Minus)
            {
                SendKeys.SendWait("-");
            }
}

I use SendWait method to simulate key press to any other application. On my machine it work well, I can use wiimote to control XBMC such as press right button on Wiimote = press right arrow on keyboard.

The problem
When i move this app to another machine XBMC not response for Wiimote in right action. such as I press Wiimote right,left,A button the XBMC response for all button like ESC key (i only map this key with Wiimote B button). I don't understand why XBMC response like that. I think i don't touch any configuration file include keymap.xml or whatever.

My machine is Windows 7,
Other machine include Windows XP SP3 and Windows 7 (have same problem)
I used same version of XBMC for all machine.

Can anyone can explain me what wrong?
Sorry with statement, I'm not english native speaker.
Think you.
Reply
#2
I know some implementations of SendKeys on Windows 7 doesn't work if UAC is enabled, I don't know about the C#.NET version specifically. Here's a quote from Microsoft
Quote:This function fails when it is blocked by User Interface Privilege Isolation (UIPI). Note that neither GetLastError nor the return value will indicate the failure was caused by UIPI blocking.

So this isn't an XBMC issue, it is a privilege/security issue.
Reply
#3
Its much better to use eventserver here, check our svn tools/eventclients/clients/Wiiremote or tools/eventclients/examples for implementation ideas. Ideally you could map it to same keymap as Wiiremote is in Linux which behaves closely as Wii and MCE.

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#4
Thank you for all reply.
I also try SendKeys from python using python win32.

Code:
            import win32com        

            shell = win32com.client.Dispatch("WScript.Shell")
            ...
            if signal == "UP" :
                shell.SendKeys("{UP}")
            elif signal == "DOWN" :
                shell.SendKeys("{DOWN}")
            elif signal == "LEFT" :
                shell.SendKeys("{LEFT}")
            elif signal == "RIGHT" :
                shell.SendKeys("{RIGHT}")
            elif signal == "A":
                shell.SendKeys("{ENTER}")
            elif signal == "B" :
                shell.SendKeys("{ESC}")
            elif signal == "PLUS" :
                shell.SendKeys("{+}")

It work well for all machine, I don't know how difference about technical mechanism for this two implementation.
Reply

Logout Mark Read Team Forum Stats Members Help
Why XBMC response for Wiimote control in difference active for each machine?0