コード例 #1
0
ファイル: drv_st2205.c プロジェクト: KP1533TM2/lcd4linux
static int drv_st2205_open(const char *section)
{
    char *dev;

    dev = cfg_get(section, "Port", NULL);
    if (dev == NULL || *dev == '\0') {
	error("st2205: no '%s.Port' entry from %s", section, cfg_source());
	return -1;
    }

    h = st2205_open(dev);
    if (h == NULL) {
	error("st2205: cannot open st2205 device %s", dev);
	return -1;
    }

    return 0;
}
コード例 #2
0
ファイル: test.c プロジェクト: guitimoteo/libst2205
int main(int argc, char **argv) {
    st2205_handle *h;
    char fn[1024];
    int y;
    if (argc<2) {
	printf("Usage: %s /dev/sdX pic.png\n",argv[0]);
	exit(0);
    }
    h=st2205_open(argv[1]);
    if (h==NULL) {
	printf("Open failed!\n");
	exit(1);
    }
    printf("Found device: %ix%i, %i bpp\n",h->width,h->height,h->bpp);

    y=sendpic(h,argv[2]);
    if (!y) {
        //p'rhaps a dir?
	DIR *dir;
	struct dirent *dp;
	char fn[2048];
	dir=opendir(argv[2]);
	if (dir==NULL) {
	    //Nope :/
	    printf("Couldn't open %s.\n",argv[2]);
	    exit(1);
	}
	while ((dp = readdir (dir)) != NULL) {
	    strcpy(fn,argv[2]);
	    strcat(fn,"/");
	    strcat(fn,dp->d_name);
	    sendpic(h,fn);
	}
    }
    
    
    st2205_close(h);
    printf("Test done.\n");
}
コード例 #3
0
ファイル: main.c プロジェクト: guitimoteo/libst2205
int main(int argc, char **argv) {
    st2205_handle *h;
    if (argc<2) {
	printf("Usage:\n");
	printf(" %s /dev/sdX [-upload] pic.png\n",argv[0]);
	printf("  sends a picture to the screen\n");
	printf(" %s /dev/sdX -backlight on|off\n",argv[0]);
	printf("  for backlight control\n");
	printf(" %s /dev/sdX -test pic.png\n",argv[0]);
	printf("  Test-mode: interactively find out values for the spec-file\n");
	exit(0);
    }

    h=st2205_open(argv[1]);
    if (h==NULL) {
	printf("Open failed!\n");
	exit(1);
    }
    printf("Found device: %ix%i, %i bpp\n",h->width,h->height,h->bpp);

    if (strcmp(argv[2],"-backlight")==0) {
	if (strcmp(argv[3],"off")==0) {
	    st2205_backlight(h, 0);
	} else if (strcmp(argv[3],"on")==0) {
    	    st2205_backlight(h, 1);
	}
    } else if (strcmp(argv[2],"-upload")==0) {
	sendthis(h,argv[3]);
    } else if (strcmp(argv[2],"-test")==0) {
	testpic(h,argv[3]);
    } else {
	//argument isn't recognized; try to send it as a file or dir.
	sendthis(h,argv[2]);
    }
    st2205_close(h);
    return(0);
}