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 <sys/klog.h>
int do_syslog(char *msg)
{
return klogctl(11, msg, strlen(msg));
}
int main(int argc, char* argv[])
{
int fbfd = 0;
int vLoop, vLoop1;
void* buffer;
unsigned long request;
char dummy_struct[65536];
char* kmsg;
// 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;
sprintf(kmsg, "Testing request = 0x%00000000x\n", request);
do_syslog(kmsg);
memset(dummy_struct, 0, 1000);
if (ioctl(fbfd, request, &dummy_struct) != 0)
{
exit(2);
} else
{
sprintf(kmsg, "Data: 0x");
do_syslog(kmsg);
for (vLoop1 = 0; vLoop1 < 32; vLoop1++) {
sprintf(kmsg, "%0x", dummy_struct[vLoop1]);
do_syslog(kmsg);
}
sprintf(kmsg, "\n");
do_syslog(kmsg);
}
}
close(fbfd);
return 0;
}