rcinput: fix set_rc_hw() after dynamic devices patch

...this could use some tests... :-)


Origin commit data
------------------
Branch: ni/coolstream
Commit: 41958cc029
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-20 (Mon, 20 Feb 2017)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-02-20 20:22:32 +01:00
committed by Michael Liebmann
parent 475c8878f8
commit 8071a9d51b

View File

@@ -1846,8 +1846,18 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
printf("[rcinput:%s] indev is empty!\n", __func__);
return;
}
//fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment
ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_PROTOCOL, ir_protocol);
int fd = -1;
for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
if ((*it).path == "/dev/input/nevis_ir") {
fd = (*it).fd;
break;
}
}
if (fd == -1) {
printf("[rcinput:%s] no nevis_ir input device found??\n", __func__);
return;
}
ioctl_ret = ::ioctl(fd, IOC_IR_SET_PRI_PROTOCOL, ir_protocol);
if(ioctl_ret < 0)
perror("IOC_IR_SET_PRI_PROTOCOL");
else
@@ -1857,7 +1867,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
if(ir_address > 0)
{
//fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment
ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_ADDRESS, ir_address);
ioctl_ret = ::ioctl(fd, IOC_IR_SET_PRI_ADDRESS, ir_address);
if(ioctl_ret < 0)
perror("IOC_IR_SET_PRI_ADDRESS");
else