static void plugin_backlight(RESULT * result, RESULT * arg1) { int bl_on; bl_on = (R2N(arg1) == 0 ? 0 : 1); st2205_backlight(h, bl_on); SetResult(&result, R_NUMBER, &bl_on); }
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); }