⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 dgstation relook 400 sample code to run shared plugin process in background.
💻 C
字号:
// Signal Popup for Relook400// Charles Putney// 18 Quinns Road// Shankill, Co. Dublin// IRELAND//// Change History//// 24-01-2008//#include <stdio.h>#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <time.h>#include "fb_8bpp/fb.h"#include "fb_8bpp/gtools.h"#include "event.h"#include "SignalPopup.h"// global frame bufferfb_t fb;/* * main function for this plugin * * argument is same with main function. I think you already know about this... * * in this function, you should process all event and control all of * other hardware(framebuffer, demux, tuner, front panel, ...). * main application does nothing while this function is running. * * return value... hum... 0 is successful. and otherwise maybe failed... * but, I don`t know it will be used... * */int plugin_main( int argc, char **argv ){	char *fbdev = "/dev/fb/1";	int a;	int setpallete = 0;	int ret;//	char msg[100];//	int telnet_output = open("/dev/pts/0",O_WRONLY);//	sprintf(msg,"Starting main.c in plugin \n"); write(telnet_output,msg,strlen(msg));	/* parse some arguments */	for( a=1; a<argc; a++ )	{		if( !strcmp(argv[a],"--dev") && a+1<argc )		{			fbdev = argv[a+1];			a++;			continue;		}		if( !strcmp(argv[a],"--setpallete") )		{			setpallete = 1;			continue;		}	}	/* initialize random */	srandom( time(NULL) );	/* initialize module */	fb = fb_open( T_FB, 0, 0, fbdev );	if( fb < 0 )	{		fprintf( stderr, "fb_open failed.\n" );		return -1;	}	if( setpallete )	{		unsigned char a[256];		unsigned char r[256];		unsigned char g[256];		unsigned char b[256];		int i;		for( i=0; i<256; i++ )		{			a[i] = random()%256;			r[i] = random()%256;			g[i] = random()%256;			b[i] = random()%256;		}		fb_set_palette( fb, 16, a, r, g, b, 256-16 );	}//	sprintf(msg,"Initialising Plugin event \n"); write(telnet_output,msg,strlen(msg));	if( plugin_event_init( "/dev/input/event0" ) < 0 )	{//		sprintf(msg,"Plugin did not start \n"); write(telnet_output,msg,strlen(msg));		goto failed;	}	/* initialize internal module *///	sprintf(msg,"Initialising Plugin module \n"); write(telnet_output,msg,strlen(msg));	if( plugin_msg_init() >= 0 )	{		int code, value;		ret = 0;		while( ret >= 0 )		{			code = value = 0;			if( plugin_event_read( &code, &value ) >= 0 )  // was plugin_event_read_nowait( &code, &value )				printf( "%d %d\n", code, value );			ret = plugin_msg_handler( 0, code, value );		}		plugin_msg_cleanup();	}	plugin_event_cleanup();failed:	/* clean fb */	fb_close( fb );	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -