]> git.vomp.tv Git - vompclient-marten.git/blob - remotelinux.cc
Fix symbol and font gradients
[vompclient-marten.git] / remotelinux.cc
1 /*
2     Copyright 2004-2005 Chris Tallon; 2012 Marten Richter
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #include "remotelinux.h"
22 #include "i18n.h"
23 #include "vdr.h"
24 #include "woptionpane.h"
25
26 #include <linux/input.h>
27 #include <sys/types.h>
28
29
30 #include <errno.h>
31
32 #include <sys/stat.h>
33 #include <fcntl.h>
34
35 #include <cstdio>
36 #include <iostream>
37 #include <ostream>
38
39 #include <bcm_host.h>
40
41 using namespace std;
42 using namespace CEC;
43
44 #include <libcec/cecloader.h>
45
46
47
48
49 #define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code)
50
51 #define W_HCW_KC 1 /* key code as defined by kernel for keyboard and remotes through /dev/input */
52 #define W_HCW_CEC 2 /* HDMI_CEC */
53 #define W_HCW_LIRC 3 /* remote control LIRC*/
54
55
56 RemoteLinux::RemoteLinux()
57 {
58   initted = 0;
59   curcec=0;
60   hascurcec=false;
61   signal=false;
62   cec_adap=NULL;
63   num_loop=0;
64   cechandlesvolume=false;
65
66 }
67
68 RemoteLinux::~RemoteLinux()
69 {
70         for (unsigned int i=0; i<devices.size();i++) {
71                 close(devices[i]);
72         }
73 }
74
75 #define test_bit(input,b)  ((1 << ((b) % 8))&(input)[b / 8] )
76
77
78 int RemoteLinux::init(char* devName)
79 {
80   if (initted) return 0;
81   initted = 1;
82
83   InitKeymap();
84
85   for (int eventid=0;eventid<100;eventid++){
86           char buffer[1024];
87           sprintf(buffer,"/dev/input/event%d",eventid);
88
89
90           struct stat test_buf;
91           if (stat(buffer,&test_buf)==0) {
92                   Log::getInstance()->log("Remote", Log::NOTICE, "Probe /dev/input/event%d",eventid);
93                   // file exists
94                   unsigned long ev_type=0;
95                   int new_fd=open(buffer,O_RDONLY);
96                   if (new_fd<0) {
97                           Log::getInstance()->log("Remote", Log::NOTICE, "Can not open /dev/input/event%d",eventid);
98                           continue;
99                   }
100                   if (ioctl(new_fd, EVIOCGBIT(0, EV_MAX), &ev_type) < 0) {
101                           Log::getInstance()->log("Remote", Log::NOTICE, "Ioctl failed /dev/input/event%d %d",eventid,errno);
102                       close(new_fd);
103                   }
104                   //Now test if it generates keyboard presses
105                   if (test_bit((char*)&ev_type , EV_KEY)) {
106                           Log::getInstance()->log("Remote", Log::NOTICE, "Add /dev/input/event%d to List",eventid);
107                           devices.push_back(new_fd);
108                   } else {
109                           close(new_fd);
110                   }
111
112
113
114
115           }
116
117
118
119
120
121   }
122   return initCec();
123 }
124
125 int RemoteLinux::initCec() {
126
127   // bcm_host_init(); //may be move to custom hardware init?
128 // now init cec
129         Log::getInstance()->log("Remote", Log::NOTICE, "Init LibCEC");
130         cec_config.Clear();
131         cec_callbacks.Clear();
132         cec_callbacks.CBCecLogMessage = cecLogMessage;
133         cec_callbacks.CBCecKeyPress = cecKeyPress;
134         cec_callbacks.CBCecCommand = cecCommand;
135         cec_callbacks.CBCecConfigurationChanged = cecConfigurationChanged;
136         cec_config.clientVersion=LIBCEC_VERSION_CURRENT;
137         cec_config.bActivateSource=1;
138         cec_config.bUseTVMenuLanguage=1;
139         //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
140         cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
141         //cec_config.deviceTypes.Add(CEC_DEVICE_TYPE_TUNER);
142
143         strncpy(cec_config.strDeviceName,"vomp",sizeof(cec_config.strDeviceName));
144
145
146         cec_config.callbackParam = NULL; // I do not care
147         cec_config.callbacks = &cec_callbacks;
148
149         cec_adap = LibCecInitialise(&cec_config);
150         if (!cec_adap) {
151                 Log::getInstance()->log("Remote", Log::ERR, "Init LibCEC failed");
152                 return 1;
153         }
154         cec_adap->InitVideoStandalone();
155
156
157         cec_adapter  cec_devices[10];
158         int adap_num=cec_adap->FindAdapters(cec_devices,10,NULL);
159         if (adap_num<0) {
160                 Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed to find adapter");
161                 return 1;
162
163         }
164         if (adap_num==0) {
165                 Log::getInstance()->log("Remote", Log::NOTICE, "CEC: No adapter found");
166                 return 1;
167
168         }
169         if (!cec_adap->Open(cec_devices[0].comm)) {
170                 Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed to open adapter");
171                 return 1;
172         }
173
174         if (!cec_adap->SetActiveSource(cec_config.deviceTypes[0])) {
175                 Log::getInstance()->log("Remote", Log::ERR, "CEC:Failed set active source");
176                 return 1;
177         }
178
179
180
181
182   return 1;
183 }
184
185 int RemoteLinux::shutdown()
186 {
187   if (!initted) return 0;
188   deinitCec();
189   while (devices.size()) {
190           int cur_fd = devices.back();
191           devices.pop_back();
192           close(cur_fd);
193   }
194
195   initted = 0;
196   return 1;
197 }
198
199 void RemoteLinux::deinitCec()
200 {
201         if (cec_adap) {
202                 Log::getInstance()->log("Remote", Log::NOTICE, "Shutdown libcec begin");
203                 cec_adap->SetInactiveView();
204                 cec_adap->Close();
205                 vc_cec_register_callback(NULL, NULL);//deactivate callback!
206                 UnloadLibCec(cec_adap);
207                 cec_adap = NULL;
208                 Log::getInstance()->log("Remote", Log::NOTICE, "Shutdown libcec end");
209         }
210
211 }
212
213 UCHAR RemoteLinux::getButtonPress(int waitType) {
214         /* how = 0 - block
215          how = 1 - start new wait
216          how = 2 - continue wait
217          how = 3 - no wait
218          */
219
220          //in units of 40 ms
221
222         int retval;
223         fd_set readfds;
224         struct timeval tv;
225
226         tv.tv_sec = 0;
227         tv.tv_usec = 40000;
228         if (waitType == 0) {
229                 num_loop = -1;
230         } else if (waitType == 1) {
231
232                 num_loop = 25;
233         } else if (waitType == 2) {
234                 if (num_loop<=0) num_loop = 25;
235         } else if (waitType == 3) {
236                 tv.tv_sec = 0;
237                 tv.tv_usec = 0;
238                 num_loop = 0;
239         }
240
241
242         int ret = 0;
243         while (num_loop!=0) {
244                 ret = NA_UNKNOWN;
245                 FD_ZERO(&readfds);
246
247                 int maxfd = 0;
248                 for (int i = 0; i < devices.size(); i++) {
249                         int cur_fd = devices[i];
250                         maxfd = max(cur_fd, maxfd);
251                         FD_SET(cur_fd, &readfds);
252                 }
253
254                 retval = select(maxfd + 1, &readfds, NULL, NULL, &tv);
255                 tv.tv_sec = 0;
256                 tv.tv_usec = 40000;
257                 // 0 = nothing happened
258                 // 1 = data arrived (actually num of descriptors that changed)
259                 // other value = signal or error
260                 if (retval == 0) {
261                         if (hascurcec) {
262                                 hascurcec = false;
263                                 return (UCHAR) TranslateHWC(W_G_HCW(W_HCW_CEC,curcec));
264                         }
265                         ret = NA_NONE;
266                 } else {
267                         if (retval == -1) {
268                                 Log::getInstance()->log("Remote", Log::NOTICE, "na_signal");
269                                 return NA_SIGNAL;
270
271                         }
272                         for (int i = 0; i < devices.size(); i++) {
273                                 int cur_fd = devices[i];
274                                 if (FD_ISSET(cur_fd, &readfds)) {
275                                         struct input_event ev;
276                                         int count = read(cur_fd, &ev, sizeof(ev));
277                                         if (count == sizeof(ev)) {
278                                                 if (ev.type == EV_KEY && ev.value == 1) {
279                                                         UCHAR retty=(UCHAR) TranslateHWC(
280                                                                                         W_G_HCW(W_HCW_KC,ev.code));
281                                                         return retty;
282                                                 }
283                                         }
284
285                                 }
286
287                         }
288
289                 }
290                 //Log::getInstance()->log("Remote", Log::NOTICE, "numloop: %d %d",num_loop,retval);
291                 if (num_loop > 0)
292                 num_loop--;
293         }
294         if (ret != 0)
295                 return ret;
296
297         return NA_UNKNOWN;
298
299 }
300
301 void RemoteLinux::clearBuffer()
302 {
303         UCHAR buttonpress=getButtonPress(3);
304           while(buttonpress != NA_NONE && buttonpress!=NA_UNKNOWN){
305                   buttonpress=getButtonPress(3);
306           };
307 }
308
309 UCHAR RemoteLinux::TranslateHWCFixed(ULLONG code)
310 {
311     switch (code) 
312     {
313     case W_G_HCW(W_HCW_KC,KEY_DOWN):
314         return DOWN;
315     case W_G_HCW(W_HCW_KC,KEY_UP):
316         return UP;
317     case W_G_HCW(W_HCW_KC,KEY_LEFT):
318         return LEFT;
319     case W_G_HCW(W_HCW_KC,KEY_RIGHT):
320         return RIGHT;
321     case W_G_HCW(W_HCW_KC,KEY_M):
322         return MENU;
323     case W_G_HCW(W_HCW_KC,KEY_BACKSPACE):
324         return BACK;
325     case W_G_HCW(W_HCW_KC,KEY_ENTER):
326     case W_G_HCW(W_HCW_KC,KEY_SPACE):
327     case W_G_HCW(W_HCW_KC,KEY_OK):
328         return OK;
329     //CEC
330     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_DOWN):
331         return DOWN;
332     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_UP):
333         return UP;
334     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_LEFT):
335         return LEFT;
336     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_RIGHT):
337         return RIGHT;
338     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_ROOT_MENU):
339     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CONTENTS_MENU):
340     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_SETUP_MENU):
341         return MENU;
342     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_EXIT ):
343         return BACK;
344     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_ENTER):
345     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_SELECT):
346     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_AN_RETURN):
347         return OK;
348     case W_G_HCW(W_HCW_KC,KEY_POWER):
349     case W_G_HCW(W_HCW_KC,KEY_ESC):
350     case W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_POWER):
351     case POWER:
352         return POWER;
353     default:
354         return NA_UNKNOWN;
355     };
356 }
357
358 const char*RemoteLinux::HardcodedTranslateStr(UCHAR command)
359 {
360     switch (command) 
361     {
362     case DOWN:
363         return tr("Down");
364     case UP:
365         return tr("Up");
366     case LEFT:
367         return tr("Left");
368     case RIGHT:
369         return tr("Right");
370     case MENU:
371         return tr("M");
372     case BACK:
373         return tr("Backspace, Back");
374     case OK:
375         return tr("Return, Space");
376     default:
377         return NULL;
378     };
379     
380 }
381
382
383 void RemoteLinux::InitHWCListwithDefaults()
384 {
385     //Processing VK_Messages
386     translist[W_G_HCW(W_HCW_KC,KEY_9)] = NINE;
387     translist[W_G_HCW(W_HCW_KC,KEY_8)] = EIGHT;
388     translist[W_G_HCW(W_HCW_KC,KEY_7)] = SEVEN;
389     translist[W_G_HCW(W_HCW_KC,KEY_6)] = SIX;
390     translist[W_G_HCW(W_HCW_KC,KEY_5)] = FIVE;
391     translist[W_G_HCW(W_HCW_KC,KEY_4)] = FOUR;
392     translist[W_G_HCW(W_HCW_KC,KEY_3)] = THREE;
393     translist[W_G_HCW(W_HCW_KC,KEY_2)] = TWO;
394     translist[W_G_HCW(W_HCW_KC,KEY_1)] = ONE;
395     translist[W_G_HCW(W_HCW_KC,KEY_0)] = ZERO;
396     translist[W_G_HCW(W_HCW_KC,KEY_KPDOT)] = STAR;
397    // translist[W_G_HCW(W_HCW_KC,KEY_#)] = HASH;
398
399     translist[W_G_HCW(W_HCW_KC,KEY_KP9)] = NINE;
400     translist[W_G_HCW(W_HCW_KC,KEY_KP8)] = EIGHT;
401     translist[W_G_HCW(W_HCW_KC,KEY_KP7)] = SEVEN;
402     translist[W_G_HCW(W_HCW_KC,KEY_KP6)] = SIX;
403     translist[W_G_HCW(W_HCW_KC,KEY_KP5)] = FIVE;
404     translist[W_G_HCW(W_HCW_KC,KEY_KP4)] = FOUR;
405     translist[W_G_HCW(W_HCW_KC,KEY_KP3)] = THREE;
406     translist[W_G_HCW(W_HCW_KC,KEY_KP2)] = TWO;
407     translist[W_G_HCW(W_HCW_KC,KEY_KP1)] = ONE;
408     translist[W_G_HCW(W_HCW_KC,KEY_KP0)] = ZERO;
409
410     translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_9)] = NINE;
411         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_8)] = EIGHT;
412         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_7)] = SEVEN;
413         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_6)] = SIX;
414         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_5)] = FIVE;
415         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_4)] = FOUR;
416         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_3)] = THREE;
417         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_2)] = TWO;
418         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_1)] = ONE;
419         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_0)] = ZERO;
420         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_STAR)] = STAR;
421         translist[W_G_HCW(W_HCW_KC,KEY_NUMERIC_POUND)] = HASH;
422
423
424     translist[W_G_HCW(W_HCW_KC,KEY_J)] = GO; //j for JUMP TO instead of go to
425     translist[W_G_HCW(W_HCW_KC,KEY_R)] = RED;
426     translist[W_G_HCW(W_HCW_KC,KEY_G)] = GREEN;
427     translist[W_G_HCW(W_HCW_KC,KEY_Y)] = YELLOW;
428     translist[W_G_HCW(W_HCW_KC,KEY_B)] = BLUE;
429     //Processing Remote Style Messages
430     translist[W_G_HCW(W_HCW_KC,KEY_GREEN)] = GREEN;
431     translist[W_G_HCW(W_HCW_KC,KEY_RED)] = RED;
432     translist[W_G_HCW(W_HCW_KC,KEY_YELLOW)] = YELLOW;
433     translist[W_G_HCW(W_HCW_KC,KEY_BLUE)] = BLUE;
434     translist[W_G_HCW(W_HCW_KC,KEY_MENU)] = MENU;
435
436     translist[W_G_HCW(W_HCW_KC,KEY_RECORD)] = RECORD;
437     translist[W_G_HCW(W_HCW_KC,KEY_PLAY)] = PLAY; //Playback Televison
438     translist[W_G_HCW(W_HCW_KC,KEY_PAUSE)] = PAUSE;
439     translist[W_G_HCW(W_HCW_KC,KEY_STOP)] = STOP;
440     translist[W_G_HCW(W_HCW_KC,KEY_PLAYPAUSE)] = PLAYPAUSE;
441     translist[W_G_HCW(W_HCW_KC,KEY_P)] = PLAYPAUSE;
442     translist[W_G_HCW(W_HCW_KC,KEY_NEXT)] = SKIPFORWARD;
443     translist[W_G_HCW(W_HCW_KC,KEY_F2)] = SKIPFORWARD;
444     translist[W_G_HCW(W_HCW_KC,KEY_PREVIOUS)] = SKIPBACK;
445     translist[W_G_HCW(W_HCW_KC,KEY_F1)] = SKIPBACK;
446     translist[W_G_HCW(W_HCW_KC,KEY_FORWARD)] = FORWARD;
447     translist[W_G_HCW(W_HCW_KC,KEY_F)] = FORWARD;
448     translist[W_G_HCW(W_HCW_KC,KEY_BACK)] = REVERSE;
449     translist[W_G_HCW(W_HCW_KC,KEY_T)] = REVERSE;
450     translist[W_G_HCW(W_HCW_KC,KEY_MUTE)] = MUTE;
451     translist[W_G_HCW(W_HCW_KC,KEY_F8)] = MUTE;
452     translist[W_G_HCW(W_HCW_KC,KEY_F10)] = VOLUMEUP;
453     translist[W_G_HCW(W_HCW_KC,KEY_F9)] = VOLUMEDOWN;
454     translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEUP)] = VOLUMEUP;
455     translist[W_G_HCW(W_HCW_KC,KEY_VOLUMEDOWN)] = VOLUMEDOWN;
456     translist[W_G_HCW(W_HCW_KC,KEY_CHANNELUP)] = CHANNELUP;
457     translist[W_G_HCW(W_HCW_KC,KEY_CHANNELDOWN)] = CHANNELDOWN;
458     translist[W_G_HCW(W_HCW_KC,KEY_PAGEUP)] = CHANNELUP;
459     translist[W_G_HCW(W_HCW_KC,KEY_PAGEDOWN)] = CHANNELDOWN;
460
461
462     //Processing CEC_Messages
463     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER9)] = NINE;
464     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER8)] = EIGHT;
465     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER7)] = SEVEN;
466     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER6)] = SIX;
467     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER5)] = FIVE;
468     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER4)] = FOUR;
469     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER3)] = THREE;
470     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER2)] = TWO;
471     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER1)] = ONE;
472     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_NUMBER0)] = ZERO;
473     //translist[W_G_HCW(W_HCW_CEC,KEY_KPDOT)] = STAR;
474
475
476
477     //translist[W_G_HCW(W_HCW_CEC,KEY_J)] = GO; //j for JUMP TO instead of go to
478     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F2_RED)] = RED;
479     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F3_GREEN)] = GREEN;
480     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F4_YELLOW)] = YELLOW;
481     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_F1_BLUE)] = BLUE;
482     //Processing Remote Style Messages
483     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAVORITE_MENU)] = MENU;
484
485     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_RECORD)] = RECORD;
486     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PLAY)] = PLAY; //Playback Televison
487     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE)] = PAUSE;
488     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_STOP)] = STOP;
489     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_PAUSE_PLAY_FUNCTION)] = PLAYPAUSE;
490     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FORWARD)] = SKIPFORWARD;
491     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_BACKWARD)] = SKIPBACK;
492     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_FAST_FORWARD )] = FORWARD;
493     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_REWIND)] = REVERSE;
494     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_MUTE)] = MUTE;
495     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_UP)] = VOLUMEUP;
496     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_VOLUME_DOWN)] = VOLUMEDOWN;
497     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_UP )] = CHANNELUP;
498     translist[W_G_HCW(W_HCW_CEC,CEC_USER_CONTROL_CODE_CHANNEL_DOWN)] = CHANNELDOWN;
499
500 }
501
502 #define NAMETRICK(pre, code) linux_keymap[pre ## code]=  #code
503 #define NAMETRICK2(pre, code) cec_keymap[pre ## code]=  #code
504 //extracte from linux/input.h
505
506 static const char * linux_keymap[KEY_MAX+1];
507 static const char * cec_keymap[CEC_USER_CONTROL_CODE_MAX+1];
508
509 void RemoteLinux::InitKeymap()
510 {
511         for (int i=0;i<KEY_MAX+1;i++) {
512                 linux_keymap[i]=NULL;
513         }
514         NAMETRICK(KEY_,RESERVED);
515         NAMETRICK(KEY_,ESC);
516         NAMETRICK(KEY_,1);
517         NAMETRICK(KEY_,2);
518         NAMETRICK(KEY_,3);
519         NAMETRICK(KEY_,4);
520         NAMETRICK(KEY_,5);
521         NAMETRICK(KEY_,6);
522         NAMETRICK(KEY_,7);
523         NAMETRICK(KEY_,8);
524         NAMETRICK(KEY_,9);
525         NAMETRICK(KEY_,0);
526         NAMETRICK(KEY_,MINUS);
527         NAMETRICK(KEY_,EQUAL);
528         NAMETRICK(KEY_,BACKSPACE);
529         NAMETRICK(KEY_,TAB);
530         NAMETRICK(KEY_,Q);
531         NAMETRICK(KEY_,W);
532         NAMETRICK(KEY_,E);
533         NAMETRICK(KEY_,R);
534         NAMETRICK(KEY_,T);
535         NAMETRICK(KEY_,Y);
536         NAMETRICK(KEY_,U);
537         NAMETRICK(KEY_,I);
538         NAMETRICK(KEY_,O);
539         NAMETRICK(KEY_,P);
540         NAMETRICK(KEY_,LEFTBRACE);
541         NAMETRICK(KEY_,RIGHTBRACE);
542         NAMETRICK(KEY_,ENTER);
543         NAMETRICK(KEY_,LEFTCTRL);
544         NAMETRICK(KEY_,A);
545         NAMETRICK(KEY_,S);
546         NAMETRICK(KEY_,D);
547         NAMETRICK(KEY_,F);
548         NAMETRICK(KEY_,G);
549         NAMETRICK(KEY_,H);
550         NAMETRICK(KEY_,J);
551         NAMETRICK(KEY_,K);
552         NAMETRICK(KEY_,L);
553         NAMETRICK(KEY_,SEMICOLON);
554         NAMETRICK(KEY_,APOSTROPHE);
555         NAMETRICK(KEY_,GRAVE);
556         NAMETRICK(KEY_,LEFTSHIFT);
557         NAMETRICK(KEY_,BACKSLASH);
558         NAMETRICK(KEY_,Z);
559         NAMETRICK(KEY_,X);
560         NAMETRICK(KEY_,C);
561         NAMETRICK(KEY_,V);
562         NAMETRICK(KEY_,B);
563         NAMETRICK(KEY_,N);
564         NAMETRICK(KEY_,M);
565         NAMETRICK(KEY_,COMMA);
566         NAMETRICK(KEY_,DOT);
567         NAMETRICK(KEY_,SLASH);
568         NAMETRICK(KEY_,RIGHTSHIFT);
569         NAMETRICK(KEY_,KPASTERISK);
570         NAMETRICK(KEY_,LEFTALT);
571         NAMETRICK(KEY_,SPACE);
572         NAMETRICK(KEY_,CAPSLOCK);
573         NAMETRICK(KEY_,F1);
574         NAMETRICK(KEY_,F2);
575         NAMETRICK(KEY_,F3);
576         NAMETRICK(KEY_,F4);
577         NAMETRICK(KEY_,F5);
578         NAMETRICK(KEY_,F6);
579         NAMETRICK(KEY_,F7);
580         NAMETRICK(KEY_,F8);
581         NAMETRICK(KEY_,F9);
582         NAMETRICK(KEY_,F10);
583         NAMETRICK(KEY_,NUMLOCK);
584         NAMETRICK(KEY_,SCROLLLOCK);
585         NAMETRICK(KEY_,KP7);
586         NAMETRICK(KEY_,KP8);
587         NAMETRICK(KEY_,KP9);
588         NAMETRICK(KEY_,KPMINUS);
589         NAMETRICK(KEY_,KP4);
590         NAMETRICK(KEY_,KP5);
591         NAMETRICK(KEY_,KP6);
592         NAMETRICK(KEY_,KPPLUS);
593         NAMETRICK(KEY_,KP1);
594         NAMETRICK(KEY_,KP2);
595         NAMETRICK(KEY_,KP3);
596         NAMETRICK(KEY_,KP0);
597         NAMETRICK(KEY_,KPDOT);
598         NAMETRICK(KEY_,F11);
599         NAMETRICK(KEY_,F12);
600         NAMETRICK(KEY_,KPENTER);
601         NAMETRICK(KEY_,RIGHTCTRL);
602         NAMETRICK(KEY_,KPSLASH);
603         NAMETRICK(KEY_,SYSRQ);
604         NAMETRICK(KEY_,RIGHTALT);
605         NAMETRICK(KEY_,LINEFEED);
606         NAMETRICK(KEY_,HOME);
607         NAMETRICK(KEY_,UP);
608         NAMETRICK(KEY_,PAGEUP);
609         NAMETRICK(KEY_,LEFT);
610         NAMETRICK(KEY_,RIGHT);
611         NAMETRICK(KEY_,END);
612         NAMETRICK(KEY_,DOWN);
613         NAMETRICK(KEY_,PAGEDOWN);
614         NAMETRICK(KEY_,INSERT);
615         NAMETRICK(KEY_,DELETE);
616         NAMETRICK(KEY_,MACRO);
617         NAMETRICK(KEY_,MUTE);
618         NAMETRICK(KEY_,VOLUMEDOWN);
619         NAMETRICK(KEY_,VOLUMEUP);
620         NAMETRICK(KEY_,POWER);
621         NAMETRICK(KEY_,KPEQUAL);
622         NAMETRICK(KEY_,KPPLUSMINUS);
623         NAMETRICK(KEY_,PLAY);
624         NAMETRICK(KEY_,PAUSE);
625         NAMETRICK(KEY_,SCALE);
626         NAMETRICK(KEY_,KPCOMMA);
627         NAMETRICK(KEY_,YEN);
628         NAMETRICK(KEY_,LEFTMETA);
629         NAMETRICK(KEY_,RIGHTMETA);
630         NAMETRICK(KEY_,COMPOSE);
631         NAMETRICK(KEY_,STOP);
632         NAMETRICK(KEY_,AGAIN);
633         NAMETRICK(KEY_,PROPS);
634         NAMETRICK(KEY_,UNDO);
635         NAMETRICK(KEY_,FRONT);
636         NAMETRICK(KEY_,COPY);
637         NAMETRICK(KEY_,OPEN);
638         NAMETRICK(KEY_,PASTE);
639         NAMETRICK(KEY_,FIND);
640         NAMETRICK(KEY_,CUT);
641         NAMETRICK(KEY_,HELP);
642         NAMETRICK(KEY_,MENU);
643         NAMETRICK(KEY_,CALC);
644         NAMETRICK(KEY_,SETUP);
645         NAMETRICK(KEY_,SLEEP);
646         NAMETRICK(KEY_,WAKEUP);
647         NAMETRICK(KEY_,FILE);
648         NAMETRICK(KEY_,SENDFILE);
649         NAMETRICK(KEY_,DELETEFILE);
650         NAMETRICK(KEY_,XFER);
651         NAMETRICK(KEY_,PROG1);
652         NAMETRICK(KEY_,PROG2);
653         NAMETRICK(KEY_,WWW);
654         NAMETRICK(KEY_,MSDOS);
655         NAMETRICK(KEY_,COFFEE);
656         NAMETRICK(KEY_,DIRECTION);
657         NAMETRICK(KEY_,CYCLEWINDOWS);
658         NAMETRICK(KEY_,MAIL);
659         NAMETRICK(KEY_,BOOKMARKS);
660         NAMETRICK(KEY_,COMPUTER);
661         NAMETRICK(KEY_,BACK);
662         NAMETRICK(KEY_,FORWARD);
663         NAMETRICK(KEY_,CLOSECD);
664         NAMETRICK(KEY_,EJECTCD);
665         NAMETRICK(KEY_,EJECTCLOSECD);
666         NAMETRICK(KEY_,NEXTSONG);
667         NAMETRICK(KEY_,PLAYPAUSE);
668         NAMETRICK(KEY_,PREVIOUSSONG);
669         NAMETRICK(KEY_,STOPCD);
670         NAMETRICK(KEY_,RECORD);
671         NAMETRICK(KEY_,REWIND);
672         NAMETRICK(KEY_,PHONE);
673         NAMETRICK(KEY_,ISO);
674         NAMETRICK(KEY_,CONFIG);
675         NAMETRICK(KEY_,HOMEPAGE);
676         NAMETRICK(KEY_,REFRESH);
677         NAMETRICK(KEY_,EXIT);
678         NAMETRICK(KEY_,MOVE);
679         NAMETRICK(KEY_,EDIT);
680         NAMETRICK(KEY_,SCROLLUP);
681         NAMETRICK(KEY_,SCROLLDOWN);
682         NAMETRICK(KEY_,KPLEFTPAREN);
683         NAMETRICK(KEY_,KPRIGHTPAREN);
684         NAMETRICK(KEY_,NEW);
685         NAMETRICK(KEY_,REDO);
686         NAMETRICK(KEY_,OK);
687         NAMETRICK(KEY_,SELECT);
688         NAMETRICK(KEY_,GOTO);
689         NAMETRICK(KEY_,CLEAR);
690         NAMETRICK(KEY_,POWER2);
691         NAMETRICK(KEY_,OPTION);
692         NAMETRICK(KEY_,INFO);
693         NAMETRICK(KEY_,TIME);
694         NAMETRICK(KEY_,VENDOR);
695         NAMETRICK(KEY_,ARCHIVE);
696         NAMETRICK(KEY_,PROGRAM);
697         NAMETRICK(KEY_,CHANNEL);
698         NAMETRICK(KEY_,FAVORITES);
699         NAMETRICK(KEY_,EPG);
700         NAMETRICK(KEY_,PVR);
701         NAMETRICK(KEY_,MHP);
702         NAMETRICK(KEY_,LANGUAGE);
703         NAMETRICK(KEY_,TITLE);
704         NAMETRICK(KEY_,SUBTITLE);
705         NAMETRICK(KEY_,ANGLE);
706         NAMETRICK(KEY_,ZOOM);
707         NAMETRICK(KEY_,MODE);
708         NAMETRICK(KEY_,KEYBOARD);
709         NAMETRICK(KEY_,SCREEN);
710         NAMETRICK(KEY_,RED);
711         NAMETRICK(KEY_,GREEN);
712         NAMETRICK(KEY_,YELLOW);
713         NAMETRICK(KEY_,BLUE);
714         NAMETRICK(KEY_,CHANNELUP);
715         NAMETRICK(KEY_,CHANNELDOWN);
716         NAMETRICK(KEY_,FIRST);
717         NAMETRICK(KEY_,LAST);
718         NAMETRICK(KEY_,AB);
719         NAMETRICK(KEY_,NEXT);
720         NAMETRICK(KEY_,RESTART);
721         NAMETRICK(KEY_,SLOW);
722         NAMETRICK(KEY_,SHUFFLE);
723         NAMETRICK(KEY_,BREAK);
724         NAMETRICK(KEY_,PREVIOUS);
725         NAMETRICK(KEY_,DIGITS);
726         NAMETRICK(KEY_,TEEN);
727         NAMETRICK(KEY_,TWEN);
728         NAMETRICK(KEY_,VIDEOPHONE);
729         NAMETRICK(KEY_,GAMES);
730         NAMETRICK(KEY_,ZOOMIN);
731         NAMETRICK(KEY_,ZOOMOUT);
732         NAMETRICK(KEY_,ZOOMRESET);
733         NAMETRICK(KEY_,DOLLAR);
734         NAMETRICK(KEY_,EURO);
735         NAMETRICK(KEY_,FRAMEBACK);
736         NAMETRICK(KEY_,FRAMEFORWARD);
737         NAMETRICK(KEY_,CONTEXT_MENU);
738         NAMETRICK(KEY_,MEDIA_REPEAT);
739         NAMETRICK(KEY_,NUMERIC_0);
740         NAMETRICK(KEY_,NUMERIC_1);
741         NAMETRICK(KEY_,NUMERIC_2);
742         NAMETRICK(KEY_,NUMERIC_3);
743         NAMETRICK(KEY_,NUMERIC_4);
744         NAMETRICK(KEY_,NUMERIC_5);
745         NAMETRICK(KEY_,NUMERIC_6);
746         NAMETRICK(KEY_,NUMERIC_7);
747         NAMETRICK(KEY_,NUMERIC_8);
748         NAMETRICK(KEY_,NUMERIC_9);
749         NAMETRICK(KEY_,NUMERIC_STAR);
750         NAMETRICK(KEY_,NUMERIC_POUND);
751
752         for (int i=0;i<CEC_USER_CONTROL_CODE_MAX+1;i++) {
753                         cec_keymap[i]=NULL;
754         }
755         NAMETRICK2(CEC_USER_CONTROL_CODE_,SELECT);
756         NAMETRICK2(CEC_USER_CONTROL_CODE_,UP);
757         NAMETRICK2(CEC_USER_CONTROL_CODE_,DOWN);
758         NAMETRICK2(CEC_USER_CONTROL_CODE_,LEFT);
759         NAMETRICK2(CEC_USER_CONTROL_CODE_,RIGHT);
760         NAMETRICK2(CEC_USER_CONTROL_CODE_,RIGHT_UP);
761         NAMETRICK2(CEC_USER_CONTROL_CODE_,RIGHT_DOWN);
762         NAMETRICK2(CEC_USER_CONTROL_CODE_,LEFT_UP);
763         NAMETRICK2(CEC_USER_CONTROL_CODE_,LEFT_DOWN);
764         NAMETRICK2(CEC_USER_CONTROL_CODE_,ROOT_MENU);
765         NAMETRICK2(CEC_USER_CONTROL_CODE_,SETUP_MENU);
766         NAMETRICK2(CEC_USER_CONTROL_CODE_,CONTENTS_MENU);
767         NAMETRICK2(CEC_USER_CONTROL_CODE_,FAVORITE_MENU);
768         NAMETRICK2(CEC_USER_CONTROL_CODE_,EXIT);
769         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER0);
770         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER1);
771         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER2);
772         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER3);
773         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER4);
774         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER5);
775         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER6);
776         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER7);
777         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER8);
778         NAMETRICK2(CEC_USER_CONTROL_CODE_,NUMBER9);
779         NAMETRICK2(CEC_USER_CONTROL_CODE_,DOT);
780         NAMETRICK2(CEC_USER_CONTROL_CODE_,ENTER);
781         NAMETRICK2(CEC_USER_CONTROL_CODE_,CLEAR);
782         NAMETRICK2(CEC_USER_CONTROL_CODE_,NEXT_FAVORITE);
783         NAMETRICK2(CEC_USER_CONTROL_CODE_,CHANNEL_UP);
784         NAMETRICK2(CEC_USER_CONTROL_CODE_,CHANNEL_DOWN);
785         NAMETRICK2(CEC_USER_CONTROL_CODE_,PREVIOUS_CHANNEL);
786         NAMETRICK2(CEC_USER_CONTROL_CODE_,SOUND_SELECT);
787         NAMETRICK2(CEC_USER_CONTROL_CODE_,INPUT_SELECT);
788         NAMETRICK2(CEC_USER_CONTROL_CODE_,DISPLAY_INFORMATION);
789         NAMETRICK2(CEC_USER_CONTROL_CODE_,HELP);
790         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAGE_UP);
791         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAGE_DOWN);
792         NAMETRICK2(CEC_USER_CONTROL_CODE_,POWER );
793         NAMETRICK2(CEC_USER_CONTROL_CODE_,VOLUME_UP );
794         NAMETRICK2(CEC_USER_CONTROL_CODE_,VOLUME_DOWN );
795         NAMETRICK2(CEC_USER_CONTROL_CODE_,MUTE );
796         NAMETRICK2(CEC_USER_CONTROL_CODE_,PLAY );
797         NAMETRICK2(CEC_USER_CONTROL_CODE_,STOP );
798         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAUSE );
799         NAMETRICK2(CEC_USER_CONTROL_CODE_,RECORD );
800         NAMETRICK2(CEC_USER_CONTROL_CODE_,REWIND );
801         NAMETRICK2(CEC_USER_CONTROL_CODE_,FAST_FORWARD );
802         NAMETRICK2(CEC_USER_CONTROL_CODE_,EJECT );
803         NAMETRICK2(CEC_USER_CONTROL_CODE_,FORWARD );
804         NAMETRICK2(CEC_USER_CONTROL_CODE_,BACKWARD );
805         NAMETRICK2(CEC_USER_CONTROL_CODE_,STOP_RECORD );
806         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAUSE_RECORD );
807         NAMETRICK2(CEC_USER_CONTROL_CODE_,ANGLE );
808         NAMETRICK2(CEC_USER_CONTROL_CODE_,SUB_PICTURE );
809         NAMETRICK2(CEC_USER_CONTROL_CODE_,VIDEO_ON_DEMAND );
810         NAMETRICK2(CEC_USER_CONTROL_CODE_,ELECTRONIC_PROGRAM_GUIDE );
811         NAMETRICK2(CEC_USER_CONTROL_CODE_,TIMER_PROGRAMMING );
812         NAMETRICK2(CEC_USER_CONTROL_CODE_,INITIAL_CONFIGURATION );
813         NAMETRICK2(CEC_USER_CONTROL_CODE_,PLAY_FUNCTION );
814         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAUSE_PLAY_FUNCTION );
815         NAMETRICK2(CEC_USER_CONTROL_CODE_,RECORD_FUNCTION );
816         NAMETRICK2(CEC_USER_CONTROL_CODE_,PAUSE_RECORD_FUNCTION );
817         NAMETRICK2(CEC_USER_CONTROL_CODE_,STOP_FUNCTION );
818         NAMETRICK2(CEC_USER_CONTROL_CODE_,MUTE_FUNCTION );
819         NAMETRICK2(CEC_USER_CONTROL_CODE_,RESTORE_VOLUME_FUNCTION );
820         NAMETRICK2(CEC_USER_CONTROL_CODE_,TUNE_FUNCTION );
821         NAMETRICK2(CEC_USER_CONTROL_CODE_,SELECT_MEDIA_FUNCTION );
822         NAMETRICK2(CEC_USER_CONTROL_CODE_,SELECT_AV_INPUT_FUNCTION );
823         NAMETRICK2(CEC_USER_CONTROL_CODE_,SELECT_AUDIO_INPUT_FUNCTION );
824         NAMETRICK2(CEC_USER_CONTROL_CODE_,POWER_TOGGLE_FUNCTION );
825         NAMETRICK2(CEC_USER_CONTROL_CODE_,POWER_OFF_FUNCTION );
826         NAMETRICK2(CEC_USER_CONTROL_CODE_,POWER_ON_FUNCTION );
827         NAMETRICK2(CEC_USER_CONTROL_CODE_,F1_BLUE );
828         NAMETRICK2(CEC_USER_CONTROL_CODE_,F2_RED );
829         NAMETRICK2(CEC_USER_CONTROL_CODE_,F3_GREEN );
830         NAMETRICK2(CEC_USER_CONTROL_CODE_,F4_YELLOW );
831         NAMETRICK2(CEC_USER_CONTROL_CODE_,F5 );
832         NAMETRICK2(CEC_USER_CONTROL_CODE_,DATA );
833         NAMETRICK2(CEC_USER_CONTROL_CODE_,AN_RETURN );
834         NAMETRICK2(CEC_USER_CONTROL_CODE_,AN_CHANNELS_LIST );
835         NAMETRICK2(CEC_USER_CONTROL_CODE_,MAX );
836
837 }
838
839
840
841 char* RemoteLinux::HCWDesc(unsigned long long hcw)
842 {
843     //Determine type
844     unsigned int type =  hcw >> 32;
845     char *rt=NULL;
846     switch(type)
847     {
848     case W_HCW_KC:{
849         unsigned int vk=(ULONG)hcw;
850         rt=new char[10];
851         const char *desc=linux_keymap[vk];
852         if (desc) {
853                 strncpy(rt,desc,9);
854         } else {
855                 sprintf(rt,"0x%x",vk);
856         }
857                   }break;
858     case W_HCW_CEC:{
859         unsigned int vk=(ULONG)hcw;
860         rt=new char[10];
861         const char *desc=cec_keymap[vk];
862         if (desc) {
863                 strncpy(rt,desc,9);
864         } else {
865                 sprintf(rt,"0x%x",vk);
866         }
867                   }break;
868   /*
869     case W_HCW_LIRC:{
870         ULONG ri=(ULONG)hcw;
871         rt=new char[10];
872         sprintf(rt,"R: %X",ri);
873                   }break;*/
874
875     };
876     return rt;
877 }
878
879
880 int RemoteLinux::cecLogMessage(void *param, const cec_log_message &message)
881 {
882         Log::getInstance()->log("Remote", Log::DEBUG, "CECLOG: %lld %d %s",message.time , message.level, message.message );
883         return 0;
884 }
885
886 int RemoteLinux::cecKeyPress(void*param, const cec_keypress &key)
887 {
888         //Log::getInstance()->log("Remote", Log::DEBUG, "Incoming cec key %d %d", key.keycode,key.duration);
889         if (key.duration==0) ((RemoteLinux*)Remote::getInstance())->incomingCECkey(key.keycode);
890         return 1;
891 }
892 int RemoteLinux::cecCommand(void *param, const cec_command &command)
893 {
894         //Log::getInstance()->log("Remote", Log::DEBUG, "CECCommand: %d",command.opcode);
895         return 1;
896 }
897
898 int RemoteLinux::cecConfigurationChanged(void *param, const libcec_configuration &config)
899 {
900         //Log::getInstance()->log("Remote", Log::DEBUG, "CECConfig:"/*,config.string()*/);
901         return 1;
902
903 }
904
905 void RemoteLinux::incomingCECkey(int keys)
906 {
907         curcec=keys;
908         hascurcec=true;
909
910 }
911
912 bool RemoteLinux::loadOptionsfromServer(VDR* vdr)
913 {
914
915    // Set remote keys
916   char * name;
917   name = vdr->configLoad("RemoteLinux", "HandleVolume");
918
919   if (name != NULL) {
920                 if (STRCASECMP(name, "Vomp") == 0) {
921                         cechandlesvolume=false;
922                 } else if (STRCASECMP(name, "Cec") == 0) {
923                         cechandlesvolume=true;
924                 }
925         }
926   return Remote::loadOptionsfromServer(vdr);
927 }
928
929 bool RemoteLinux::saveOptionstoServer()
930 {
931         if (cechandlesvolume) VDR::getInstance()->configSave("RemoteLinux", "HandleVolume","Cec");
932         else VDR::getInstance()->configSave("RemoteLinux", "HandleVolume","Vomp");
933
934     return Remote::saveOptionstoServer();
935 }
936
937 bool RemoteLinux::addOptionsToPanes(int panenumber,Options *options,WOptionPane* pane)
938 {
939     if (!Remote::addOptionsToPanes(panenumber,options,pane)) return false;
940
941
942     Option* option;
943     if (panenumber == 2)
944     {
945         static const char* volumeopts[]={"Vomp","Cec"};
946         option = new Option(100,tr("Volume handled by"), "RemoteLinux","HandleVolume",Option::TYPE_TEXT,/*4,2*/2,0,0,volumeopts,NULL,false,this);
947         options->push_back(option);
948         pane->addOptionLine(option);
949     }
950
951     return true;
952 }
953
954 bool RemoteLinux::handleOptionChanges(Option* option)
955 {
956     if (Remote::handleOptionChanges(option))
957                 return true;
958         switch (option->id) {
959         case 100: {
960                 if (STRCASECMP(option->options[option->userSetChoice], "Vomp") == 0) {
961                         cechandlesvolume=false;
962                 }  else if (STRCASECMP(option->options[option->userSetChoice], "Cec")
963                                 == 0) {
964                         cechandlesvolume=true;
965                 }
966                 Log::getInstance()->log("Remote", Log::DEBUG, "Set volume handling to to %s %d",option->options[option->userSetChoice],cechandlesvolume);
967                 return true;
968         }
969         break;
970         };
971         return false;
972
973 }
974
975 void RemoteLinux::volumeUp()
976 {
977         cec_adap->VolumeUp();
978 }
979
980 void RemoteLinux::volumeDown()
981 {
982         cec_adap->VolumeDown();
983 }
984
985 void RemoteLinux::volumeMute()
986 {
987         cec_adap->MuteAudio();
988 }
989