| 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" |
| 34 | #include "../devices/CECBusDevice.h" |
| 35 | #include "../devices/CECAudioSystem.h" |
| 36 | #include "../CECProcessor.h" |
| 37 | |
| 38 | using namespace CEC; |
| 39 | |
| 40 | CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) |
| 41 | { |
| 42 | m_busDevice = busDevice; |
| 43 | } |
| 44 | |
| 45 | bool CCECCommandHandler::HandleCommand(const cec_command &command) |
| 46 | { |
| 47 | bool bHandled(true); |
| 48 | |
| 49 | CStdString strLog; |
| 50 | strLog.Format(">> %x -> %x: %s (%2x)", command.initiator, command.destination, ToString(command.opcode), command.opcode); |
| 51 | m_busDevice->AddLog(CEC_LOG_NOTICE, strLog); |
| 52 | |
| 53 | if (m_busDevice->MyLogicalAddressContains(command.destination)) |
| 54 | { |
| 55 | switch(command.opcode) |
| 56 | { |
| 57 | case CEC_OPCODE_REPORT_POWER_STATUS: |
| 58 | HandleReportPowerStatus(command); |
| 59 | break; |
| 60 | case CEC_OPCODE_CEC_VERSION: |
| 61 | HandleDeviceCecVersion(command); |
| 62 | break; |
| 63 | case CEC_OPCODE_SET_MENU_LANGUAGE: |
| 64 | HandleSetMenuLanguage(command); |
| 65 | m_busDevice->GetProcessor()->AddCommand(command); |
| 66 | break; |
| 67 | case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS: |
| 68 | HandleGivePhysicalAddress(command); |
| 69 | break; |
| 70 | case CEC_OPCODE_GIVE_OSD_NAME: |
| 71 | HandleGiveOSDName(command); |
| 72 | break; |
| 73 | case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID: |
| 74 | HandleGiveDeviceVendorId(command); |
| 75 | break; |
| 76 | case CEC_OPCODE_DEVICE_VENDOR_ID: |
| 77 | HandleDeviceVendorId(command); |
| 78 | break; |
| 79 | case CEC_OPCODE_VENDOR_COMMAND_WITH_ID: |
| 80 | HandleDeviceVendorCommandWithId(command); |
| 81 | break; |
| 82 | case CEC_OPCODE_GIVE_DECK_STATUS: |
| 83 | HandleGiveDeckStatus(command); |
| 84 | break; |
| 85 | case CEC_OPCODE_MENU_REQUEST: |
| 86 | HandleMenuRequest(command); |
| 87 | break; |
| 88 | case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS: |
| 89 | HandleGiveDevicePowerStatus(command); |
| 90 | break; |
| 91 | case CEC_OPCODE_GET_CEC_VERSION: |
| 92 | HandleGetCecVersion(command); |
| 93 | break; |
| 94 | case CEC_OPCODE_USER_CONTROL_PRESSED: |
| 95 | HandleUserControlPressed(command); |
| 96 | break; |
| 97 | case CEC_OPCODE_USER_CONTROL_RELEASE: |
| 98 | HandleUserControlRelease(command); |
| 99 | break; |
| 100 | case CEC_OPCODE_GIVE_AUDIO_STATUS: |
| 101 | HandleGiveAudioStatus(command); |
| 102 | break; |
| 103 | case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS: |
| 104 | HandleGiveSystemAudioModeStatus(command); |
| 105 | break; |
| 106 | case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST: |
| 107 | HandleSetSystemAudioModeRequest(command); |
| 108 | break; |
| 109 | default: |
| 110 | UnhandledCommand(command); |
| 111 | m_busDevice->GetProcessor()->AddCommand(command); |
| 112 | bHandled = false; |
| 113 | break; |
| 114 | } |
| 115 | } |
| 116 | else if (command.destination == CECDEVICE_BROADCAST) |
| 117 | { |
| 118 | CStdString strLog; |
| 119 | switch (command.opcode) |
| 120 | { |
| 121 | case CEC_OPCODE_SET_MENU_LANGUAGE: |
| 122 | HandleSetMenuLanguage(command); |
| 123 | m_busDevice->GetProcessor()->AddCommand(command); |
| 124 | break; |
| 125 | case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: |
| 126 | HandleRequestActiveSource(command); |
| 127 | break; |
| 128 | case CEC_OPCODE_SET_STREAM_PATH: |
| 129 | HandleSetStreamPath(command); |
| 130 | m_busDevice->GetProcessor()->AddCommand(command); |
| 131 | break; |
| 132 | case CEC_OPCODE_ROUTING_CHANGE: |
| 133 | HandleRoutingChange(command); |
| 134 | m_busDevice->GetProcessor()->AddCommand(command); |
| 135 | break; |
| 136 | case CEC_OPCODE_DEVICE_VENDOR_ID: |
| 137 | HandleDeviceVendorId(command); |
| 138 | break; |
| 139 | case CEC_OPCODE_VENDOR_COMMAND_WITH_ID: |
| 140 | HandleDeviceVendorCommandWithId(command); |
| 141 | break; |
| 142 | default: |
| 143 | UnhandledCommand(command); |
| 144 | m_busDevice->GetProcessor()->AddCommand(command); |
| 145 | bHandled = false; |
| 146 | break; |
| 147 | } |
| 148 | } |
| 149 | else |
| 150 | { |
| 151 | CStdString strLog; |
| 152 | strLog.Format("ignoring frame: we're not at destination %x", command.destination); |
| 153 | m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); |
| 154 | bHandled = false; |
| 155 | } |
| 156 | |
| 157 | return bHandled; |
| 158 | } |
| 159 | |
| 160 | bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command &command) |
| 161 | { |
| 162 | if (command.parameters.size == 1) |
| 163 | { |
| 164 | CCECBusDevice *device = GetDevice(command.initiator); |
| 165 | if (device) |
| 166 | device->SetCecVersion((cec_version) command.parameters[0]); |
| 167 | } |
| 168 | |
| 169 | return true; |
| 170 | } |
| 171 | |
| 172 | bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command) |
| 173 | { |
| 174 | SetVendorId(command); |
| 175 | return true; |
| 176 | } |
| 177 | |
| 178 | bool CCECCommandHandler::HandleDeviceVendorId(const cec_command &command) |
| 179 | { |
| 180 | SetVendorId(command); |
| 181 | return true; |
| 182 | } |
| 183 | |
| 184 | bool CCECCommandHandler::HandleGetCecVersion(const cec_command &command) |
| 185 | { |
| 186 | CCECBusDevice *device = GetDevice(command.destination); |
| 187 | if (device) |
| 188 | return device->TransmitCECVersion(command.initiator); |
| 189 | |
| 190 | return false; |
| 191 | } |
| 192 | |
| 193 | bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command &command) |
| 194 | { |
| 195 | CCECBusDevice *device = GetDevice(command.destination); |
| 196 | if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) |
| 197 | return ((CCECAudioSystem *) device)->TransmitAudioStatus(command.initiator); |
| 198 | |
| 199 | return false; |
| 200 | } |
| 201 | |
| 202 | bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command &command) |
| 203 | { |
| 204 | CCECBusDevice *device = GetDevice(command.destination); |
| 205 | if (device) |
| 206 | return device->TransmitDeckStatus(command.initiator); |
| 207 | |
| 208 | return false; |
| 209 | } |
| 210 | |
| 211 | bool CCECCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command) |
| 212 | { |
| 213 | CCECBusDevice *device = GetDevice(command.destination); |
| 214 | if (device) |
| 215 | return device->TransmitPowerState(command.initiator); |
| 216 | |
| 217 | return false; |
| 218 | } |
| 219 | |
| 220 | bool CCECCommandHandler::HandleGiveDeviceVendorId(const cec_command &command) |
| 221 | { |
| 222 | CCECBusDevice *device = GetDevice(command.destination); |
| 223 | if (device) |
| 224 | return device->TransmitVendorID(command.initiator); |
| 225 | |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | bool CCECCommandHandler::HandleGiveOSDName(const cec_command &command) |
| 230 | { |
| 231 | CCECBusDevice *device = GetDevice(command.destination); |
| 232 | if (device) |
| 233 | return device->TransmitOSDName(command.initiator); |
| 234 | |
| 235 | return false; |
| 236 | } |
| 237 | |
| 238 | bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command) |
| 239 | { |
| 240 | CCECBusDevice *device = GetDevice(command.destination); |
| 241 | if (device) |
| 242 | return device->TransmitPhysicalAddress(); |
| 243 | |
| 244 | return false; |
| 245 | } |
| 246 | |
| 247 | bool CCECCommandHandler::HandleMenuRequest(const cec_command &command) |
| 248 | { |
| 249 | if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_QUERY) |
| 250 | { |
| 251 | CCECBusDevice *device = GetDevice(command.destination); |
| 252 | if (device) |
| 253 | return device->TransmitMenuState(command.initiator); |
| 254 | } |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | bool CCECCommandHandler::HandleReportPowerStatus(const cec_command &command) |
| 259 | { |
| 260 | if (command.parameters.size == 1) |
| 261 | { |
| 262 | CCECBusDevice *device = GetDevice(command.initiator); |
| 263 | if (device) |
| 264 | device->SetPowerStatus((cec_power_status) command.parameters[0]); |
| 265 | } |
| 266 | return true; |
| 267 | } |
| 268 | |
| 269 | bool CCECCommandHandler::HandleRequestActiveSource(const cec_command &command) |
| 270 | { |
| 271 | CStdString strLog; |
| 272 | strLog.Format(">> %i requests active source", (uint8_t) command.initiator); |
| 273 | m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); |
| 274 | CCECBusDevice *device = m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetMyLogicalAddress()]; |
| 275 | if (device) |
| 276 | return device->TransmitActiveSource(); |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | bool CCECCommandHandler::HandleRoutingChange(const cec_command &command) |
| 281 | { |
| 282 | if (command.parameters.size == 4) |
| 283 | { |
| 284 | uint16_t iOldAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); |
| 285 | uint16_t iNewAddress = ((uint16_t)command.parameters[2] << 8) | ((uint16_t)command.parameters[3]); |
| 286 | |
| 287 | CCECBusDevice *device = GetDevice(command.initiator); |
| 288 | if (device) |
| 289 | device->SetStreamPath(iNewAddress, iOldAddress); |
| 290 | } |
| 291 | return true; |
| 292 | } |
| 293 | |
| 294 | bool CCECCommandHandler::HandleSetMenuLanguage(const cec_command &command) |
| 295 | { |
| 296 | if (command.parameters.size == 3) |
| 297 | { |
| 298 | CCECBusDevice *device = GetDevice(command.initiator); |
| 299 | if (device) |
| 300 | { |
| 301 | cec_menu_language language; |
| 302 | language.device = command.initiator; |
| 303 | for (uint8_t iPtr = 0; iPtr < 4; iPtr++) |
| 304 | language.language[iPtr] = command.parameters[iPtr]; |
| 305 | language.language[3] = 0; |
| 306 | device->SetMenuLanguage(language); |
| 307 | } |
| 308 | } |
| 309 | return true; |
| 310 | } |
| 311 | |
| 312 | bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command) |
| 313 | { |
| 314 | if (command.parameters.size >= 2) |
| 315 | { |
| 316 | int streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); |
| 317 | CStdString strLog; |
| 318 | strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr); |
| 319 | m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); |
| 320 | CCECBusDevice *device = GetDeviceByPhysicalAddress(streamaddr); |
| 321 | if (device) |
| 322 | return device->TransmitActiveSource(); |
| 323 | } |
| 324 | return true; |
| 325 | } |
| 326 | |
| 327 | bool CCECCommandHandler::HandleSetSystemAudioModeRequest(const cec_command &command) |
| 328 | { |
| 329 | if (command.parameters.size >= 1) |
| 330 | { |
| 331 | CCECBusDevice *device = GetDevice(command.destination); |
| 332 | if (device&& device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) |
| 333 | return ((CCECAudioSystem *) device)->SetSystemAudioMode(command); |
| 334 | } |
| 335 | return true; |
| 336 | } |
| 337 | |
| 338 | bool CCECCommandHandler::HandleGiveSystemAudioModeStatus(const cec_command &command) |
| 339 | { |
| 340 | CCECBusDevice *device = GetDevice(command.destination); |
| 341 | if (device && device->GetType() == CEC_DEVICE_TYPE_AUDIO_SYSTEM) |
| 342 | return ((CCECAudioSystem *) device)->TransmitSystemAudioModeStatus(command.initiator); |
| 343 | |
| 344 | return false; |
| 345 | } |
| 346 | |
| 347 | bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command) |
| 348 | { |
| 349 | if (command.parameters.size > 0) |
| 350 | { |
| 351 | m_busDevice->GetProcessor()->AddKey(); |
| 352 | |
| 353 | if (command.parameters[0] <= CEC_USER_CONTROL_CODE_MAX) |
| 354 | { |
| 355 | CStdString strLog; |
| 356 | strLog.Format("key pressed: %1x", command.parameters[0]); |
| 357 | m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); |
| 358 | |
| 359 | m_busDevice->GetProcessor()->SetCurrentButton((cec_user_control_code) command.parameters[0]); |
| 360 | } |
| 361 | } |
| 362 | return true; |
| 363 | } |
| 364 | |
| 365 | bool CCECCommandHandler::HandleUserControlRelease(const cec_command &command) |
| 366 | { |
| 367 | m_busDevice->GetProcessor()->AddKey(); |
| 368 | return true; |
| 369 | } |
| 370 | |
| 371 | void CCECCommandHandler::UnhandledCommand(const cec_command &command) |
| 372 | { |
| 373 | CStdString strLog; |
| 374 | strLog.Format("unhandled command with opcode %02x from address %d", command.opcode, command.initiator); |
| 375 | m_busDevice->AddLog(CEC_LOG_DEBUG, strLog); |
| 376 | } |
| 377 | |
| 378 | CCECBusDevice *CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress) const |
| 379 | { |
| 380 | CCECBusDevice *device = NULL; |
| 381 | |
| 382 | if (iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST) |
| 383 | device = m_busDevice->GetProcessor()->m_busDevices[iLogicalAddress]; |
| 384 | |
| 385 | return device; |
| 386 | } |
| 387 | |
| 388 | CCECBusDevice *CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress) const |
| 389 | { |
| 390 | CCECBusDevice *device = NULL; |
| 391 | |
| 392 | for (unsigned int iPtr = 0; iPtr < 16; iPtr++) |
| 393 | { |
| 394 | if (m_busDevice->GetProcessor()->m_busDevices[iPtr]->GetPhysicalAddress() == iPhysicalAddress) |
| 395 | { |
| 396 | device = m_busDevice->GetProcessor()->m_busDevices[iPtr]; |
| 397 | break; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return device; |
| 402 | } |
| 403 | |
| 404 | void CCECCommandHandler::SetVendorId(const cec_command &command) |
| 405 | { |
| 406 | if (command.parameters.size < 3) |
| 407 | { |
| 408 | m_busDevice->AddLog(CEC_LOG_WARNING, "invalid vendor ID received"); |
| 409 | return; |
| 410 | } |
| 411 | |
| 412 | uint64_t iVendorId = ((uint64_t)command.parameters[0] << 3) + |
| 413 | ((uint64_t)command.parameters[1] << 2) + |
| 414 | (uint64_t)command.parameters[2]; |
| 415 | |
| 416 | CCECBusDevice *device = GetDevice((cec_logical_address) command.initiator); |
| 417 | if (device) |
| 418 | device->SetVendorId(iVendorId, command.parameters.size > 3 ? command.parameters[3] : 0); |
| 419 | } |
| 420 | |
| 421 | const char *CCECCommandHandler::ToString(const cec_opcode opcode) |
| 422 | { |
| 423 | switch (opcode) |
| 424 | { |
| 425 | case CEC_OPCODE_ACTIVE_SOURCE: |
| 426 | return "active source"; |
| 427 | case CEC_OPCODE_IMAGE_VIEW_ON: |
| 428 | return "image view on"; |
| 429 | case CEC_OPCODE_TEXT_VIEW_ON: |
| 430 | return "text view on"; |
| 431 | case CEC_OPCODE_INACTIVE_SOURCE: |
| 432 | return "inactive source"; |
| 433 | case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: |
| 434 | return "request active source"; |
| 435 | case CEC_OPCODE_ROUTING_CHANGE: |
| 436 | return "routing change"; |
| 437 | case CEC_OPCODE_ROUTING_INFORMATION: |
| 438 | return "routing information"; |
| 439 | case CEC_OPCODE_SET_STREAM_PATH: |
| 440 | return "set stream path"; |
| 441 | case CEC_OPCODE_STANDBY: |
| 442 | return "standby"; |
| 443 | case CEC_OPCODE_RECORD_OFF: |
| 444 | return "record off"; |
| 445 | case CEC_OPCODE_RECORD_ON: |
| 446 | return "record on"; |
| 447 | case CEC_OPCODE_RECORD_STATUS: |
| 448 | return "record status"; |
| 449 | case CEC_OPCODE_RECORD_TV_SCREEN: |
| 450 | return "record tv screen"; |
| 451 | case CEC_OPCODE_CLEAR_ANALOGUE_TIMER: |
| 452 | return "clear analogue timer"; |
| 453 | case CEC_OPCODE_CLEAR_DIGITAL_TIMER: |
| 454 | return "clear digital timer"; |
| 455 | case CEC_OPCODE_CLEAR_EXTERNAL_TIMER: |
| 456 | return "clear external timer"; |
| 457 | case CEC_OPCODE_SET_ANALOGUE_TIMER: |
| 458 | return "set analogue timer"; |
| 459 | case CEC_OPCODE_SET_DIGITAL_TIMER: |
| 460 | return "set digital timer"; |
| 461 | case CEC_OPCODE_SET_EXTERNAL_TIMER: |
| 462 | return "set external timer"; |
| 463 | case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE: |
| 464 | return "set timer program title"; |
| 465 | case CEC_OPCODE_TIMER_CLEARED_STATUS: |
| 466 | return "timer cleared status"; |
| 467 | case CEC_OPCODE_TIMER_STATUS: |
| 468 | return "timer status"; |
| 469 | case CEC_OPCODE_CEC_VERSION: |
| 470 | return "cec version"; |
| 471 | case CEC_OPCODE_GET_CEC_VERSION: |
| 472 | return "get cec version"; |
| 473 | case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS: |
| 474 | return "give physical address"; |
| 475 | case CEC_OPCODE_GET_MENU_LANGUAGE: |
| 476 | return "get menu language"; |
| 477 | case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS: |
| 478 | return "report physical address"; |
| 479 | case CEC_OPCODE_SET_MENU_LANGUAGE: |
| 480 | return "set menu language"; |
| 481 | case CEC_OPCODE_DECK_CONTROL: |
| 482 | return "deck control"; |
| 483 | case CEC_OPCODE_DECK_STATUS: |
| 484 | return "deck status"; |
| 485 | case CEC_OPCODE_GIVE_DECK_STATUS: |
| 486 | return "give deck status"; |
| 487 | case CEC_OPCODE_PLAY: |
| 488 | return "play"; |
| 489 | case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS: |
| 490 | return "give tuner status"; |
| 491 | case CEC_OPCODE_SELECT_ANALOGUE_SERVICE: |
| 492 | return "select analogue service"; |
| 493 | case CEC_OPCODE_SELECT_DIGITAL_SERVICE: |
| 494 | return "set digital service"; |
| 495 | case CEC_OPCODE_TUNER_DEVICE_STATUS: |
| 496 | return "tuner device status"; |
| 497 | case CEC_OPCODE_TUNER_STEP_DECREMENT: |
| 498 | return "tuner step decrement"; |
| 499 | case CEC_OPCODE_TUNER_STEP_INCREMENT: |
| 500 | return "tuner step increment"; |
| 501 | case CEC_OPCODE_DEVICE_VENDOR_ID: |
| 502 | return "device vendor id"; |
| 503 | case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID: |
| 504 | return "give device vendor id"; |
| 505 | case CEC_OPCODE_VENDOR_COMMAND: |
| 506 | return "vendor command"; |
| 507 | case CEC_OPCODE_VENDOR_COMMAND_WITH_ID: |
| 508 | return "vendor command with id"; |
| 509 | case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN: |
| 510 | return "vendor remote button down"; |
| 511 | case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP: |
| 512 | return "vendor remote button up"; |
| 513 | case CEC_OPCODE_SET_OSD_STRING: |
| 514 | return "set osd string"; |
| 515 | case CEC_OPCODE_GIVE_OSD_NAME: |
| 516 | return "give osd name"; |
| 517 | case CEC_OPCODE_SET_OSD_NAME: |
| 518 | return "set osd name"; |
| 519 | case CEC_OPCODE_MENU_REQUEST: |
| 520 | return "menu request"; |
| 521 | case CEC_OPCODE_MENU_STATUS: |
| 522 | return "menu status"; |
| 523 | case CEC_OPCODE_USER_CONTROL_PRESSED: |
| 524 | return "user control pressed"; |
| 525 | case CEC_OPCODE_USER_CONTROL_RELEASE: |
| 526 | return "user control release"; |
| 527 | case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS: |
| 528 | return "give device power status"; |
| 529 | case CEC_OPCODE_REPORT_POWER_STATUS: |
| 530 | return "report power status"; |
| 531 | case CEC_OPCODE_FEATURE_ABORT: |
| 532 | return "feature abort"; |
| 533 | case CEC_OPCODE_ABORT: |
| 534 | return "abort"; |
| 535 | case CEC_OPCODE_GIVE_AUDIO_STATUS: |
| 536 | return "give audio status"; |
| 537 | case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS: |
| 538 | return "give audio mode status"; |
| 539 | case CEC_OPCODE_REPORT_AUDIO_STATUS: |
| 540 | return "report audio status"; |
| 541 | case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE: |
| 542 | return "set system audio mode"; |
| 543 | case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST: |
| 544 | return "system audio mode request"; |
| 545 | case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS: |
| 546 | return "system audio mode status"; |
| 547 | case CEC_OPCODE_SET_AUDIO_RATE: |
| 548 | return "set audio rate"; |
| 549 | default: |
| 550 | return "UNKNOWN"; |
| 551 | } |
| 552 | } |