int main(int argc, char **argv) { //irqInit(); irqEnable(IRQ_VBLANK); /* Setup logging console on top screen */ init_consoles(); print_to_debug("AirScan v1.0 by Raphael Rigo"); print_to_debug("released 07/11/2010"); print_to_debug(""); print_to_debug("B: Toggle OPN"); print_to_debug("A: Toggle WEP"); print_to_debug("X: Toggle WPA"); print_to_debug("Up/Down : scroll"); print_to_debug("Left/Right : Timeout -/+"); print_to_debug(""); print_to_debug("Initializing Wifi..."); Wifi_InitDefault(false); wardriving_loop(); return 0; }
int main(int argc, char *argv[]) { int fbdev,c,option_index; unsigned int alpha; struct fb_var_screeninfo var; /* Check which console we're running on */ init_consoles(); /* allocate our stream data structure */ mng = (mngstuff *) calloc(1, sizeof(*mng)); if (mng == NULL) { fprintf(stderr, "could not allocate stream structure.\n"); exit(0); } alpha = 100; mng->alpha = 100; mng->fbx = 15; mng->fby = 15; mng->background = NULL; while (1) { static struct option long_options[] = { {"help", 0, 0, 'h'}, {"verbose", 0, 0, 'v'}, {"alpha", 1, 0, 'a'}, {"buffered", 0, 0, 'b'}, {"signal", 0, 0, 's'}, {"delta", 0, 0, 'd'}, {"position", 0, 0, 'p'}, {"version", 0, 0, 'V'}, {"start-console",0,0,'S'}, {"console",1,0,'c'}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "a:x:y:bh?vsd:pVSc:", long_options, &option_index); if (c == -1) break; switch (c) { case 'a': alpha = atoi(optarg); if (alpha > 100) alpha = 100; mng->alpha = alpha; break; case 'x': mng->fbx = atoi(optarg); break; case 'y': mng->fby = atoi(optarg); break; case 'd': delta = atoi(optarg); break; case '?': case 'h': usage(argv[0]); exit(0); case 'v': verbose = 1; break; case 's': waitsignal = 1; break; case 'b': buffered = 1; break; case 'p': dynpos = 1; break; case 'V': version(); exit(0); case 'c': start_console=atoi(optarg); case 'S': sconly=1; break; default: break; } } if (optind >= argc) { printf("Which files do you want to play?\n"); exit(0); } //init_consoles(); /* Initialize framebuffer */ fbdev = open("/dev/fb0", O_RDWR); if (fbdev < 0) { fprintf(stderr, "error while opening framebuffer.\n"); exit(fbdev); } ioctl(fbdev, FBIOGET_VSCREENINFO, &var); mng->fbwidth = var.xres; mng->fbheight = var.yres; mng->fbbpp = var.bits_per_pixel; mng->display = mmap(NULL, var.xres * var.yres * (var.bits_per_pixel >> 3), PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, 0); /* arrange to call the shutdown routine before we exit */ atexit(&cleanup); while (optind < argc) { // leftover arguements are filenames. mng->filename = argv[optind++]; /* set up the mng decoder for our stream */ mng->mng = mng_initialize(mng, mngalloc, mngfree, MNG_NULL); if (mng->mng == MNG_NULL) { fprintf(stderr, "could not initialize libmng.\n"); exit(1); } /* set the callbacks */ mng_setcb_errorproc(mng->mng, mngerror); mng_setcb_openstream(mng->mng, mngopenstream); mng_setcb_closestream(mng->mng, mngclosestream); mng_setcb_readdata(mng->mng, mngreadstream); mng_setcb_gettickcount(mng->mng, mnggetticks); mng_setcb_settimer(mng->mng, mngsettimer); mng_setcb_processheader(mng->mng, mngprocessheader); mng_setcb_getcanvasline(mng->mng, mnggetcanvasline); mng_setcb_refresh(mng->mng, mngrefresh); /* FIXME: should check for errors here */ signal(SIGINT, sigint_handler); signal(SIGTERM, sigterm_handler); mng_readdisplay(mng->mng); /* loop though the frames */ while (mng->delay && run) { mdelay(mng->delay); mng->delay = 0; mng_display_resume(mng->mng); if (run == 2) { if (mng->alpha == 0) run = 0; mng->alpha -= delta; if (mng->alpha < 0) mng->alpha = 0; } } if (waitsignal && optind < argc) { signal(SIGUSR1, sigusr1_handler); run = 1; while (run) { sleep(2); } } memset(mng->copybuffer, 0, 4 * mng->width * mng->height); run = 1; mng->alpha = alpha; if (optind == argc) { /* last file */ restore_area(); } } /* cleanup and quit */ return mngquit(mng->mng); }
int main(int argc, char *argv[]) { int fbdev,c,option_index; unsigned int alpha; struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; /* Check which console we're running on */ init_consoles(); alpha = 100; while (1) { static struct option long_options[] = { {"help", 0, 0, 'h'}, {"verbose", 0, 0, 'v'}, {"alpha", 1, 0, 'a'}, {"version", 0, 0, 'V'}, {"start-console",0,0,'S'}, {"size",1,0,'s'}, {"console",1,0,'c'}, {"font",1,0,'f'}, {"textcolor",1,0,'t'}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "a:x:y:h?vVSc:f:t:s:", long_options, &option_index); if (c == -1) break; switch (c) { case 'a': alpha = atoi(optarg); if (alpha > 100) alpha = 100; break; case 'x': fbxpos = atoi(optarg); break; case 'y': fbypos = atoi(optarg); break; case '?': case 'h': usage(argv[0]); exit(0); case 'v': verbose = 1; break; case 'V': version(); exit(0); case 'c': start_console=atoi(optarg)-1; case 'S': sconly=1; break; case 'f': strict_font=1; font=strdup(optarg); break; case 't': fgcolor=strtol(optarg, NULL, 16); break; case 's': fontsize=strtol(optarg, NULL, 10); break; default: break; } } if (optind >= argc) { printf("No text\n"); exit(0); } /* Initialize framebuffer */ fbdev = open("/dev/fb/0", O_RDWR); if (fbdev < 0) { fbdev = open("/dev/fb0", O_RDWR); if (fbdev < 0) { fprintf(stderr, "error while opening framebuffer.\n"); exit(fbdev); } } ioctl(fbdev, FBIOGET_VSCREENINFO, &var); fbbytes = var.bits_per_pixel>>3; fbx=var.xres; fby=var.yres; ioctl(fbdev, FBIOGET_FSCREENINFO, &fix); fblinelen = fix.line_length; framebuffer = mmap(NULL, fblinelen* fby , PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, var.yoffset * fblinelen); rendertext (argv[optind], font, fontsize, fgcolor); return 0; }
int main(int argc, char *argv[]) { char textstr[4096]; char ** line; int * len; int lines; int i; int fbdev,c,option_index; unsigned int alpha; ssize_t read(int fd, void *buf, size_t count); struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; /* Initialize consoles */ init_consoles(); alpha = 100; while (1) { static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, {"info", no_argument, 0, 'i'}, {"zygote", no_argument, 0, 'z'}, {"power", no_argument, 0, 'p'}, {"clear", no_argument, 0, 'c'}, {"brightness", required_argument, 0, 'b'}, {"boxwidth", required_argument, 0, 'w'}, {"font", required_argument, 0, 'f'}, {"size", required_argument, 0, 's'}, {"textcolor", required_argument, 0, 't'}, {"alpha", required_argument, 0, 'a'}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, ":x:y:h?Vizpcb:w:f:s:t:a:", long_options, &option_index); if (c == -1) break; switch (c) { case 'x': fbxpos = atoi(optarg); break; case 'y': fbypos = atoi(optarg); break; case '?': case 'h': usage(argv[0]); exit(0); case 'V': version(); exit(0); case 'i': display_info(); exit(0); case 'z': if (optind >= argc) { printf("No text\n"); exit(0); } printf("Zygote Mode.\n"); printf("Waiting for display to sleep...\n"); wait_sleep(); power_display(); set_brightness(brightness,blen); wait_wake(); clear_display(); break; case 'p': power_key(); exit(0); case 'c': clear_display(); printf("Device display cleared.\n"); exit(0); case 'b': brightness = atoi(optarg); if (brightness > 100 && brightness <= 255 ) { blen = 3; } else if (brightness <= 99 && brightness >= 10 ) { blen = 2; } else if (brightness <= 9 && brightness >= 0 ) { blen = 1; } break; case 'w': boxwidth = atoi(optarg); break; case 'f': strict_font=1; font=strdup(optarg); break; case 's': fontsize=strtol(optarg, NULL, 10); break; case 't': if (strlen(optarg) != 6) { printf("Invalid color!\n"); exit(0); } fontcolor=strtol(optarg, NULL, 16); break; case 'a': alpha = atoi(optarg); if (alpha > 100) alpha = 100; break; default: break; } } if (optind >= argc) { printf("No text\n"); exit(0); } // Power on display power_display(); // Set the brightness set_brightness(brightness,blen); // Initialize framebuffer fbdev = open("/dev/graphics/fb0", O_RDWR); if (fbdev < 0) { fprintf(stderr, "Error opening framebuffer on device.\n"); exit(fbdev); } ioctl(fbdev, FBIOGET_VSCREENINFO, &var); fbbytes = var.bits_per_pixel>>3; fbx=var.xres; fby=var.yres; ioctl(fbdev, FBIOGET_FSCREENINFO, &fix); fblinelen = fix.line_length; fbyposoff = fbypos; lines = strwrap(argv[optind], boxwidth, &line, &len); for (i = 0; i < lines; i++) { if (i > 0) { fbypos += fontsize; } if (fbypos + fontsize >= fby - fbyposoff) { exit(0); } strncpy(textstr, line[i], len[i]); textstr[len[i]] = '\0'; //printf("%4d |%-*s|\n", len[i], boxwidth, argv[optind]); framebuffer = mmap(NULL, fblinelen* fby , PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, var.yoffset * fblinelen); rendertext (("%s", len[i], boxwidth, textstr), font, fontsize, reverse(fontcolor)); } free(line); free(len); return 0; }