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

int main()
{
	const int fb_size = 480*272*2;
	int fd = ::open("/dev/fb0", O_RDWR);
	void *fbmem = ::mmap(0, fb_size, PROT_WRITE, MAP_SHARED, fd, 0);
	int fbout = ::open("./fb_dump", O_RDWR | O_CREAT);
	::write(fbout, fbmem, fb_size);
	::close(fbout);
	::munmap(fbmem, fb_size);
	::close(fd);
	printf("dumped contents of /dev/fb0 to ./fb_dump\n");
	return 0;
}


