Beispiel #1
0
int eDVBCIInterfaces::setInputSource(int tuner_no, data_source source)
{
//	eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
//	eDebug("eDVBCIInterfaces::setInputSource(%d %d)", tuner_no, (int)source);
	if (getNumOfSlots() > 1) // FIXME .. we force DM8000 when more than one CI Slot is avail
	{
		char buf[64];
		snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/input%d").c_str(), tuner_no);

		FILE *input=0;
		if((input = fopen(buf, "wb")) == NULL) {
			eDebug("cannot open %s", buf);
			return 0;
		}

		if (tuner_no > 3)
			eDebug("setInputSource(%d, %d) failed... dm8000 just have four inputs", tuner_no, (int)source);

		switch(source)
		{
			case CI_A:
				fprintf(input, "CI0");
				break;
			case CI_B:
				fprintf(input, "CI1");
				break;
			case CI_C:
				fprintf(input, "CI2");
			break;
			case CI_D:
				fprintf(input, "CI3");
				break;
			case TUNER_A:
				fprintf(input, "A");
				break;
			case TUNER_B:
				fprintf(input, "B");
				break;
			case TUNER_C:
				fprintf(input, "C");
				break;
			case TUNER_D:
				fprintf(input, "D");
				break;
			default:
				eDebug("setInputSource for input %d failed!!!\n", (int)source);
				break;
		}

		fclose(input);
	}
	else  // DM7025
	{
		char buf[64];
		snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/input%d").c_str(), tuner_no);

		if (tuner_no > 1)
			eDebug("setInputSource(%d, %d) failed... dm7025 just have two inputs", tuner_no, (int)source);

		FILE *input=0;
		if((input = fopen(buf, "wb")) == NULL) {
			eDebug("cannot open %s", buf);
			return 0;
		}

		switch(source)
		{
			case CI_A:
				fprintf(input, "CI");
				break;
			case TUNER_A:
				fprintf(input, "A");
				break;
			case TUNER_B:
				fprintf(input, "B");
				break;
			default:
				eDebug("setInputSource for input %d failed!!!\n", (int)source);
				break;
		}

		fclose(input);
	}
	eDebug("eDVBCIInterfaces->setInputSource(%d, %d)", tuner_no, (int)source);
	return 0;
}
Beispiel #2
0
int eDVBCIInterfaces::setInputSource(int tuner_no, data_source source)
{
//	eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
//	eDebug("eDVBCIInterfaces::setInputSource(%d %d)", tuner_no, (int)source);
	if (getNumOfSlots() > 1) // FIXME .. we force DM8000 when more than one CI Slot is avail
	{
		char buf[64];
		snprintf(buf, 64, "/proc/stb/tsmux/input%d", tuner_no);
		char *srcCI = NULL;

		FILE *input=0;
		if((input = fopen(buf, "wb")) == NULL) {
			eDebug("cannot open %s", buf);
			return 0;
		}

		if (tuner_no > 3)
			eDebug("setInputSource(%d, %d) failed... dm8000 just have four inputs", tuner_no, (int)source);

		switch(source)
		{
			case CI_A:
				fprintf(input, "CI0");
				break;
			case CI_B:
				fprintf(input, "CI1");
				break;
			case CI_C:
				fprintf(input, "CI2");
			break;
			case CI_D:
				fprintf(input, "CI3");
				break;
#ifdef TUNER_DM7080
			case TUNER_A:
			case TUNER_B:
			case TUNER_C:
			case TUNER_D:
				srcCI = readInputCI("/proc/bus/nim_sockets", source);
				if (srcCI)
				{
					fprintf(input, srcCI);
					free(srcCI);
				}
				break;
#else
			case TUNER_A:
				fprintf(input, "A");
				break;
			case TUNER_B:
				fprintf(input, "B");
				break;
			case TUNER_C:
				fprintf(input, "C");
				break;
			case TUNER_D:
				fprintf(input, "D");
				break;
#endif
			default:
				eDebug("setInputSource for input %d failed!!!\n", (int)source);
				break;
		}

		fclose(input);
	}
	else  // DM7025
	{
		char buf[64];
		snprintf(buf, 64, "/proc/stb/tsmux/input%d", tuner_no);

		if (tuner_no > 1)
			eDebug("setInputSource(%d, %d) failed... dm7025 just have two inputs", tuner_no, (int)source);

		FILE *input=0;
		if((input = fopen(buf, "wb")) == NULL) {
			eDebug("cannot open %s", buf);
			return 0;
		}

		switch(source)
		{
			case CI_A:
				fprintf(input, "CI");
				break;
			case TUNER_A:
				fprintf(input, "A");
				break;
			case TUNER_B:
				fprintf(input, "B");
				break;
			default:
				eDebug("setInputSource for input %d failed!!!\n", (int)source);
				break;
		}

		fclose(input);
	}
	eDebug("eDVBCIInterfaces->setInputSource(%d, %d)", tuner_no, (int)source);
	return 0;
}