示例#1
0
// hint: ir_protocol_t and other useful things are defined in cs_ir_generic.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);
}
示例#2
0
/*********************************************************************************
*	Constructor - opens rc-input device, selects rc-hardware and starts threads
*
*********************************************************************************/
CRCInput::CRCInput()
{
	timerid= 1;
#ifdef EVOLUX
	repeatkeys = NULL;
#endif

	// pipe for internal event-queue
	// -----------------------------
	if (pipe(fd_pipe_high_priority) < 0)
	{
		perror("fd_pipe_high_priority");
		exit(-1);
	}

	fcntl(fd_pipe_high_priority[0], F_SETFL, O_NONBLOCK );
	fcntl(fd_pipe_high_priority[1], F_SETFL, O_NONBLOCK );

	if (pipe(fd_pipe_low_priority) < 0)
	{
		perror("fd_pipe_low_priority");
		exit(-1);
	}

	fcntl(fd_pipe_low_priority[0], F_SETFL, O_NONBLOCK );
	fcntl(fd_pipe_low_priority[1], F_SETFL, O_NONBLOCK );


	// open event-library
	// -----------------------------
	fd_event = 0;

	//network-setup
	struct sockaddr_un servaddr;
	int    clilen;
	memset(&servaddr, 0, sizeof(struct sockaddr_un));
	servaddr.sun_family = AF_UNIX;
	strcpy(servaddr.sun_path, NEUTRINO_UDS_NAME);
	clilen = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path);
	unlink(NEUTRINO_UDS_NAME);

	//network-setup
	if ((fd_event = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
	{
		perror("[neutrino] socket\n");
	}

	if ( bind(fd_event, (struct sockaddr*) &servaddr, clilen) <0 )
	{
		perror("[neutrino] bind failed...\n");
		exit(-1);
	}


	if (listen(fd_event, 15) !=0)
	{
		perror("[neutrino] listen failed...\n");
		exit( -1 );
	}

	for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++)
	{
		fd_rc[i] = -1;
	}
	clickfd = -1;
	repeat_block = repeat_block_generic = 0;
	open();
	rc_last_key =  KEY_MAX;

	//select and setup remote control hardware
	set_rc_hw();
}