XBMC Community Forum
[LINUX] XBMC and Touchscreen on Linux? - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: Linux and Live support (/forumdisplay.php?fid=52)
+---- Thread: [LINUX] XBMC and Touchscreen on Linux? (/showthread.php?tid=47263)

Pages: 1 2 3


[LINUX] XBMC and Touchscreen on Linux? - Bruno - 2009-03-20 22:25

Hy guys,
my touchscreen does not work with xbmc. I tried both ubuntu 8.04 and 8.10 ... but the pointer hang around ...
If I disable the mouse, the cursor change its shape and I can move it properly, but of course no way to interact with the interface

I tried 8.10+intrepid and 8.04+hardy ... no way Frown!

It's the same problem that eretico describes for windows
http://forum.xbmc.org/showthread.php?tid=40094
apparently for windows the problem is solved, but not yet for linuxNo

I use a classic eeti Touchscreen (Driver "egalax") and till now xbmcis the only application I have problems with Sad


- succo - 2009-03-21 11:37

i tried xbmc with a touchscreen a long time ago and noticed just the same behaviour, searched the forum and saw it was depending on how sdl_mouse is intended to work when in full screen mode... as far as i remember, if you run xbmc windowed the touchscreen would work just fine, may you try?


yep - Bruno - 2009-03-21 23:58

Yes, the touchscreen works fine in windowed mode ... but it's ugly!!
I would try to understand where the problem comes from and eventually fix it.

At least I wouldliketoknow if the problem comes from the touchscreen driver, the video drivers or if it's a xbmc issue ...


- succo - 2009-04-23 10:43

ok, i reinstalled linux (64) with my touchscreen case (just wanted to see if vdpau could make 1080p stuff work on my old athlon64 3200+, and it really DOES IT!!!) and noticed that using evtouch xorg drivers, after calibrating, is working quite well as a pointer
now i have another problem... i have no way to click on stuff using the touchscreen... i can put the mouse pointer somewhere with the touchscreen and then click the mouse but just tapping the touchscreen does just nothing but move the pointer
have i got to put stuff in xorg.conf to make it work properly? i left it untouched and worked on /etc/evtouch/config file to put the calibration in and worked on a fdi file to put the rotation for the egalax touchscreen, but can't seem to put the actions in the fdi file, it just seems to skip it
does anyone know how to solve this problem?


- Bruno - 2009-04-24 12:02

Ciao Succo, (ti scrivo in inglese perche magari l'argomento interessa altri)
I suppose that the touchscreen works perfectly with other sw, and that you are able to use click functionalities with the OS.
Wrt to my problem, I ended up modifying and recompiling the code: my problem arises from incompatibility between SDL and my touchscreen

If you are a programmer, I suggest you the following approach:
download SDL library (http://www.libsdl.org/)
Then, download some SDL code for handling mouse events (like http://www.siforge.org/articles/2004/09/13-sdl_mouse_tile.html) and compile it.
Then check if you are able to interact with this application in the proper way ...

I hope not! If your touchscreen doesn't work with this sw and if you notice the same behaviour than in xbmc than ... you will know that it comes from the SDL library (xbmc is built upon this library).

In my case, I was quite lucky: I just changed one line (line 62: SDL_ShowCursor(0); putting 1 instead of 0), recompiled and my touchscreen started working perfectly!

When you will have solved your problem, come back in touch: you will discover that there is no way to simulate the right click(this event allows to go the parent menu) ... sorry I should say, there WAS no way!

I have now implement a finger movement recognition to run those kind of events: now my touchscreen works fine even with skins that have no 'back' buttons

-- unfortunatly aeon and MediaStream are still not compatibles --


- succo - 2009-04-25 14:26

ok, i was sending you a pm (in italian) but this could be interesting for someone else too, so i'm writing here

i built sdl_mouse_tile and it's working quite well, it reads the pointer position and the clicks
this changes drastically under xbmc
the pointer position is correctly read (i can see the pointer move around as i touch the screen) but there is NO way to have a left click action, all i get is the pointer moving following my fingers but with no ability to have a click anywhere, so with no menu interaction (i can select a menu with the finger and press enter on the keyboard but i don't think it's quite good as a behaviour Smile )

on the other side, i patched with your diff with no change but the fact that now i have two pointers on screen, the normal xbmc one and a default linux pointer following the first one Sad
of course no way to go back (i think my impossibility to have a click action is breaking that too)

btw, tried other softwares and of course i can click and move the pointer anywhere with them (namely rythmbox and/ot firefox, to say two)

what's up?


mumble mumble - Bruno - 2009-04-25 15:16

I am quite lost so I will just add dumb suggestions...

* have you observed any difference between full screen and windowed mode ('\' to switch from one to the others both in xbmc and sdl_mouse_tile) ?
* is the mouse enabled in your xbmc settings? are you able to interact with xbmc with a mouse?
* last but not least ... have you tried different skins? Skins like Aeon are noteven compatible with Mouse (I may be wrong .... anyway it is not compatible with my Touchscreen: even simple things like changing menu are not feasible)
* My calibration sw has some extended setting ... ie for the Hold event...

Confused :confused2:


- succo - 2009-04-25 17:22

to answer your questions:
  • no difference at all, same behaviour, mouse moves to the point i touch but no way to interact with the interface
  • yes, it is
  • just installed os and everything tonight, i was on 64bit and would like to test 32 so reinstalled everything, just same behaviour (i'm on PM.HD right now)
  • i'm using default xorg evtouch driver, its calibration tool has nothing like events for hold and so... these options must be in xorg.conf, i tried them when under 64bits but with no effort (have a look at http://www.conan.de/touchscreen/evtouch.html or http://www.conan.de/touchscreen/libtouch.html if you like)
i'm quite stuck too, as i can't use the egalax native driver because of a problem with huw jaunty uses usbtouchscreen so have to use evtouch
again, tried other sdl softwares too (just now i closed sdlball, sdl arkanoid, using the touchscreen) so clicks are registered but somehow NOT in xbmc


- Bruno - 2009-04-26 11:21

I am as lost as you ...
only things I am not sure to have understood right is if the mouse works like the touchscreen:
If you are not able to use the mouse either, well the problem is in the mouse driver ... and not in the touchscreen one ... so maybe the problem could be in the xorg.conf file fragment related to the mouse
...

BTW, which diff did you install? The full diff I posted on SVN?! If not, be aware that in the xbmc code there are to fragment of code that try to use Show_cursor
If you installed my diff from SVN, have you tried the new event? move the finger very fast at the bottom of your screen (in fact you can do that anywhere on the screen where there is no control) when ou are not in the root menu ... you should be able in thisway to go come back to parent menu ( the code I SVNed is calibrated on my touchscreen so it may not work with your hw)


- succo - 2009-04-26 12:48

mouse works well in xbmc, and even touchscreen does as far as i use it as a pointer... but it doesn't register clicks so i can select (say) franco battiato from my mp3 artists list but can't click on it to go to the next screen, the one for the album list
i can select, again say, music from the home menu pointing to it with the touchscreen but can't click to go inside, i need to click select on the remote or on the 'real' mouse
what did i install? well, i installed the patch in trac, was it the right one?


- Bruno - 2009-04-26 19:19

yep ... the right one (for me )
I am lost Succo ...
what you could do is to add some traces to xbmc code by adding some printf here and there ... the files concerned should be the same one modified by my diff
Just try to see what happens down there ...

Unfortunately, you are the only one who's able to understand what's going on down there ... there is no way for me to reproduce your scenario ...

Are yo able to do that?


- succo - 2009-04-26 23:50

right now what i'd like to know is what is sent by the touch event
is there a way to listen to /dev/input/event8 (that's where my touchscreen is located) to see what is sent when i tap on it?
of course i have nothing in the logs, even the debug log

the problem must be somewhere near here
Code:
state.button[MOUSE_LEFT_BUTTON] = (mouseState & SDL_BUTTON(1)) == SDL_BUTTON(1);
  state.button[MOUSE_RIGHT_BUTTON] = (mouseState & SDL_BUTTON(3)) == SDL_BUTTON(3);
  state.button[MOUSE_MIDDLE_BUTTON] = (mouseState & SDL_BUTTON(2)) == SDL_BUTTON(2);
  state.button[MOUSE_EXTRA_BUTTON1] = (mouseState & SDL_BUTTON(4)) == SDL_BUTTON(4);
  state.button[MOUSE_EXTRA_BUTTON2] = (mouseState & SDL_BUTTON(5)) == SDL_BUTTON(5);

the mouse_tile (which works) has a completely different definition of clicks
Code:
if( event.button.button == BUTTON_SX && event.button.type == SDL_MOUSEBUTTONDOWN )

btw, i think this problem could be somehow more interesting now, as i think the eeetop is using an evtouch device, so if it's an evtouch problem many eeetop users couldn't use the touchscreen to interact with the gui
on the other side, if it's a problem with my configuration, i'm of course on my own Tongue
i added some printf to Mouse.cpp, namely i did
Code:
if (m_mouseState.button[i])
    {
      if (!m_mouseState.active) // wake up mouse on any click
      {
        m_mouseState.active = true;
        m_lastActiveTime = timeGetTime();
      }
      bNothingDown = false;
      if (m_lastDown[i])
      { // start of hold
        bHold[i] = true;
        printf("%s\n", "tasturiello holdato: ", i);
      }
      else
      {
        if (timeGetTime() - m_lastClickTime[i] < MOUSE_DOUBLE_CLICK_LENGTH)
        { // Double click
          bDoubleClick[i] = true;
          printf("%s\n", "tasturiello doppioclickato: ", i);
        }
        else
        { // Mouse down
        printf("%s\n", "tasturiello pusciato: ", i);
        }
      }
    }
    else
    {
      if (m_lastDown[i])
      { // Mouse up
        bNothingDown = false;
        bClick[i] = true;
        m_lastClickTime[i] = timeGetTime();
        printf("%s\n", "tasturiello sollevato: ", i);
      }
      else
      { // no change
      }
but of course no way... i have an evidence of MOUSE button presses but no evidence of touchscreen taps, like in
Code:
xbmc -fs
The XBMC_HOME environment variable is not set.
tasturiello pusciato:
tasturiello holdato:
tasturiello sollevato:
tasturiello pusciato:
tasturiello sollevato:
btw, i think the existing code works with eeti driver (you're using it, aren't you?), but i can't use it, as it is incompatible with xorg 1.6, which is what comes with jaunty


- Bruno - 2009-04-27 11:15

Ti rispondo stasera ora volevo solo dire :


Big GrinLaughBig GrinBig GrinBig Grin{ // Double click
bDoubleClick[i] = true;
printf("%s\n", "tasturiello doppioclickato: ", i);
}
else
{ // Mouse down
printf("%s\n", "tasturiello pusciato: ", i);
}Rofl


pathcatcha - Bruno - 2009-04-27 21:12

Given that mouse_tile works why not setting up a quick and dirty patch?

In bool CSDLMouse::Update (sile SDLMouse.cpp) modifies the code in the following way:

Add the following local variable
SDL_Event event;
bool event_fired;

then try to add (before or after) SDL_GetRelativeMouseState(&x, &y);
event_fired=SDL_PollEvent(&event);
...
and then instead of
state.button[MOUSE_LEFT_BUTTON] = (mouseState & SDL_BUTTON(1)) == SDL_BUTTON(1);

write the following code
if(event_fired ) {
state.button[MOUSE_LEFT_BUTTON] =(event.button.button == BUTTON_SX && event.button.type == SDL_MOUSEBUTTONDOWN);
}

just modify the following code for the moment ...
It may work ... the only point is that maybe SDL_PollEvent and SDL_GetRelativeMouseState will steal each others some events ... maybe they cannot co-exist
....
Let me know ...
Just not to ruin my programmer reputation: This is quick and dirty ... but may be efficient!


- Bruno - 2009-04-27 21:39

oh yes by the way, I am using an eeti driver