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

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] XBMC and Touchscreen on Linux? (/showthread.php?tid=47263)

Pages: 1 2 3


- succo - 2009-04-28

i couldn't test the patch yet (i'm at work right now), will do it this afternoon and will let you know
Quote: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
i have the same sensation, but will try it the same Smile


- succo - 2009-04-29

mhhh...i did the patches and nothing changed Sad
the touchscreen still doesn't capture the taps, while it moves the cursor just like before

this is what i used as SDLMouse.cpp

i had to change BUTTON_SX to '1' as it was defined as a const in mouse tile and of course wasn't defined at all in SDLMouse.cpp
now i'm going to invert mouseState = SDL_GetMouseState(&x, &y) and event_fired = SDL_PollEvent(&event) just to see if something changes...

could changing the 'if' in a 'while' for state.button[MOUSE_LEFT_BUTTON] = (event.button.button == 1 && event.button.type == SDL_MOUSEBUTTONDOWN) make a difference?

will post later results Smile


- Bruno - 2009-04-29

Ciao Succo
Have you tried to disable the line concerning SDL_GetMouseState? Maybe he's just stealing the events to SDL_PollEvent
I suggest you to add some prints here and there to understand what is going on ... for example try to see if event_fired gets true smtime ...
Maybe, It's always false

succo Wrote:could changing the 'if' in a 'while' for state.button[MOUSE_LEFT_BUTTON] = (event.button.button == 1 && event.button.type == SDL_MOUSEBUTTONDOWN) make a difference?
Are you sure ... I think the program will get stuck!

Maybe ...Confused time has come to .. open the SDL Black Box Nerd







BTW: pastebin is really cool! Wink


- Bruno - 2009-04-29

Another Serie of dumb questions ...
I was looking @ http://www.conan.de/touchscreen/evtouch.html
Have you tried NOT to disable the "mice" ?
even if they say
Quote:Since Xorg 7.2 there is always a default-mouse-pointer which will run simultaneously with evtouch if you do not prevent it from loading. It is extremely important that you add the following to your configuration. Otherwise you will get double click events and all kind of strange things.

Recall to do each test both with touchscreen AND mouse ... at the beginning it should even be ONLY mouse!


- succo - 2009-04-29

disabling the mice is only useful if you DON'T want the mouse pointer to hang around when tapping on the screen, and i don't have it disabled with the dummy pointer... i had it disabled when under amd64 but it made no difference at all
for the first suggestion... i added a printf just after
Code:
if (event_fired)
  {
so i should have a trace whenever event_fired gets true
will let you know after compilation

btw, should event_fired be always false i couldn't click with the mouse too, could i?


- Bruno - 2009-04-29

Quote:btw, should event_fired be always false i couldn't click with the mouse too, could i?

In fact event_fired is false ONLY when you do nothing @ all!
As soon as you touch the keyboard, move or click the Mouse, the event_fired variable should become TRUE


- succo - 2009-04-29

ok, built and done... event_fired is realized many times, i can move the mouse but can't click anywhere, so there must be something wrong with the
Code:
state.button[MOUSE_LEFT_BUTTON] = (event.button.button == 1 && event.button.type == SDL_MOUSEBUTTONDOWN);
    state.button[MOUSE_RIGHT_BUTTON] = (event.button.button == 3 && event.button.type == SDL_MOUSEBUTTONDOWN);
    state.button[MOUSE_MIDDLE_BUTTON] = (event.button.button == 2 && event.button.type == SDL_MOUSEBUTTONDOWN);
    state.button[MOUSE_EXTRA_BUTTON1] = (event.button.button == 4 && event.button.type == SDL_MOUSEBUTTONDOWN);
    state.button[MOUSE_EXTRA_BUTTON2] = (event.button.button == 5 && event.button.type == SDL_MOUSEBUTTONDOWN);
lines, as the state.button[] never changes

just added another printf at the end of that bit of code to see the value of event.button.button, going to build again and see


- succo - 2009-04-29

hmm... no way, i can't seem to have a value for event.button.button, even because everything i do fires up the event_fired so i have way too many lines and all without any trace of the key i tried to press


- Bruno - 2009-04-29

OK ... so as mentioned before let's start slowly open the SDL black box
First:
why not printing event.type value instead of a message about event_fired?

SDL_event.h contains the following values for this variable:

/* Event enumerations */
enum { SDL_NOEVENT = 0, /* Unused (do not remove) */
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
SDL_KEYDOWN, /* Keys pressed */
SDL_KEYUP, /* Keys released */
SDL_MOUSEMOTION, /* Mouse moved */
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
SDL_MOUSEBUTTONUP, /* Mouse button released */
SDL_JOYAXISMOTION, /* Joystick axis motion */
SDL_JOYBALLMOTION, /* Joystick trackball motion */
SDL_JOYHATMOTION, /* Joystick hat position change */
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
SDL_JOYBUTTONUP, /* Joystick button released */
SDL_QUIT, /* User-requested quit */
SDL_SYSWMEVENT, /* System specific event */
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
SDL_VIDEORESIZE, /* User resized video mode */
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
SDL_USEREVENT = 24,
/* This last event is only for bounding internal arrays
It is the number of bits in the event mask datatype -- Uint32
*/
SDL_NUMEVENTS = 32
};

Looking at this file, I discovered another usefull function:

/* Waits indefinitely for the next available event, returning 1, or 0 if there
was an error while waiting for events. If 'event' is not NULL, the next
event is removed from the queue and stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);



- succo - 2009-05-01

finally did it!!!!!

here is what i did
googlin'around i found that with input-event i could see what was going on on an event device, and noticed that NOTHING was registered on /dev/input/eventX (where X was the event device attached to my touchscreen)
that was why it wasn't receiving taps, even if it was receiving mouse locations, don't know why
ok, so what i did was REMOVING evtouch xorg driver and setting the touchscreen to use default evdev, but nothing was registered yet, because the touchscreen fell back to use synaptics xorg driver... so what nextHuh remove xserver-xorg-input-synaptics did it, now i have many events in /dev/input/eventX but whatHuh i lost my calibration Sad
ok, i still have what came out from evtouch calibration, so all i have to do is making some xinput set-int-prop to set the calibration limits and the axis swapping/inverting
and now the touchscreen is working as it is intended to even in jaunty, without any code modifications Smile


C o n g r a t u l a t i o n - Bruno - 2009-05-04

Complimenti Succo
Happy to hear that you solved the problem ... Big Grin

Anyway, I am quite surprised ! Why xbmc was the only tool suffering from this ?

Huh

Ok! good for youSmile


- Gamester17 - 2009-05-04

Patch(es) is welcomed:
http://wiki.xbmc.org/?title=HOW-TO_submit_a_patch
http://wiki.xbmc.org/?title=Development_Notes

...if not for XBMC then please submit patch upstream (to SDL, xorg, etc.)

Wink


- succo - 2009-05-04

again, i did NO code modifications nor in xbmc code nor in anything else, just made myself sure that the touchscreen was taken care of by evdev (in xorg.conf) and that it received correct calibration data on startup, addeing to session
Code:
xinput set-int-prop "touchscreen" "Evdev Axis Calibration" 32 xx xx xx xx
where the xx are the values i had previously received from evtouch calibration tool and which i can see in /etc/evtouch/config
now i can see data with input-event on my device and have correct touchscreen support
as far as i can see there is no evdev calibration tool yet, but it is worked on... btw, the old evtouch MinX and so values in xorg are just ignored when using the evdev driver, that's why i had to run on startup the xinput line
on 'why only xbmc', i really don't know... maybe the other programs read the data from somewhere else than /dev/input/eventx (that's why all was fine in the desktop with evtouch) while xbmc only reads from there, so no event action=no xbmc action while the mouse movement came from somewhere else (/dev/input/mouseX?), that's why the mouse moved but i couldn't click


compleet info - locu - 2009-07-19

can you add a how to for me because it does not seem to work for me


- succo - 2009-07-20

what kind of howto do you need?
as far as i can see evtouch doesn't seem to work with any touchscreen, so, if it receives events on yours (as me) you're lucky Smile
again, even if it works better that evtouch (at least for me) there is no calibration tool, so i had to use the data submitted to evtouch...
anyway, have you got any output from your /dev/input/eventX device with input-event when moving around the screen/tapping on it?