3 # tslib support for ecore, (C) Michael 'Mickey' Lauer <mickey@Vanille.de>
6 --- ecore/src/lib/ecore_fb/ecore_fb.c~add-tslib-support.patch
7 +++ ecore/src/lib/ecore_fb/ecore_fb.c
10 #include "ecore_private.h"
27 +struct tsdev *_ecore_fb_tslib_tsdev = NULL;
28 +struct ts_sample _ecore_fb_tslib_event;
31 static void _ecore_fb_size_get(int *w, int *h);
32 static int _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
33 static int _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
35 ecore_fb_init(const char *name __UNUSED__)
39 + char *tslib_tsdevice = NULL;
42 _ecore_fb_init_count++;
43 if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
45 + if ( ( tslib_tsdevice = getenv("TSLIB_TSDEVICE") ) != NULL )
47 + printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice );
48 + _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */
50 + if ( !_ecore_fb_tslib_tsdev )
52 + printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) );
56 + if ( ts_config( _ecore_fb_tslib_tsdev ) )
58 + printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) );
61 + _ecore_fb_ts_fd = ts_fd( _ecore_fb_tslib_tsdev );
62 + if ( _ecore_fb_ts_fd < 0 )
64 + printf( "ECORE_FB: Can't open touchscreen (%s)\n", strerror( errno ) );
69 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
71 if (_ecore_fb_ts_fd >= 0)
73 prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL);
81 + if ( _ecore_fb_ts_apply_cal )
82 + num = ts_read_raw( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
84 + num = ts_read( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
87 + return 1; /* no more samples at this time */
89 + x = _ecore_fb_tslib_event.x;
90 + y = _ecore_fb_tslib_event.y;
91 + pressure = _ecore_fb_tslib_event.pressure;
92 + v = 1; /* loop, there might be more samples */
94 ptr = (char *)&(_ecore_fb_ts_event);
95 ptr += _ecore_fb_ts_event_byte_count;
96 num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count;
98 y = _ecore_fb_ts_event.y;
100 pressure = _ecore_fb_ts_event.pressure;
102 /* add event to queue */
103 /* always add a move event */
104 if ((pressure) || (prev_pressure))