Example #1
0
static int
camera_exit (Camera *camera, GPContext *context) 
{
	char buf[2];

	if (camera->pl != NULL) {
		buf[0] = '0' + camera->pl->syncdatetime;
		buf[1] = 0;
		gp_setting_set ("st2205", "syncdatetime", buf);
		gp_setting_set ("st2205", "orientation", orientation_to_string
						(camera->pl->orientation));
#ifdef HAVE_ICONV
		if (camera->pl->cd != (iconv_t) -1)
			iconv_close (camera->pl->cd);
#endif
		st2205_close (camera);
		free (camera->pl);
		camera->pl = NULL;
	}
	return GP_OK;
}
Example #2
0
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");
}
Example #3
0
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);
}
Example #4
0
static int drv_st2205_close(void)
{
    st2205_close(h);

    return 0;
}