- CCECAdapterMessage *output = new CCECAdapterMessage;
-
- output->PushBack(MSGSTART);
- output->PushEscaped(MSGCODE_FIRMWARE_VERSION);
- output->PushBack(MSGEND);
- output->isTransmission = false;
- output->expectControllerAck = false;
-
- SendMessageToAdapter(output);
- bool bWriteOk = output->state == ADAPTER_MESSAGE_STATE_SENT;
- delete output;
- if (!bWriteOk)
- {
- CLibCEC::AddLog(CEC_LOG_ERROR, "could not request the firmware version");
- return iReturn;
- }
-
- Sleep(250); // TODO ReadFromDevice() isn't waiting for the timeout to pass on win32
- ReadFromDevice(CEC_DEFAULT_TRANSMIT_WAIT, 5 /* start + msgcode + 2 bytes for fw version + end */);
- CCECAdapterMessage input;
- if (Read(input, 0))
- {
- if (input.Message() != MSGCODE_FIRMWARE_VERSION || input.Size() != 3)
- CLibCEC::AddLog(CEC_LOG_ERROR, "invalid firmware version (size = %d, message = %d)", input.Size(), input.Message());
- else
- {
- m_iFirmwareVersion = (input[1] << 8 | input[2]);
- iReturn = m_iFirmwareVersion;
- }
- }
- else
+ cec_datapacket response = GetSetting(MSGCODE_FIRMWARE_VERSION, 2);
+ if (response.size == 2)