Merge branch 'master' into multituner

This commit is contained in:
[CST] Focus
2012-01-16 17:48:19 +04:00
20 changed files with 277 additions and 97 deletions

View File

@@ -70,10 +70,10 @@ static struct termio orig_termio;
static bool saved_orig_termio = false;
#endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */
/**************************************************************************
* Constructor - opens rc-input device and starts threads
/*********************************************************************************
* Constructor - opens rc-input device, selects rc-hardware and starts threads
*
**************************************************************************/
*********************************************************************************/
CRCInput::CRCInput()
{
timerid= 1;
@@ -139,6 +139,9 @@ CRCInput::CRCInput()
repeat_block = repeat_block_generic = 0;
open();
rc_last_key = KEY_MAX;
//select and setup remote control hardware
set_rc_hw();
}
void CRCInput::open()
@@ -153,7 +156,7 @@ void CRCInput::open()
{
fcntl(fd_rc[i], F_SETFL, O_NONBLOCK);
}
printf("CRCInput::open: %s fd %d\n", RC_EVENT_DEVICE[i], fd_rc[i]);
printf("CRCInput::open: %s fd %d\n", RC_EVENT_DEVICE[i], fd_rc[i]);
}
//+++++++++++++++++++++++++++++++++++++++
@@ -1524,3 +1527,73 @@ void CRCInput::set_dsp()
void CRCInput::play_click()
{
}
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
// hint: ir_protocol_t and other useful things are defined in nevis_ir.h
void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
{
int ioctl_ret = -1;
//fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment
ioctl_ret = ::ioctl(fd_rc[0], IOC_IR_SET_PRI_PROTOCOL, ir_protocol);
if(ioctl_ret < 0)
perror("IOC_IR_SET_PRI_PROTOCOL");
else
printf("CRCInput::set_rc_hw: Set IOCTRL : IOC_IR_SET_PRI_PROTOCOL, %05X\n", ir_protocol);
//bypass setting of IR Address with ir_address=0
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(fd_rc[0], IOC_IR_SET_PRI_ADDRESS, ir_address);
if(ioctl_ret < 0)
perror("IOC_IR_SET_PRI_ADDRESS");
else
printf("CRCInput::set_rc_hw: Set IOCTRL : IOC_IR_SET_PRI_ADDRESS, %05X\n", ir_address);
}
}
// hint: ir_protocol_t and other useful things are defined in nevis_ir.h
void CRCInput::set_rc_hw(void)
{
ir_protocol_t ir_protocol = IR_PROTOCOL_UNKNOWN;
unsigned int ir_address = 0x00;
switch(g_settings.remote_control_hardware)
{
case RC_HW_COOLSTREAM:
ir_protocol = IR_PROTOCOL_NECE;
ir_address = 0xFF80;
break;
case RC_HW_DBOX:
ir_protocol = IR_PROTOCOL_NRC17;
ir_address = 0x00C5;
break;
case RC_HW_PHILIPS:
ir_protocol = IR_PROTOCOL_RC5;
ir_address = 0x000A;
break;
case RC_HW_TRIPLEDRAGON:
ir_protocol = IR_PROTOCOL_RMAP_E;
ir_address = 0x000A; // with device id 0
// ir_address = 0x100A; // with device id 1
// ir_address = 0x200A; // with device id 2
// ir_address = 0x300A; // with device id 3
// ir_address = 0x400A; // with device id 4
// ir_address = 0x500A; // with device id 5
// ir_address = 0x600A; // with device id 6
// ir_address = 0x700A; // with device id 7
break;
default:
ir_protocol = IR_PROTOCOL_NECE;
ir_address = 0xFF80;
}
set_rc_hw(ir_protocol, ir_address);
}
#else
void CRCInput::set_rc_hw(void)
{
}
#endif

View File

@@ -32,11 +32,15 @@
#ifndef __MOD_rcinput__
#define __MOD_rcinput__
#include <config.h>
#include <linux/input.h>
#include <stdint.h>
#include <sys/types.h>
#include <string>
#include <vector>
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
#include <coolstream/nevis_ir.h>
#endif
#ifndef KEY_OK
#define KEY_OK 0x160
@@ -148,6 +152,9 @@ class CRCInput
int translate(int code, int num);
void calculateMaxFd(void);
int checkTimers();
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
void set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address);
#endif
public:
//rc-code definitions
static const neutrino_msg_t RC_Repeat = 0x0400;
@@ -242,6 +249,16 @@ class CRCInput
RC_nokey = 0xFFFFFFFE
};
//rc-hardware definitions
enum
{
RC_HW_COOLSTREAM = 0,
RC_HW_DBOX = 1,
RC_HW_PHILIPS = 2,
RC_HW_TRIPLEDRAGON = 3,
};
void set_rc_hw(void);
inline int getFileHandle(void) /* used for plugins (i.e. games) only */
{
return fd_rc[0];