All pastes #608791 Raw Edit

Anonym

public text v1 · immutable
·published 2007-07-08 14:29 UTC
rendered paste body


#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
#include <signal.h>
#include <string.h>
#include <sys/ioctl.h>

#include "stioctl.h"

    int main(int argc, char* argv[])
    {
        int fbfd = 0;
        int vLoop, vLoop1;
	void* buffer;
	unsigned long request;
	char dummy_struct[65536];

        // Open the file for reading and writing
        fbfd = open("/dev/stapi/stlayer_ioctl", O_RDWR);
        if (!fbfd) {
            printf("Error: cannot open stlayer device.\n");
            exit(1);
        }
        printf("The stlayer device was opened successfully.\n");

	for (vLoop = 0x00002900; vLoop < 0x0000FFFF; vLoop++)
	{	
	   request = vLoop;
	   printf("Testing request = 0x%00000000x\n", request);
           memset(dummy_struct, 0, 1000); 
           if (ioctl(fbfd, request, &dummy_struct) != 0) 
           {
              exit(2);
           } else
           {
              printf("Data: 0x");
              for (vLoop1 = 0; vLoop1 < 32; vLoop1++)
                  printf("%0x", dummy_struct[vLoop1]);
	      printf("\n");
	   }
	}

        close(fbfd);
        return 0;
    }