1 diff -ruN Enigma2PC/lib/base/condVar.cpp Enigma2PC-old/lib/base/condVar.cpp
2 --- Enigma2PC/lib/base/condVar.cpp 2011-07-24 10:58:27.000000000 +0400
3 +++ Enigma2PC-old/lib/base/condVar.cpp 2011-07-23 09:48:01.000000000 +0400
9 -// --- cTimeMs ---------------------------------------------------------------
11 -cTimeMs::cTimeMs(int Ms)
16 -uint64_t cTimeMs::Now(void)
18 -#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
19 -#define MIN_RESOLUTION 5 // ms
20 - static bool initialized = false;
21 - static bool monotonic = false;
24 - // check if monotonic timer is available and provides enough accurate resolution:
25 - if (clock_getres(CLOCK_MONOTONIC, &tp) == 0) {
26 - long Resolution = tp.tv_nsec;
27 - // require a minimum resolution:
28 - if (tp.tv_sec == 0 && tp.tv_nsec <= MIN_RESOLUTION * 1000000) {
29 - if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
37 - if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
38 - return (uint64_t(tp.tv_sec)) * 1000 + tp.tv_nsec / 1000000;
40 - // fall back to gettimeofday()
43 -# warning Posix monotonic clock not available
46 - if (gettimeofday(&t, NULL) == 0)
47 - return (uint64_t(t.tv_sec)) * 1000 + t.tv_usec / 1000;
51 -void cTimeMs::Set(int Ms)
56 -bool cTimeMs::TimedOut(void)
58 - return Now() >= begin;
61 -uint64_t cTimeMs::Elapsed(void)
63 - return Now() - begin;
66 diff -ruN Enigma2PC/lib/base/condVar.h Enigma2PC-old/lib/base/condVar.h
67 --- Enigma2PC/lib/base/condVar.h 2011-07-24 10:58:27.000000000 +0400
68 +++ Enigma2PC-old/lib/base/condVar.h 2011-07-23 09:48:01.000000000 +0400
70 bool Lock(cMutex *Mutex);
77 - cTimeMs(int Ms = 0);
78 - ///< Creates a timer with ms resolution and an initial timeout of Ms.
79 - static uint64_t Now(void);
80 - void Set(int Ms = 0);
81 - bool TimedOut(void);
82 - uint64_t Elapsed(void);
86 diff -ruN Enigma2PC/lib/driver/Makefile.am Enigma2PC-old/lib/driver/Makefile.am
87 --- Enigma2PC/lib/driver/Makefile.am 2011-07-24 10:58:27.000000000 +0400
88 +++ Enigma2PC-old/lib/driver/Makefile.am 2011-07-23 09:48:01.000000000 +0400
91 libenigma_driver_a_SOURCES += \
98 diff -ruN Enigma2PC/lib/driver/rclirc.cpp Enigma2PC-old/lib/driver/rclirc.cpp
99 --- Enigma2PC/lib/driver/rclirc.cpp 2011-07-24 10:58:27.000000000 +0400
100 +++ Enigma2PC-old/lib/driver/rclirc.cpp 1970-01-01 03:00:00.000000000 +0300
103 - * LIRC support based on LIRC for VDR, which was written by
108 -#include <netinet/in.h>
109 -#include <sys/socket.h>
110 -#include <lib/driver/rclirc.h>
111 -#include <lib/base/init.h>
112 -#include <lib/base/init_num.h>
113 -#include <lib/base/condVar.h>
114 -#include <lib/driver/input_fake.h>
117 -static tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
118 - { KEY_RESERVED, "KEY_RESERVED" },
119 - { KEY_ESC, "KEY_ESC" },
120 - { KEY_1, "KEY_1" },
121 - { KEY_2, "KEY_2" },
122 - { KEY_3, "KEY_3" },
123 - { KEY_4, "KEY_4" },
124 - { KEY_5, "KEY_5" },
125 - { KEY_6, "KEY_6" },
126 - { KEY_7, "KEY_7" },
127 - { KEY_8, "KEY_8" },
128 - { KEY_9, "KEY_9" },
129 - { KEY_0, "KEY_0" },
130 - { KEY_MINUS, "KEY_MINUS" },
131 - { KEY_EQUAL, "KEY_EQUAL" },
132 - { KEY_BACKSPACE, "KEY_BACKSPACE" },
133 - { KEY_TAB, "KEY_TAB" },
134 - { KEY_Q, "KEY_Q" },
135 - { KEY_W, "KEY_W" },
136 - { KEY_E, "KEY_E" },
137 - { KEY_R, "KEY_R" },
138 - { KEY_T, "KEY_T" },
139 - { KEY_Y, "KEY_Y" },
140 - { KEY_U, "KEY_U" },
141 - { KEY_I, "KEY_I" },
142 - { KEY_O, "KEY_O" },
143 - { KEY_P, "KEY_P" },
144 - { KEY_LEFTBRACE, "KEY_LEFTBRACE" },
145 - { KEY_RIGHTBRACE, "KEY_RIGHTBRACE" },
146 - { KEY_ENTER, "KEY_ENTER" },
147 - { KEY_LEFTCTRL, "KEY_LEFTCTRL" },
148 - { KEY_A, "KEY_A" },
149 - { KEY_S, "KEY_S" },
150 - { KEY_D, "KEY_D" },
151 - { KEY_F, "KEY_F" },
152 - { KEY_G, "KEY_G" },
153 - { KEY_H, "KEY_H" },
154 - { KEY_J, "KEY_J" },
155 - { KEY_K, "KEY_K" },
156 - { KEY_L, "KEY_L" },
157 - { KEY_SEMICOLON, "KEY_SEMICOLON" },
158 - { KEY_APOSTROPHE, "KEY_APOSTROPHE" },
159 - { KEY_GRAVE, "KEY_GRAVE" },
160 - { KEY_LEFTSHIFT, "KEY_LEFTSHIFT" },
161 - { KEY_BACKSLASH, "KEY_BACKSLASH" },
162 - { KEY_Z, "KEY_Z" },
163 - { KEY_X, "KEY_X" },
164 - { KEY_C, "KEY_C" },
165 - { KEY_V, "KEY_V" },
166 - { KEY_B, "KEY_B" },
167 - { KEY_N, "KEY_N" },
168 - { KEY_M, "KEY_M" },
169 - { KEY_COMMA, "KEY_COMMA" },
170 - { KEY_DOT, "KEY_DOT" },
171 - { KEY_SLASH, "KEY_SLASH" },
172 - { KEY_RIGHTSHIFT, "KEY_RIGHTSHIFT" },
173 - { KEY_KPASTERISK, "KEY_KPASTERISK" },
174 - { KEY_LEFTALT, "KEY_LEFTALT" },
175 - { KEY_SPACE, "KEY_SPACE" },
176 - { KEY_CAPSLOCK, "KEY_CAPSLOCK" },
177 - { KEY_F1, "KEY_F1" },
178 - { KEY_F2, "KEY_F2" },
179 - { KEY_F3, "KEY_F3" },
180 - { KEY_F4, "KEY_F4" },
181 - { KEY_F5, "KEY_F5" },
182 - { KEY_F6, "KEY_F6" },
183 - { KEY_F7, "KEY_F7" },
184 - { KEY_F8, "KEY_F8" },
185 - { KEY_F9, "KEY_F9" },
186 - { KEY_F10, "KEY_F10" },
187 - { KEY_NUMLOCK, "KEY_NUMLOCK" },
188 - { KEY_SCROLLLOCK, "KEY_SCROLLLOCK" },
189 - { KEY_KP7, "KEY_KP7" },
190 - { KEY_KP8, "KEY_KP8" },
191 - { KEY_KP9, "KEY_KP9" },
192 - { KEY_KPMINUS, "KEY_KPMINUS" },
193 - { KEY_KP4, "KEY_KP4" },
194 - { KEY_KP5, "KEY_KP5" },
195 - { KEY_KP6, "KEY_KP6" },
196 - { KEY_KP1, "KEY_KP1" },
197 - { KEY_KP2, "KEY_KP2" },
198 - { KEY_KP3, "KEY_KP3" },
199 - { KEY_KP0, "KEY_KP0" },
200 - { KEY_KPDOT, "KEY_KPDOT" },
201 - { KEY_ZENKAKUHANKAKU, "KEY_ZENKAKUHANKAKU" },
202 - { KEY_102ND, "KEY_102ND" },
203 - { KEY_F11, "KEY_F11" },
204 - { KEY_F12, "KEY_F12" },
205 - { KEY_RO, "KEY_RO" },
206 - { KEY_KATAKANA, "KEY_KATAKANA" },
207 - { KEY_HIRAGANA, "KEY_HIRAGANA" },
208 - { KEY_HENKAN, "KEY_HENKAN" },
209 - { KEY_KATAKANAHIRAGANA, "KEY_KATAKANAHIRAGANA" },
210 - { KEY_MUHENKAN, "KEY_MUHENKAN" },
211 - { KEY_KPJPCOMMA, "KEY_KPJPCOMMA" },
212 - { KEY_KPENTER, "KEY_KPENTER" },
213 - { KEY_RIGHTCTRL, "KEY_RIGHTCTRL" },
214 - { KEY_KPSLASH, "KEY_KPSLASH" },
215 - { KEY_SYSRQ, "KEY_SYSRQ" },
216 - { KEY_RIGHTALT, "KEY_RIGHTALT" },
217 - { KEY_LINEFEED, "KEY_LINEFEED" },
218 - { KEY_HOME, "KEY_HOME" },
219 - { KEY_UP, "KEY_UP" },
220 - { KEY_PAGEUP, "KEY_PAGEUP" },
221 - { KEY_LEFT, "KEY_LEFT" },
222 - { KEY_RIGHT, "KEY_RIGHT" },
223 - { KEY_END, "KEY_END" },
224 - { KEY_DOWN, "KEY_DOWN" },
225 - { KEY_PAGEDOWN, "KEY_PAGEDOWN" },
226 - { KEY_INSERT, "KEY_INSERT" },
227 - { KEY_DELETE, "KEY_DELETE" },
228 - { KEY_MACRO, "KEY_MACRO" },
229 - { KEY_MUTE, "KEY_MUTE" },
230 - { KEY_VOLUMEDOWN, "KEY_VOLUMEDOWN" },
231 - { KEY_VOLUMEUP, "KEY_VOLUMEUP" },
232 - { KEY_POWER, "KEY_POWER" },
233 - { KEY_KPEQUAL, "KEY_KPEQUAL" },
234 - { KEY_KPPLUSMINUS, "KEY_KPPLUSMINUS" },
235 - { KEY_PAUSE, "KEY_PAUSE" },
236 - { KEY_SCALE, "KEY_SCALE" },
237 - { KEY_KPCOMMA, "KEY_KPCOMMA" },
238 - { KEY_HANGEUL, "KEY_HANGEUL" },
239 - { KEY_HANGUEL, "KEY_HANGUEL" },
240 - { KEY_HANJA, "KEY_HANJA" },
241 - { KEY_YEN, "KEY_YEN" },
242 - { KEY_LEFTMETA, "KEY_LEFTMETA" },
243 - { KEY_RIGHTMETA, "KEY_RIGHTMETA" },
244 - { KEY_COMPOSE, "KEY_COMPOSE" },
245 - { KEY_STOP, "KEY_STOP" },
246 - { KEY_AGAIN, "KEY_AGAIN" },
247 - { KEY_PROPS, "KEY_PROPS" },
248 - { KEY_UNDO, "KEY_UNDO" },
249 - { KEY_FRONT, "KEY_FRONT" },
250 - { KEY_COPY, "KEY_COPY" },
251 - { KEY_OPEN, "KEY_OPEN" },
252 - { KEY_PASTE, "KEY_PASTE" },
253 - { KEY_FIND, "KEY_FIND" },
254 - { KEY_CUT, "KEY_CUT" },
255 - { KEY_HELP, "KEY_HELP" },
256 - { KEY_MENU, "KEY_MENU" },
257 - { KEY_CALC, "KEY_CALC" },
258 - { KEY_SETUP, "KEY_SETUP" },
259 - { KEY_SLEEP, "KEY_SLEEP" },
260 - { KEY_WAKEUP, "KEY_WAKEUP" },
261 - { KEY_FILE, "KEY_FILE" },
262 - { KEY_SENDFILE, "KEY_SENDFILE" },
263 - { KEY_DELETEFILE, "KEY_DELETEFILE" },
264 - { KEY_XFER, "KEY_XFER" },
265 - { KEY_PROG1, "KEY_PROG1" },
266 - { KEY_PROG2, "KEY_PROG2" },
267 - { KEY_WWW, "KEY_WWW" },
268 - { KEY_MSDOS, "KEY_MSDOS" },
269 - { KEY_COFFEE, "KEY_COFFEE" },
270 - { KEY_SCREENLOCK, "KEY_SCREENLOCK" },
271 - { KEY_DIRECTION, "KEY_DIRECTION" },
272 - { KEY_CYCLEWINDOWS, "KEY_CYCLEWINDOWS" },
273 - { KEY_MAIL, "KEY_MAIL" },
274 - { KEY_BOOKMARKS, "KEY_BOOKMARKS" },
275 - { KEY_COMPUTER, "KEY_COMPUTER" },
276 - { KEY_BACK, "KEY_BACK" },
277 - { KEY_FORWARD, "KEY_FORWARD" },
278 - { KEY_CLOSECD, "KEY_CLOSECD" },
279 - { KEY_EJECTCD, "KEY_EJECTCD" },
280 - { KEY_EJECTCLOSECD, "KEY_EJECTCLOSECD" },
281 - { KEY_NEXTSONG, "KEY_NEXTSONG" },
282 - { KEY_PLAYPAUSE, "KEY_PLAYPAUSE" },
283 - { KEY_PREVIOUSSONG, "KEY_PREVIOUSSONG" },
284 - { KEY_STOPCD, "KEY_STOPCD" },
285 - { KEY_RECORD, "KEY_RECORD" },
286 - { KEY_REWIND, "KEY_REWIND" },
287 - { KEY_PHONE, "KEY_PHONE" },
288 - { KEY_ISO, "KEY_ISO" },
289 - { KEY_CONFIG, "KEY_CONFIG" },
290 - { KEY_HOMEPAGE, "KEY_HOMEPAGE" },
291 - { KEY_REFRESH, "KEY_REFRESH" },
292 - { KEY_EXIT, "KEY_EXIT" },
293 - { KEY_MOVE, "KEY_MOVE" },
294 - { KEY_EDIT, "KEY_EDIT" },
295 - { KEY_SCROLLUP, "KEY_SCROLLUP" },
296 - { KEY_SCROLLDOWN, "KEY_SCROLLDOWN" },
297 - { KEY_KPLEFTPAREN, "KEY_KPLEFTPAREN" },
298 - { KEY_KPRIGHTPAREN, "KEY_KPRIGHTPAREN" },
299 - { KEY_NEW, "KEY_NEW" },
300 - { KEY_REDO, "KEY_REDO" },
301 - { KEY_F13, "KEY_F13" },
302 - { KEY_F14, "KEY_F14" },
303 - { KEY_F15, "KEY_F15" },
304 - { KEY_F16, "KEY_F16" },
305 - { KEY_F17, "KEY_F17" },
306 - { KEY_F18, "KEY_F18" },
307 - { KEY_F19, "KEY_F19" },
308 - { KEY_F20, "KEY_F20" },
309 - { KEY_F21, "KEY_F21" },
310 - { KEY_F22, "KEY_F22" },
311 - { KEY_F23, "KEY_F23" },
312 - { KEY_F24, "KEY_F24" },
313 - { KEY_PLAYCD, "KEY_PLAYCD" },
314 - { KEY_PAUSECD, "KEY_PAUSECD" },
315 - { KEY_PROG3, "KEY_PROG3" },
316 - { KEY_PROG4, "KEY_PROG4" },
317 - { KEY_DASHBOARD, "KEY_DASHBOARD" },
318 - { KEY_SUSPEND, "KEY_SUSPEND" },
319 - { KEY_CLOSE, "KEY_CLOSE" },
320 - { KEY_PLAY, "KEY_PLAY" },
321 - { KEY_FASTFORWARD, "KEY_FASTFORWARD" },
322 - { KEY_BASSBOOST, "KEY_BASSBOOST" },
323 - { KEY_PRINT, "KEY_PRINT" },
324 - { KEY_HP, "KEY_HP" },
325 - { KEY_CAMERA, "KEY_CAMERA" },
326 - { KEY_SOUND, "KEY_SOUND" },
327 - { KEY_QUESTION, "KEY_QUESTION" },
328 - { KEY_EMAIL, "KEY_EMAIL" },
329 - { KEY_CHAT, "KEY_CHAT" },
330 - { KEY_SEARCH, "KEY_SEARCH" },
331 - { KEY_CONNECT, "KEY_CONNECT" },
332 - { KEY_FINANCE, "KEY_FINANCE" },
333 - { KEY_SPORT, "KEY_SPORT" },
334 - { KEY_SHOP, "KEY_SHOP" },
335 - { KEY_ALTERASE, "KEY_ALTERASE" },
336 - { KEY_CANCEL, "KEY_CANCEL" },
337 - { KEY_BRIGHTNESSDOWN, "KEY_BRIGHTNESSDOWN" },
338 - { KEY_BRIGHTNESSUP, "KEY_BRIGHTNESSUP" },
339 - { KEY_MEDIA, "KEY_MEDIA" },
340 - { KEY_SWITCHVIDEOMODE, "KEY_SWITCHVIDEOMODE" },
341 - { KEY_KBDILLUMTOGGLE, "KEY_KBDILLUMTOGGLE" },
342 - { KEY_KBDILLUMDOWN, "KEY_KBDILLUMDOWN" },
343 - { KEY_KBDILLUMUP, "KEY_KBDILLUMUP" },
344 - { KEY_SEND, "KEY_SEND" },
345 - { KEY_REPLY, "KEY_REPLY" },
346 - { KEY_FORWARDMAIL, "KEY_FORWARDMAIL" },
347 - { KEY_SAVE, "KEY_SAVE" },
348 - { KEY_DOCUMENTS, "KEY_DOCUMENTS" },
349 - { KEY_BATTERY, "KEY_BATTERY" },
350 - { KEY_BLUETOOTH, "KEY_BLUETOOTH" },
351 - { KEY_WLAN, "KEY_WLAN" },
352 - { KEY_UWB, "KEY_UWB" },
353 - { KEY_UNKNOWN, "KEY_UNKNOWN" },
354 - { KEY_VIDEO_NEXT, "KEY_VIDEO_NEXT" },
355 - { KEY_VIDEO_PREV, "KEY_VIDEO_PREV" },
356 - { KEY_BRIGHTNESS_CYCLE, "KEY_BRIGHTNESS_CYCLE" },
357 - { KEY_BRIGHTNESS_ZERO, "KEY_BRIGHTNESS_ZERO" },
358 - { KEY_DISPLAY_OFF, "KEY_DISPLAY_OFF" },
359 - { KEY_WIMAX, "KEY_WIMAX" },
360 - { KEY_RFKILL, "KEY_RFKILL" },
362 - { KEY_OK, "KEY_OK" },
363 - { KEY_SELECT, "KEY_SELECT" },
364 - { KEY_GOTO, "KEY_GOTO" },
365 - { KEY_CLEAR, "KEY_CLEAR" },
366 - { KEY_POWER2, "KEY_POWER2" },
367 - { KEY_OPTION, "KEY_OPTION" },
368 - { KEY_INFO, "KEY_INFO" },
369 - { KEY_TIME, "KEY_TIME" },
370 - { KEY_VENDOR, "KEY_VENDOR" },
371 - { KEY_ARCHIVE, "KEY_ARCHIVE" },
372 - { KEY_PROGRAM, "KEY_PROGRAM" },
373 - { KEY_CHANNEL, "KEY_CHANNEL" },
374 - { KEY_FAVORITES, "KEY_FAVORITES" },
375 - { KEY_EPG, "KEY_EPG" },
376 - { KEY_PVR, "KEY_PVR" },
377 - { KEY_MHP, "KEY_MHP" },
378 - { KEY_LANGUAGE, "KEY_LANGUAGE" },
379 - { KEY_TITLE, "KEY_TITLE" },
380 - { KEY_SUBTITLE, "KEY_SUBTITLE" },
381 - { KEY_ANGLE, "KEY_ANGLE" },
382 - { KEY_ZOOM, "KEY_ZOOM" },
383 - { KEY_MODE, "KEY_MODE" },
384 - { KEY_KEYBOARD, "KEY_KEYBOARD" },
385 - { KEY_SCREEN, "KEY_SCREEN" },
386 - { KEY_PC, "KEY_PC" },
387 - { KEY_TV, "KEY_TV" },
388 - { KEY_TV2, "KEY_TV2" },
389 - { KEY_VCR, "KEY_VCR" },
390 - { KEY_VCR2, "KEY_VCR2" },
391 - { KEY_SAT, "KEY_SAT" },
392 - { KEY_SAT2, "KEY_SAT2" },
393 - { KEY_CD, "KEY_CD" },
394 - { KEY_TAPE, "KEY_TAPE" },
395 - { KEY_RADIO, "KEY_RADIO" },
396 - { KEY_TUNER, "KEY_TUNER" },
397 - { KEY_PLAYER, "KEY_PLAYER" },
398 - { KEY_TEXT, "KEY_TEXT" },
399 - { KEY_DVD, "KEY_DVD" },
400 - { KEY_AUX, "KEY_AUX" },
401 - { KEY_MP3, "KEY_MP3" },
402 - { KEY_AUDIO, "KEY_AUDIO" },
403 - { KEY_VIDEO, "KEY_VIDEO" },
404 - { KEY_DIRECTORY, "KEY_DIRECTORY" },
405 - { KEY_LIST, "KEY_LIST" },
406 - { KEY_MEMO, "KEY_MEMO" },
407 - { KEY_CALENDAR, "KEY_CALENDAR" },
408 - { KEY_RED, "KEY_RED" },
409 - { KEY_GREEN, "KEY_GREEN" },
410 - { KEY_YELLOW, "KEY_YELLOW" },
411 - { KEY_BLUE, "KEY_BLUE" },
412 - { KEY_CHANNELUP, "KEY_CHANNELUP" },
413 - { KEY_CHANNELDOWN, "KEY_CHANNELDOWN" },
414 - { KEY_FIRST, "KEY_FIRST" },
415 - { KEY_LAST, "KEY_LAST" },
416 - { KEY_AB, "KEY_AB" },
417 - { KEY_PLAY, "KEY_PLAY" },
418 - { KEY_RESTART, "KEY_RESTART" },
419 - { KEY_SLOW, "KEY_SLOW" },
420 - { KEY_SHUFFLE, "KEY_SHUFFLE" },
421 - { KEY_FASTFORWARD, "KEY_FASTFORWARD" },
422 - { KEY_PREVIOUS, "KEY_PREVIOUS" },
423 - { KEY_NEXT, "KEY_NEXT" },
424 - { KEY_DIGITS, "KEY_DIGITS" },
425 - { KEY_TEEN, "KEY_TEEN" },
426 - { KEY_TWEN, "KEY_TWEN" },
427 - { KEY_BREAK, "KEY_BREAK" },
436 -eLircInputDevice::eLircInputDevice(eRCDriver *driver) : eRCDevice("Lirc", driver), m_escape(false), m_unicode(0)
439 -eLircInputDevice::~eLircInputDevice()
442 -void eLircInputDevice::handleCode(long arg)
444 - const lircEvent* event = (const lircEvent*)arg;
447 - if (event->repeat == true) {
448 - flags = eRCKey::flagRepeat;
449 - } else if (event->release == true) {
450 - flags = eRCKey::flagBreak;
452 - flags = eRCKey::flagMake;
455 - code = translateKey(event->name);
457 - eDebug("LIRC name=%s code=%d flags=%d", event->name, code, flags);
458 - input->keyPressed(eRCKey(this, code, flags));
461 -const char *eLircInputDevice::getDescription() const
466 -int eLircInputDevice::translateKey(const char* name)
470 - eDebug("LIRC: translateKey ERROR");
471 - return KEY_RESERVED;
474 - for (int i=0;keyTable[i].name!=NULL;i++)
476 - if (!strcmp(name, keyTable[i].name))
478 - printf("FOUND KEY CODE FOR %s: %04X\n", name, keyTable[i].code);
479 - return keyTable[i].code;
483 - eDebug("LIRC: unhandled key name: %s", name);
484 - return KEY_RESERVED;
491 -#define REPEATDELAY 100 // ms
492 -#define REPEATFREQ 100 // ms
493 -#define REPEATTIMEOUT 500 // ms
494 -#define RECONNECTDELAY 3000 // ms
496 -static bool fileReady(int FileDes, int TimeoutMs)
499 - struct timeval timeout;
501 - FD_SET(FileDes, &set);
502 - if (TimeoutMs >= 0) {
503 - if (TimeoutMs < 100)
505 - timeout.tv_sec = TimeoutMs / 1000;
506 - timeout.tv_usec = (TimeoutMs % 1000) * 1000;
508 - return select(FD_SETSIZE, &set, NULL, NULL, (TimeoutMs >= 0) ? &timeout : NULL) > 0 && FD_ISSET(FileDes, &set);
511 -static ssize_t safe_read(int filedes, void *buffer, size_t size)
514 -printf("AAread1\n");
515 - ssize_t p = read(filedes, buffer, size);
516 -printf("AAread2\n");
517 - if (p < 0 && errno == EINTR) {
524 -void eLircInputDriver::pumpEvent(const lircEvent &event)
529 -eLircInputDriver *eLircInputDriver::instance;
531 -bool eLircInputDriver::Connect(void)
533 - if ((f = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0) {
534 - if (connect(f, (struct sockaddr *)&addr, sizeof(addr)) >= 0)
536 - eDebug("Lirc: Connect to %s error !!!", addr.sun_path);
541 - eDebug("Lirc: Connect to %s error !!!", addr.sun_path);
546 -eLircInputDriver::eLircInputDriver() : eRCDriver(eRCInput::getInstance()), m_pump(eApp, 1)
548 - ASSERT(instance == 0);
551 - CONNECT(m_pump.recv_msg, eLircInputDriver::pumpEvent);
553 - addr.sun_family = AF_UNIX;
554 - strcpy(addr.sun_path, "/dev/lircd");
562 -eLircInputDriver::~eLircInputDriver()
569 - thread_stop = true;
570 - sendSignal(SIGINT);
577 -void eLircInputDriver::thread()
581 - char buf[LIRC_BUFFER_SIZE];
582 - char LastKeyName[LIRC_KEY_BUF] = "";
583 - bool repeat = false;
588 - thread_stop = false;
590 - while (!thread_stop && f>=0) {
591 - bool ready = fileReady(f, timeout);
592 - int ret = ready ? safe_read(f, buf, sizeof(buf)) : -1;
594 - if (ready && ret <= 0 ) {
595 - eDebug("ERROR: lircd connection broken, trying to reconnect every %.1f seconds", float(RECONNECTDELAY) / 1000);
598 - while (!thread_stop && f < 0) {
599 - cCondWait::SleepMs(RECONNECTDELAY);
601 - eDebug("reconnected to lircd");
607 - if (ready && ret > 21) {
609 - char KeyName[LIRC_KEY_BUF];
610 - if (sscanf(buf, "%*x %x %29s", &count, KeyName) != 2) { // '29' in '%29s' is LIRC_KEY_BUF-1!
611 - eDebug("ERROR: unparseable lirc command: %s", buf);
615 - if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < REPEATDELAY)
616 - continue; // skip keys coming in too fast
618 - event.name = LastKeyName;
619 - event.repeat = false;
620 - event.release = true;
621 - m_pump.send(event);
623 - strcpy(LastKeyName, KeyName);
629 - if (LastTime.Elapsed() < REPEATFREQ)
630 - continue; // repeat function kicks in after a short delay (after last key instead of first key)
631 - if (FirstTime.Elapsed() < REPEATDELAY)
632 - continue; // skip keys coming in too fast (for count != 0 as well)
634 - timeout = REPEATDELAY;
637 - event.name = KeyName;
638 - event.repeat = repeat;
639 - event.release = false;
640 - m_pump.send(event);
642 - else if (repeat) { // the last one was a repeat, so let's generate a release
643 - if (LastTime.Elapsed() >= REPEATTIMEOUT) {
644 - event.name = LastKeyName;
645 - event.repeat = false;
646 - event.release = true;
647 - m_pump.send(event);
656 -void eLircInputDriver::keyPressed(const lircEvent &event)
658 - if (!enabled || input->islocked())
661 - std::list<eRCDevice*>::iterator i(listeners.begin());
662 - while (i != listeners.end()) {
663 - (*i)->handleCode((long)&event);
671 - eLircInputDriver driver;
672 - eLircInputDevice device;
675 - eRCLircInit(): driver(), device(&driver)
680 -eAutoInitP0<eRCLircInit> init_rcLirc(eAutoInitNumbers::rc+1, "Lirc RC Driver");
681 diff -ruN Enigma2PC/lib/driver/rclirc.h Enigma2PC-old/lib/driver/rclirc.h
682 --- Enigma2PC/lib/driver/rclirc.h 2011-07-24 10:58:27.000000000 +0400
683 +++ Enigma2PC-old/lib/driver/rclirc.h 1970-01-01 03:00:00.000000000 +0300
685 -#ifndef __lib_driver_rclirc_h
686 -#define __lib_driver_rclirc_h
689 -#include <lib/driver/rc.h>
690 -#include <lib/base/thread.h>
691 -#include <lib/base/message.h>
704 -class eLircInputDevice : public eRCDevice
708 - unsigned int m_unicode;
709 - int translateKey(const char* name);
712 - eLircInputDevice(eRCDriver *driver);
713 - ~eLircInputDevice();
715 - virtual void handleCode(long arg);
716 - virtual const char *getDescription() const;
719 -class eLircInputDriver : public eRCDriver, public eThread
722 - enum { LIRC_KEY_BUF = 30, LIRC_BUFFER_SIZE = 128 };
723 - static eLircInputDriver *instance;
724 - eFixedMessagePump<lircEvent> m_pump;
725 - void pumpEvent(const lircEvent &keyEvent);
727 - struct sockaddr_un addr;
728 - virtual void thread();
730 - bool Connect(void);
733 - eLircInputDriver();
734 - ~eLircInputDriver();
736 - static eLircInputDriver *getInstance() { return instance; }
737 - void keyPressed(const lircEvent &keyEvent);
741 diff -ruN Enigma2PC/lib/gdi/gxlibdc.cpp Enigma2PC-old/lib/gdi/gxlibdc.cpp
742 --- Enigma2PC/lib/gdi/gxlibdc.cpp 2011-07-24 10:58:27.000000000 +0400
743 +++ Enigma2PC-old/lib/gdi/gxlibdc.cpp 2011-07-23 09:48:17.000000000 +0400
745 void gXlibDC::keyEvent(const XKeyEvent &event)
747 eXlibInputDriver *driver = eXlibInputDriver::getInstance();
749 +xineLib->getVideoFrameRate();
750 eDebug("SDL Key %s: key=%d", (event.type == KeyPress) ? "Down" : "Up", event.keycode);