Talk:Current work
From ST2205u wiki
Backlight on/off
In main.c (st2205tool/setpic/main.c), replace int main() function with following function:
int main(int argc, char **argv) {
st2205_handle *h;
int y;
if (argc<2) {
printf("Usage: %s /dev/sdX pic.png [on|off]\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);
}
}
if (strcmp(argv[3],"off")==0) {
st2205_backlight(h, 0);
} else if (strcmp(argv[3],"on")==0) {
st2205_backlight(h, 1);
}
st2205_close(h);
return(0);
}
It works great here.
I'll incorporate a similar function the next revision :) -Sprite tm

