mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
Revert "- libarmbox: try to fix cec"
This reverts commitbff0e71e31
. Origin commit data ------------------ Branch: master Commit:9408178607
Author: vanhofen <vanhofen@gmx.de> Date: 2020-05-29 (Fri, 29 May 2020) ------------------ This commit was generated by Migit
This commit is contained in:
@@ -60,7 +60,6 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
#define CEC_DEVICE "/dev/cec0"
|
#define CEC_DEVICE "/dev/cec0"
|
||||||
#define CEC_HDMIDEV "/dev/hdmi_cec"
|
|
||||||
#define RC_DEVICE "/dev/input/event1"
|
#define RC_DEVICE "/dev/input/event1"
|
||||||
|
|
||||||
hdmi_cec * hdmi_cec::hdmi_cec_instance = NULL;
|
hdmi_cec * hdmi_cec::hdmi_cec_instance = NULL;
|
||||||
@@ -73,7 +72,6 @@ hdmi_cec::hdmi_cec()
|
|||||||
standby_cec_activ = autoview_cec_activ = standby = muted = false;
|
standby_cec_activ = autoview_cec_activ = standby = muted = false;
|
||||||
hdmiFd = -1;
|
hdmiFd = -1;
|
||||||
volume = 0;
|
volume = 0;
|
||||||
fallback = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hdmi_cec::~hdmi_cec()
|
hdmi_cec::~hdmi_cec()
|
||||||
@@ -115,6 +113,7 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType)
|
|||||||
if (hdmiFd == -1)
|
if (hdmiFd == -1)
|
||||||
{
|
{
|
||||||
hdmiFd = open(CEC_DEVICE, O_RDWR | O_CLOEXEC);
|
hdmiFd = open(CEC_DEVICE, O_RDWR | O_CLOEXEC);
|
||||||
|
}
|
||||||
|
|
||||||
if (hdmiFd >= 0)
|
if (hdmiFd >= 0)
|
||||||
{
|
{
|
||||||
@@ -185,21 +184,6 @@ bool hdmi_cec::SetCECMode(VIDEO_HDMI_CEC_MODE _deviceType)
|
|||||||
if (ioctl(hdmiFd, CEC_S_MODE, &monitor) < 0)
|
if (ioctl(hdmiFd, CEC_S_MODE, &monitor) < 0)
|
||||||
hal_debug("[CEC] %s: monitor failed (%m)\n", __func__);
|
hal_debug("[CEC] %s: monitor failed (%m)\n", __func__);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hdmiFd == -1)
|
|
||||||
{
|
|
||||||
hdmiFd = ::open(CEC_HDMIDEV, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
|
||||||
if (hdmiFd >= 0)
|
|
||||||
{
|
|
||||||
::ioctl(hdmiFd, 0); /* flush old messages */
|
|
||||||
fallback = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hdmiFd >= 0)
|
|
||||||
{
|
|
||||||
GetCECAddressInfo();
|
GetCECAddressInfo();
|
||||||
|
|
||||||
if(autoview_cec_activ)
|
if(autoview_cec_activ)
|
||||||
@@ -216,18 +200,8 @@ void hdmi_cec::GetCECAddressInfo()
|
|||||||
{
|
{
|
||||||
if (hdmiFd >= 0)
|
if (hdmiFd >= 0)
|
||||||
{
|
{
|
||||||
bool hasdata = false;
|
|
||||||
struct addressinfo addressinfo;
|
struct addressinfo addressinfo;
|
||||||
|
|
||||||
if (fallback)
|
|
||||||
{
|
|
||||||
if (::ioctl(hdmiFd, 1, &addressinfo) >= 0)
|
|
||||||
{
|
|
||||||
hasdata = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__u16 phys_addr;
|
__u16 phys_addr;
|
||||||
struct cec_log_addrs laddrs = {};
|
struct cec_log_addrs laddrs = {};
|
||||||
|
|
||||||
@@ -260,11 +234,7 @@ void hdmi_cec::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 (memcmp(physicalAddress, addressinfo.physical, sizeof(physicalAddress)))
|
if (memcmp(physicalAddress, addressinfo.physical, sizeof(physicalAddress)))
|
||||||
@@ -275,7 +245,6 @@ void hdmi_cec::GetCECAddressInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void hdmi_cec::ReportPhysicalAddress()
|
void hdmi_cec::ReportPhysicalAddress()
|
||||||
{
|
{
|
||||||
@@ -294,24 +263,12 @@ void hdmi_cec::SendCECMessage(struct cec_message &txmessage)
|
|||||||
{
|
{
|
||||||
if (hdmiFd >= 0)
|
if (hdmiFd >= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
char str[txmessage.length*6];
|
char str[txmessage.length*6];
|
||||||
for (int i = 0; i < txmessage.length; i++)
|
for (int i = 0; i < txmessage.length; i++)
|
||||||
{
|
{
|
||||||
sprintf(str+(i*6),"[0x%02X]", txmessage.data[i]);
|
sprintf(str+(i*6),"[0x%02X]", txmessage.data[i]);
|
||||||
}
|
}
|
||||||
hal_info("[CEC] send message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)txmessage.initiator), txmessage.destination == 0xf ? "all" : ToString((cec_logical_address)txmessage.destination), txmessage.initiator, txmessage.destination, ToString((cec_opcode)txmessage.data[0]), str);
|
hal_info("[CEC] send message %s to %s (0x%02X>>0x%02X) '%s' (%s)\n",ToString((cec_logical_address)txmessage.initiator), txmessage.destination == 0xf ? "all" : ToString((cec_logical_address)txmessage.destination), txmessage.initiator, txmessage.destination, ToString((cec_opcode)txmessage.data[0]), str);
|
||||||
|
|
||||||
if (fallback)
|
|
||||||
{
|
|
||||||
struct cec_message_fb message;
|
|
||||||
message.address = txmessage.destination;
|
|
||||||
message.length = txmessage.length;
|
|
||||||
memcpy(&message.data, txmessage.data, txmessage.length);
|
|
||||||
::write(hdmiFd, &message, 2 + message.length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct cec_msg msg;
|
struct cec_msg msg;
|
||||||
cec_msg_init(&msg, txmessage.initiator, txmessage.destination);
|
cec_msg_init(&msg, txmessage.initiator, txmessage.destination);
|
||||||
memcpy(&msg.msg[1], txmessage.data, txmessage.length);
|
memcpy(&msg.msg[1], txmessage.data, txmessage.length);
|
||||||
@@ -319,7 +276,6 @@ void hdmi_cec::SendCECMessage(struct cec_message &txmessage)
|
|||||||
ioctl(hdmiFd, CEC_TRANSMIT, &msg);
|
ioctl(hdmiFd, CEC_TRANSMIT, &msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void hdmi_cec::SetCECAutoStandby(bool state)
|
void hdmi_cec::SetCECAutoStandby(bool state)
|
||||||
{
|
{
|
||||||
@@ -544,24 +500,6 @@ void hdmi_cec::Receive()
|
|||||||
struct cec_message rxmessage;
|
struct cec_message rxmessage;
|
||||||
struct cec_message txmessage;
|
struct cec_message txmessage;
|
||||||
|
|
||||||
if (fallback)
|
|
||||||
{
|
|
||||||
struct cec_message_fb rx_message;
|
|
||||||
if (::read(hdmiFd, &rx_message, 2) == 2)
|
|
||||||
{
|
|
||||||
if (::read(hdmiFd, &rx_message.data, rx_message.length) == rx_message.length)
|
|
||||||
{
|
|
||||||
rxmessage.length = rx_message.length;
|
|
||||||
rxmessage.initiator = rx_message.address;
|
|
||||||
rxmessage.destination = logicalAddress;
|
|
||||||
rxmessage.opcode = rx_message.data[0];
|
|
||||||
memcpy(&rxmessage.data, rx_message.data, rx_message.length);
|
|
||||||
hasdata = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct cec_msg msg;
|
struct cec_msg msg;
|
||||||
if (::ioctl(hdmiFd, CEC_RECEIVE, &msg) >= 0)
|
if (::ioctl(hdmiFd, CEC_RECEIVE, &msg) >= 0)
|
||||||
{
|
{
|
||||||
@@ -572,7 +510,6 @@ void hdmi_cec::Receive()
|
|||||||
memcpy(&rxmessage.data, &msg.msg[1], rxmessage.length);
|
memcpy(&rxmessage.data, &msg.msg[1], rxmessage.length);
|
||||||
hasdata = true;
|
hasdata = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (hasdata)
|
if (hasdata)
|
||||||
{
|
{
|
||||||
|
@@ -34,13 +34,6 @@ struct cec_message
|
|||||||
unsigned char length;
|
unsigned char length;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct cec_message_fb
|
|
||||||
{
|
|
||||||
unsigned char address;
|
|
||||||
unsigned char length;
|
|
||||||
unsigned char data[256];
|
|
||||||
}__attribute__((packed));
|
|
||||||
|
|
||||||
struct addressinfo
|
struct addressinfo
|
||||||
{
|
{
|
||||||
unsigned char logical;
|
unsigned char logical;
|
||||||
@@ -77,7 +70,6 @@ private:
|
|||||||
void request_audio_status();
|
void request_audio_status();
|
||||||
bool muted;
|
bool muted;
|
||||||
int volume;
|
int volume;
|
||||||
bool fallback;
|
|
||||||
protected:
|
protected:
|
||||||
bool running;
|
bool running;
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user