What Might Cause This To Fail?


el_pango

Member
Joined
May 31, 2006
Messages
145
Location
California
Hi,

In my code, I'm trying to do this:

Code:
	system("ofbset -fb /dev/fb1 -pos 0 0 -size 800 480 -mem 192000 -en 1 ");
	system("fbset -fb /dev/fb1 -g 400 240 400 240 16");
	
	fbdev 	= open("/dev/fb1", O_RDONLY);
	
	if(fbdev == -1) exit(2);
	
	scrn_ptr = mmap(0,400 * 240 * 2, PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, 0);

Unfortunately, mmap()ing doesn't work and leaves scrn_ptr as MAP_FAILED. What am I doing wrong here? Is this no longer supported?

Learned/stole ideas from http://pandorawiki.org/Kernel_interfacek
 
el_pango said:
Code:
	fbdev 	= open("/dev/fb1", O_RDONLY);
FWIW I'd try O_RDWR here unless its specified otherwise somewhere.
 
Last edited by a moderator:
urjaman said:
el_pango said:
Code:
	fbdev 	= open("/dev/fb1", O_RDONLY);
FWIW I'd try O_RDWR here unless its specified otherwise somewhere.
Yeah you've opening the framebuffer as readonly (O_RDONLY), but want to have it's memory writeable (PROT_WRITE).
 
Last edited by a moderator:
Back
Top