cec: fix some C header. still not actually tested this
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
CommitLineData
e9de9629
LOK
1/*
2 * This file is part of the libCEC(R) library.
3 *
4 * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
5 * libCEC(R) is an original work, containing original code.
6 *
7 * libCEC(R) is a trademark of Pulse-Eight Limited.
8 *
9 * This program is dual-licensed; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 *
23 *
24 * Alternatively, you can license this library under a commercial license,
25 * please contact Pulse-Eight Licensing for more information.
26 *
27 * For more information contact:
28 * Pulse-Eight Licensing <license@pulse-eight.com>
29 * http://www.pulse-eight.com/
30 * http://www.pulse-eight.net/
31 */
32
33#include "CECCommandHandler.h"
eafa9d46 34#include "../devices/CECBusDevice.h"
a1f8fb1b 35#include "../devices/CECAudioSystem.h"
28089abc 36#include "../devices/CECPlaybackDevice.h"
387b6f6f 37#include "../CECProcessor.h"
e9de9629
LOK
38
39using namespace CEC;
8747dd4f 40using namespace std;
e9de9629
LOK
41
42CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice)
43{
44 m_busDevice = busDevice;
45}
46
47bool CCECCommandHandler::HandleCommand(const cec_command &command)
48{
49 bool bHandled(true);
50
5e822b09 51 CStdString strLog;
62f5527d 52 strLog.Format(">> %s (%X) -> %s (%X): %s (%2X)", ToString(command.initiator), command.initiator, ToString(command.destination), command.destination, ToString(command.opcode), command.opcode);
5e822b09
LOK
53 m_busDevice->AddLog(CEC_LOG_NOTICE, strLog);
54
f8513317 55 if (m_busDevice->MyLogicalAddressContains(command.destination))
e9de9629
LOK
56 {
57 switch(command.opcode)
58 {
e55f3f70
LOK
59 case CEC_OPCODE_REPORT_POWER_STATUS:
60 HandleReportPowerStatus(command);
61 break;
6a1c0009
LOK
62 case CEC_OPCODE_CEC_VERSION:
63 HandleDeviceCecVersion(command);
64 break;
a3269a0a
LOK
65 case CEC_OPCODE_SET_MENU_LANGUAGE:
66 HandleSetMenuLanguage(command);
4d6b4433 67 /* pass to listeners */
a9e03a86 68 m_busDevice->GetProcessor()->AddCommand(command);
a3269a0a 69 break;
e9de9629
LOK
70 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
71 HandleGivePhysicalAddress(command);
72 break;
73 case CEC_OPCODE_GIVE_OSD_NAME:
74 HandleGiveOSDName(command);
75 break;
76 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
77 HandleGiveDeviceVendorId(command);
78 break;
79 case CEC_OPCODE_DEVICE_VENDOR_ID:
80 HandleDeviceVendorId(command);
81 break;
82 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
83 HandleDeviceVendorCommandWithId(command);
84 break;
85 case CEC_OPCODE_GIVE_DECK_STATUS:
86 HandleGiveDeckStatus(command);
87 break;
88 case CEC_OPCODE_MENU_REQUEST:
89 HandleMenuRequest(command);
90 break;
91 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
92 HandleGiveDevicePowerStatus(command);
93 break;
94 case CEC_OPCODE_GET_CEC_VERSION:
95 HandleGetCecVersion(command);
96 break;
97 case CEC_OPCODE_USER_CONTROL_PRESSED:
98 HandleUserControlPressed(command);
99 break;
100 case CEC_OPCODE_USER_CONTROL_RELEASE:
101 HandleUserControlRelease(command);
102 break;
a1f8fb1b
LOK
103 case CEC_OPCODE_GIVE_AUDIO_STATUS:
104 HandleGiveAudioStatus(command);
105 break;
cf0ecd85
LOK
106 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
107 HandleGiveSystemAudioModeStatus(command);
108 break;
e5e86c76
LOK
109 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
110 HandleSetSystemAudioModeRequest(command);
111 break;
e9de9629
LOK
112 default:
113 UnhandledCommand(command);
4d6b4433 114 /* pass to listeners */
a9e03a86 115 m_busDevice->GetProcessor()->AddCommand(command);
e9de9629
LOK
116 bHandled = false;
117 break;
118 }
119 }
120 else if (command.destination == CECDEVICE_BROADCAST)
121 {
122 CStdString strLog;
123 switch (command.opcode)
124 {
a3269a0a
LOK
125 case CEC_OPCODE_SET_MENU_LANGUAGE:
126 HandleSetMenuLanguage(command);
4d6b4433 127 /* pass to listeners */
a9e03a86 128 m_busDevice->GetProcessor()->AddCommand(command);
a3269a0a 129 break;
e9de9629
LOK
130 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
131 HandleRequestActiveSource(command);
132 break;
133 case CEC_OPCODE_SET_STREAM_PATH:
134 HandleSetStreamPath(command);
135 break;
136 case CEC_OPCODE_ROUTING_CHANGE:
137 HandleRoutingChange(command);
138 break;
139 case CEC_OPCODE_DEVICE_VENDOR_ID:
140 HandleDeviceVendorId(command);
141 break;
142 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
143 HandleDeviceVendorCommandWithId(command);
144 break;
4d6b4433
LOK
145 case CEC_OPCODE_STANDBY:
146 HandleStandby(command);
147 /* pass to listeners */
148 m_busDevice->GetProcessor()->AddCommand(command);
149 break;
be5b0e24
LOK
150 case CEC_OPCODE_ACTIVE_SOURCE:
151 HandleActiveSource(command);
152 /* pass to listeners */
153 m_busDevice->GetProcessor()->AddCommand(command);
154 break;
e9de9629
LOK
155 default:
156 UnhandledCommand(command);
4d6b4433 157 /* pass to listeners */
a9e03a86 158 m_busDevice->GetProcessor()->AddCommand(command);
e9de9629
LOK
159 bHandled = false;
160 break;
161 }
162 }
163 else
164 {
165 CStdString strLog;
f8513317 166 strLog.Format("ignoring frame: we're not at destination %x", command.destination);
e9de9629
LOK
167 m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
168 bHandled = false;
169 }
170
171 return bHandled;
172}
173
be5b0e24
LOK
174bool CCECCommandHandler::HandleActiveSource(const cec_command &command)
175{
176 if (command.parameters.size == 2)
177 {
178 uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
179 return m_busDevice->GetProcessor()->SetStreamPath(iAddress);
180 }
181
182 return true;
183}
184
6a1c0009
LOK
185bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command &command)
186{
187 if (command.parameters.size == 1)
188 {
189 CCECBusDevice *device = GetDevice(command.initiator);
190 if (device)
191 device->SetCecVersion((cec_version) command.parameters[0]);
192 }
193
194 return true;
195}
196
e9de9629
LOK
197bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
198{
181b3475 199 SetVendorId(command);
6a1c0009 200 return true;
e9de9629
LOK
201}
202
203bool CCECCommandHandler::HandleDeviceVendorId(const cec_command &command)
204{
181b3475 205 SetVendorId(command);
6a1c0009 206 return true;
e9de9629
LOK
207}
208
209bool CCECCommandHandler::HandleGetCecVersion(const cec_command &command)
210{
f8513317 211 CCECBusDevice *device = GetDevice(command.destination);
0f23c85c 212 if (device)
29912296 213 return device->TransmitCECVersion(command.initiator);
0f23c85c
LOK
214
215 return false;
e9de9629
LOK
216}
217
a1f8fb1b
LOK
218bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command &command)
219{
220 CCECBusDevice *device = GetDevice(command.destination);
221 if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
222 return ((CCECAudioSystem *) device)->TransmitAudioStatus(command.initiator);
223
224 return false;
225}
226
e9de9629
LOK
227bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command &command)
228{
f8513317 229 CCECBusDevice *device = GetDevice(command.destination);
28089abc
LOK
230 if (device && device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE)
231 return ((CCECPlaybackDevice *) device)->TransmitDeckStatus(command.initiator);
0f23c85c
LOK
232
233 return false;
e9de9629
LOK
234}
235
236bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command)
237{
f8513317 238 CCECBusDevice *device = GetDevice(command.destination);
0f23c85c 239 if (device)
29912296 240 return device->TransmitPowerState(command.initiator);
0f23c85c
LOK
241
242 return false;
e9de9629
LOK
243}
244
245bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command &command)
246{
f8513317 247 CCECBusDevice *device = GetDevice(command.destination);
0f23c85c 248 if (device)
29912296 249 return device->TransmitVendorID(command.initiator);
0f23c85c
LOK
250
251 return false;
e9de9629
LOK
252}
253
254bool CCECCommandHandler::HandleGiveOSDName(const cec_command &command)
255{
f8513317 256 CCECBusDevice *device = GetDevice(command.destination);
0f23c85c 257 if (device)
29912296 258 return device->TransmitOSDName(command.initiator);
0f23c85c
LOK
259
260 return false;
e9de9629
LOK
261}
262
263bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
264{
f8513317 265 CCECBusDevice *device = GetDevice(command.destination);
09c10b66 266 if (device)
29912296 267 return device->TransmitPhysicalAddress();
09c10b66
LOK
268
269 return false;
e9de9629
LOK
270}
271
272bool CCECCommandHandler::HandleMenuRequest(const cec_command &command)
273{
274 if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_QUERY)
0f23c85c 275 {
f8513317 276 CCECBusDevice *device = GetDevice(command.destination);
0f23c85c 277 if (device)
29912296 278 return device->TransmitMenuState(command.initiator);
0f23c85c
LOK
279 }
280 return false;
e9de9629
LOK
281}
282
e55f3f70
LOK
283bool CCECCommandHandler::HandleReportPowerStatus(const cec_command &command)
284{
285 if (command.parameters.size == 1)
286 {
287 CCECBusDevice *device = GetDevice(command.initiator);
288 if (device)
289 device->SetPowerStatus((cec_power_status) command.parameters[0]);
290 }
291 return true;
292}
293
e9de9629
LOK
294bool CCECCommandHandler::HandleRequestActiveSource(const cec_command &command)
295{
296 CStdString strLog;
297 strLog.Format(">> %i requests active source", (uint8_t) command.initiator);
298 m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
8747dd4f
LOK
299
300 vector<CCECBusDevice *> devices;
301 for (int iDevicePtr = (int)GetMyDevices(devices)-1; iDevicePtr >=0; iDevicePtr--)
302 devices[iDevicePtr]->TransmitActiveSource();
303 return true;
e9de9629
LOK
304}
305
306bool CCECCommandHandler::HandleRoutingChange(const cec_command &command)
307{
308 if (command.parameters.size == 4)
309 {
310 uint16_t iOldAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
311 uint16_t iNewAddress = ((uint16_t)command.parameters[2] << 8) | ((uint16_t)command.parameters[3]);
e9de9629 312
0f23c85c
LOK
313 CCECBusDevice *device = GetDevice(command.initiator);
314 if (device)
9dc04b07 315 device->SetStreamPath(iNewAddress, iOldAddress);
e9de9629
LOK
316 }
317 return true;
318}
319
a3269a0a
LOK
320bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command &command)
321{
322 if (command.parameters.size == 3)
323 {
324 CCECBusDevice *device = GetDevice(command.initiator);
325 if (device)
326 {
327 cec_menu_language language;
328 language.device = command.initiator;
56701628 329 for (uint8_t iPtr = 0; iPtr < 4; iPtr++)
a3269a0a
LOK
330 language.language[iPtr] = command.parameters[iPtr];
331 language.language[3] = 0;
332 device->SetMenuLanguage(language);
333 }
334 }
335 return true;
336}
337
e9de9629
LOK
338bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
339{
340 if (command.parameters.size >= 2)
341 {
f2198ab5 342 uint16_t streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
e9de9629 343 CStdString strLog;
04437dcf 344 strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, streamaddr);
e9de9629 345 m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
04437dcf
LOK
346
347 return m_busDevice->GetProcessor()->SetStreamPath(streamaddr);
e9de9629
LOK
348 }
349 return true;
350}
351
e5e86c76
LOK
352bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command &command)
353{
354 if (command.parameters.size >= 1)
355 {
356 CCECBusDevice *device = GetDevice(command.destination);
357 if (device&& device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
358 return ((CCECAudioSystem *) device)->SetSystemAudioMode(command);
359 }
360 return true;
361}
362
4d6b4433
LOK
363bool CCECCommandHandler::HandleStandby(const cec_command &command)
364{
365 CCECBusDevice *device = GetDevice(command.initiator);
366 if (device)
367 device->SetPowerStatus(CEC_POWER_STATUS_STANDBY);
368 return true;
369}
370
cf0ecd85
LOK
371bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command)
372{
373 CCECBusDevice *device = GetDevice(command.destination);
374 if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
375 return ((CCECAudioSystem *) device)->TransmitSystemAudioModeStatus(command.initiator);
376
377 return false;
378}
379
e9de9629
LOK
380bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
381{
382 if (command.parameters.size > 0)
383 {
384 m_busDevice->GetProcessor()->AddKey();
385
386 if (command.parameters[0] <= CEC_USER_CONTROL_CODE_MAX)
387 {
388 CStdString strLog;
68391d4f 389 strLog.Format("key pressed: %x", command.parameters[0]);
e9de9629
LOK
390 m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
391
68391d4f
LOK
392 if (command.parameters[0] == CEC_USER_CONTROL_CODE_POWER ||
393 command.parameters[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION)
394 {
395 CCECBusDevice *device = GetDevice(command.destination);
396 if (device)
397 device->SetPowerStatus(CEC_POWER_STATUS_ON);
398 }
399
e9de9629
LOK
400 m_busDevice->GetProcessor()->SetCurrentButton((cec_user_control_code) command.parameters[0]);
401 }
402 }
403 return true;
404}
405
406bool CCECCommandHandler::HandleUserControlRelease(const cec_command &command)
407{
408 m_busDevice->GetProcessor()->AddKey();
409 return true;
410}
411
412void CCECCommandHandler::UnhandledCommand(const cec_command &command)
413{
b5b53c7d
LOK
414 CStdString strLog;
415 strLog.Format("unhandled command with opcode %02x from address %d", command.opcode, command.initiator);
416 m_busDevice->AddLog(CEC_LOG_DEBUG, strLog);
0f23c85c
LOK
417}
418
8747dd4f
LOK
419unsigned int CCECCommandHandler::GetMyDevices(vector<CCECBusDevice *> &devices) const
420{
421 unsigned int iReturn(0);
422
423 cec_logical_addresses addresses = m_busDevice->GetProcessor()->GetLogicalAddresses();
f2198ab5 424 for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
8747dd4f
LOK
425 {
426 if (addresses[iPtr])
427 {
428 devices.push_back(GetDevice((cec_logical_address) iPtr));
429 ++iReturn;
430 }
431 }
432
433 return iReturn;
434}
435
0f23c85c
LOK
436CCECBusDevice *CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress) const
437{
438 CCECBusDevice *device = NULL;
439
440 if (iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST)
441 device = m_busDevice->GetProcessor()->m_busDevices[iLogicalAddress];
442
443 return device;
e9de9629 444}
6685ae07
LOK
445
446CCECBusDevice *CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress) const
447{
8ac9c610 448 return m_busDevice->GetProcessor()->GetDeviceByPhysicalAddress(iPhysicalAddress);
6685ae07 449}
181b3475 450
181b3475
LOK
451void CCECCommandHandler::SetVendorId(const cec_command &command)
452{
453 if (command.parameters.size < 3)
454 {
455 m_busDevice->AddLog(CEC_LOG_WARNING, "invalid vendor ID received");
456 return;
457 }
458
bae71306
LOK
459 uint64_t iVendorId = ((uint64_t)command.parameters[0] << 16) +
460 ((uint64_t)command.parameters[1] << 8) +
181b3475
LOK
461 (uint64_t)command.parameters[2];
462
463 CCECBusDevice *device = GetDevice((cec_logical_address) command.initiator);
464 if (device)
a7bed660 465 device->SetVendorId(iVendorId, command.parameters.size > 3 ? command.parameters[3] : 0);
181b3475 466}
5e822b09 467
c686413b
LOK
468const char *CCECCommandHandler::ToString(const cec_version version)
469{
470 switch (version)
471 {
472 case CEC_VERSION_1_2:
473 return "1.2";
474 case CEC_VERSION_1_2A:
475 return "1.2a";
476 case CEC_VERSION_1_3:
477 return "1.3";
478 case CEC_VERSION_1_3A:
479 return "1.3a";
480 default:
481 return "unknown";
482 }
483}
484
66c16b69
LOK
485const char *CCECCommandHandler::ToString(const cec_power_status status)
486{
487 switch (status)
488 {
489 case CEC_POWER_STATUS_ON:
490 return "on";
491 case CEC_POWER_STATUS_STANDBY:
492 return "standby";
493 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
494 return "in transition from on to standby";
495 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
496 return "in transition from standby to on";
497 default:
498 return "unknown";
499 }
500}
501
62f5527d
LOK
502const char *CCECCommandHandler::ToString(const cec_logical_address address)
503{
504 switch(address)
505 {
506 case CECDEVICE_AUDIOSYSTEM:
507 return "Audio";
508 case CECDEVICE_BROADCAST:
509 return "Broadcast";
510 case CECDEVICE_FREEUSE:
511 return "Free use";
512 case CECDEVICE_PLAYBACKDEVICE1:
513 return "Playback 1";
514 case CECDEVICE_PLAYBACKDEVICE2:
515 return "Playback 2";
516 case CECDEVICE_PLAYBACKDEVICE3:
517 return "Playback 3";
518 case CECDEVICE_RECORDINGDEVICE1:
519 return "Recorder 1";
520 case CECDEVICE_RECORDINGDEVICE2:
521 return "Recorder 2";
522 case CECDEVICE_RECORDINGDEVICE3:
523 return "Recorder 3";
524 case CECDEVICE_RESERVED1:
525 return "Reserved 1";
526 case CECDEVICE_RESERVED2:
527 return "Reserved 2";
528 case CECDEVICE_TUNER1:
529 return "Tuner 1";
530 case CECDEVICE_TUNER2:
531 return "Tuner 2";
532 case CECDEVICE_TUNER3:
533 return "Tuner 3";
534 case CECDEVICE_TUNER4:
535 return "Tuner 4";
536 case CECDEVICE_TV:
537 return "TV";
538 default:
539 return "unknown";
540 }
541}
542
8ac9c610
LOK
543const char *CCECCommandHandler::ToString(const cec_deck_info status)
544{
545 switch (status)
546 {
547 case CEC_DECK_INFO_PLAY:
548 return "play";
549 case CEC_DECK_INFO_RECORD:
550 return "record";
551 case CEC_DECK_INFO_PLAY_REVERSE:
552 return "play reverse";
553 case CEC_DECK_INFO_STILL:
554 return "still";
555 case CEC_DECK_INFO_SLOW:
556 return "slow";
557 case CEC_DECK_INFO_SLOW_REVERSE:
558 return "slow reverse";
559 case CEC_DECK_INFO_FAST_FORWARD:
560 return "fast forward";
561 case CEC_DECK_INFO_FAST_REVERSE:
562 return "fast reverse";
563 case CEC_DECK_INFO_NO_MEDIA:
564 return "no media";
565 case CEC_DECK_INFO_STOP:
566 return "stop";
567 case CEC_DECK_INFO_SKIP_FORWARD_WIND:
568 return "info skip forward wind";
569 case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
570 return "info skip reverse rewind";
571 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
572 return "info index search forward";
573 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
574 return "info index search reverse";
575 case CEC_DECK_INFO_OTHER_STATUS:
576 return "other";
577 default:
578 return "unknown";
579 }
580}
581
5e822b09
LOK
582const char *CCECCommandHandler::ToString(const cec_opcode opcode)
583{
584 switch (opcode)
585 {
586 case CEC_OPCODE_ACTIVE_SOURCE:
587 return "active source";
588 case CEC_OPCODE_IMAGE_VIEW_ON:
589 return "image view on";
590 case CEC_OPCODE_TEXT_VIEW_ON:
591 return "text view on";
592 case CEC_OPCODE_INACTIVE_SOURCE:
593 return "inactive source";
594 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
595 return "request active source";
596 case CEC_OPCODE_ROUTING_CHANGE:
597 return "routing change";
598 case CEC_OPCODE_ROUTING_INFORMATION:
599 return "routing information";
600 case CEC_OPCODE_SET_STREAM_PATH:
601 return "set stream path";
602 case CEC_OPCODE_STANDBY:
603 return "standby";
604 case CEC_OPCODE_RECORD_OFF:
605 return "record off";
606 case CEC_OPCODE_RECORD_ON:
607 return "record on";
608 case CEC_OPCODE_RECORD_STATUS:
609 return "record status";
610 case CEC_OPCODE_RECORD_TV_SCREEN:
611 return "record tv screen";
612 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
613 return "clear analogue timer";
614 case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
615 return "clear digital timer";
616 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
617 return "clear external timer";
618 case CEC_OPCODE_SET_ANALOGUE_TIMER:
619 return "set analogue timer";
620 case CEC_OPCODE_SET_DIGITAL_TIMER:
621 return "set digital timer";
622 case CEC_OPCODE_SET_EXTERNAL_TIMER:
623 return "set external timer";
624 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
625 return "set timer program title";
626 case CEC_OPCODE_TIMER_CLEARED_STATUS:
627 return "timer cleared status";
628 case CEC_OPCODE_TIMER_STATUS:
629 return "timer status";
630 case CEC_OPCODE_CEC_VERSION:
631 return "cec version";
632 case CEC_OPCODE_GET_CEC_VERSION:
633 return "get cec version";
634 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
635 return "give physical address";
636 case CEC_OPCODE_GET_MENU_LANGUAGE:
637 return "get menu language";
638 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
639 return "report physical address";
640 case CEC_OPCODE_SET_MENU_LANGUAGE:
641 return "set menu language";
642 case CEC_OPCODE_DECK_CONTROL:
643 return "deck control";
644 case CEC_OPCODE_DECK_STATUS:
645 return "deck status";
646 case CEC_OPCODE_GIVE_DECK_STATUS:
647 return "give deck status";
648 case CEC_OPCODE_PLAY:
649 return "play";
650 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
651 return "give tuner status";
652 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
653 return "select analogue service";
654 case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
655 return "set digital service";
656 case CEC_OPCODE_TUNER_DEVICE_STATUS:
657 return "tuner device status";
658 case CEC_OPCODE_TUNER_STEP_DECREMENT:
659 return "tuner step decrement";
660 case CEC_OPCODE_TUNER_STEP_INCREMENT:
661 return "tuner step increment";
662 case CEC_OPCODE_DEVICE_VENDOR_ID:
663 return "device vendor id";
664 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
665 return "give device vendor id";
666 case CEC_OPCODE_VENDOR_COMMAND:
667 return "vendor command";
668 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
669 return "vendor command with id";
670 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
671 return "vendor remote button down";
672 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
673 return "vendor remote button up";
674 case CEC_OPCODE_SET_OSD_STRING:
675 return "set osd string";
676 case CEC_OPCODE_GIVE_OSD_NAME:
677 return "give osd name";
678 case CEC_OPCODE_SET_OSD_NAME:
679 return "set osd name";
680 case CEC_OPCODE_MENU_REQUEST:
681 return "menu request";
682 case CEC_OPCODE_MENU_STATUS:
683 return "menu status";
684 case CEC_OPCODE_USER_CONTROL_PRESSED:
685 return "user control pressed";
686 case CEC_OPCODE_USER_CONTROL_RELEASE:
687 return "user control release";
688 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
689 return "give device power status";
690 case CEC_OPCODE_REPORT_POWER_STATUS:
691 return "report power status";
692 case CEC_OPCODE_FEATURE_ABORT:
693 return "feature abort";
694 case CEC_OPCODE_ABORT:
695 return "abort";
696 case CEC_OPCODE_GIVE_AUDIO_STATUS:
697 return "give audio status";
698 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
699 return "give audio mode status";
700 case CEC_OPCODE_REPORT_AUDIO_STATUS:
701 return "report audio status";
702 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
703 return "set system audio mode";
704 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
705 return "system audio mode request";
706 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
707 return "system audio mode status";
708 case CEC_OPCODE_SET_AUDIO_RATE:
709 return "set audio rate";
710 default:
711 return "UNKNOWN";
712 }
713}