mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
armbox: tryfix cec
This commit is contained in:
@@ -889,11 +889,11 @@ bool cVideo::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCECAddressInfo();
|
GetCECAddressInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::getCECAddressInfo()
|
void cVideo::GetCECAddressInfo()
|
||||||
{
|
{
|
||||||
if (hdmiFd >= 0)
|
if (hdmiFd >= 0)
|
||||||
{
|
{
|
||||||
@@ -932,27 +932,32 @@ void cVideo::getCECAddressInfo()
|
|||||||
addressinfo.type = CEC_LOG_ADDR_UNREGISTERED;
|
addressinfo.type = CEC_LOG_ADDR_UNREGISTERED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hasdata = true;
|
|
||||||
|
|
||||||
if (hasdata)
|
|
||||||
{
|
|
||||||
deviceType = addressinfo.type;
|
deviceType = addressinfo.type;
|
||||||
logicalAddress = addressinfo.logical;
|
logicalAddress = addressinfo.logical;
|
||||||
if (!fixedAddress)
|
|
||||||
{
|
|
||||||
if (memcmp(physicalAddress, addressinfo.physical, sizeof(physicalAddress)))
|
if (memcmp(physicalAddress, addressinfo.physical, sizeof(physicalAddress)))
|
||||||
{
|
{
|
||||||
lt_info("%s: detected physical address change: %02X%02X --> %02X%02X", __func__, physicalAddress[0], physicalAddress[1], addressinfo.physical[0], addressinfo.physical[1]);
|
lt_info("%s: detected physical address change: %02X%02X --> %02X%02X", __func__, physicalAddress[0], physicalAddress[1], addressinfo.physical[0], addressinfo.physical[1]);
|
||||||
memcpy(physicalAddress, addressinfo.physical, sizeof(physicalAddress));
|
memcpy(physicalAddress, addressinfo.physical, sizeof(physicalAddress));
|
||||||
//reportPhysicalAddress();
|
ReportPhysicalAddress();
|
||||||
// addressChanged((physicalAddress[0] << 8) | physicalAddress[1]);
|
// addressChanged((physicalAddress[0] << 8) | physicalAddress[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void cVideo::ReportPhysicalAddress()
|
||||||
|
{
|
||||||
|
struct cec_message txmessage;
|
||||||
|
txmessage.address = 0x0f; /* broadcast */
|
||||||
|
txmessage.data[0] = CEC_MSG_REPORT_PHYSICAL_ADDR;
|
||||||
|
txmessage.data[1] = physicalAddress[0];
|
||||||
|
txmessage.data[2] = physicalAddress[1];
|
||||||
|
txmessage.data[3] = deviceType;
|
||||||
|
txmessage.length = 4;
|
||||||
|
SendCECMessage(txmessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::sendCECMessage(struct cec_message &message)
|
void cVideo::SendCECMessage(struct cec_message &message)
|
||||||
{
|
{
|
||||||
if (hdmiFd >= 0)
|
if (hdmiFd >= 0)
|
||||||
{
|
{
|
||||||
@@ -983,19 +988,26 @@ void cVideo::SetCECAutoView(bool state)
|
|||||||
void cVideo::SetCECState(bool state)
|
void cVideo::SetCECState(bool state)
|
||||||
{
|
{
|
||||||
struct cec_message message;
|
struct cec_message message;
|
||||||
message.address = 0x0f;
|
|
||||||
message.length = 2;
|
|
||||||
|
|
||||||
if ((standby_cec_activ) && state){
|
if ((standby_cec_activ) && state){
|
||||||
|
message.address = CEC_OP_PRIM_DEVTYPE_TV;
|
||||||
message.data[0] = CEC_MSG_STANDBY;
|
message.data[0] = CEC_MSG_STANDBY;
|
||||||
message.data[1] = 1;
|
message.length = 1;
|
||||||
sendCECMessage(message);
|
SendCECMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((autoview_cec_activ) && !state){
|
if ((autoview_cec_activ) && !state){
|
||||||
|
message.address = CEC_OP_PRIM_DEVTYPE_TV;
|
||||||
message.data[0] = CEC_MSG_IMAGE_VIEW_ON;
|
message.data[0] = CEC_MSG_IMAGE_VIEW_ON;
|
||||||
message.data[1] = 1;
|
message.length = 1;
|
||||||
sendCECMessage(message);
|
SendCECMessage(message);
|
||||||
|
usleep(10000);
|
||||||
|
message.address = 0x0f; /* broadcast */
|
||||||
|
message.data[0] = CEC_MSG_ACTIVE_SOURCE;
|
||||||
|
message.data[1] = ((((int)physicalAddress >> 12) & 0xf) << 4) + (((int)physicalAddress >> 8) & 0xf);
|
||||||
|
message.data[2] = ((((int)physicalAddress >> 4) & 0xf) << 4) + (((int)physicalAddress >> 0) & 0xf);
|
||||||
|
message.length = 3;
|
||||||
|
SendCECMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -181,7 +181,7 @@ class cVideo
|
|||||||
int64_t GetPTS(void);
|
int64_t GetPTS(void);
|
||||||
|
|
||||||
unsigned char physicalAddress[2];
|
unsigned char physicalAddress[2];
|
||||||
bool fixedAddress,standby_cec_activ,autoview_cec_activ;
|
bool standby_cec_activ,autoview_cec_activ;
|
||||||
unsigned char deviceType, logicalAddress;
|
unsigned char deviceType, logicalAddress;
|
||||||
int hdmiFd;
|
int hdmiFd;
|
||||||
|
|
||||||
@@ -229,9 +229,10 @@ class cVideo
|
|||||||
bool SetCECMode(VIDEO_HDMI_CEC_MODE);
|
bool SetCECMode(VIDEO_HDMI_CEC_MODE);
|
||||||
void SetCECAutoView(bool);
|
void SetCECAutoView(bool);
|
||||||
void SetCECAutoStandby(bool);
|
void SetCECAutoStandby(bool);
|
||||||
void getCECAddressInfo();
|
void GetCECAddressInfo();
|
||||||
void sendCECMessage(struct cec_message &message);
|
void SendCECMessage(struct cec_message &message);
|
||||||
void SetCECState(bool state);
|
void SetCECState(bool state);
|
||||||
|
void ReportPhysicalAddress();
|
||||||
void ShowPicture(const char * fname, const char *_destname = NULL);
|
void ShowPicture(const char * fname, const char *_destname = NULL);
|
||||||
void StopPicture();
|
void StopPicture();
|
||||||
void Standby(unsigned int bOn);
|
void Standby(unsigned int bOn);
|
||||||
|
Reference in New Issue
Block a user