Hello,
I have a preliminary application I'm building using DirectFB. It is
intended for a kiosk system, running on a Via epia/epia-m type board.
Everything is coming together quite smoothly except for a problem I'm
having with input loss. Basically what happens is periodically, it no
longer responds to input. I have taken the program through memory
checkers and all that, there are no leaks. The system is still
responsive via ssh and all that, the application's status is sleeping,
but it does nothing, will not respond. If I kill it, the last frame
stays on the screen, forcing me to reboot the machine. It is currently
only using the vesafb, but I'm not doing anything requiring much. I've
included the main function for your review, it is preliminary as the
device will end up having a touch screen instead of keyboard input,
however it is a little worrisome that it keeps doing this. When I build
the app without DirectFB and run it through its paces text only,
everything is fine, I never loose input and nothing crashes, and again
using tools like valgrind there are no leaks. Any ideas?
int main(int argc, char *argv[])
{
if(setupMySQL() == 1)
{
printf("SQL Setup Error!\n");
return -1;
}
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb,DFSCL_EXCLUSIVE));//
DFSCL_FULLSCREEN ?));
DFBCHECK (dfb->SetVideoMode(dfb,1024,768,16));
dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
dsc.width = 1024;
dsc.height = 768;
// Surface Creation
DFBCHECK (dfb->CreateSurface(dfb, &dsc, &primary));
DFBCHECK (primary->GetSize(primary, &screen_width, &screen_height));
DFBCHECK
(primary->SetBlittingFlags(primary,DSBLIT_BLEND_ALPHACHANNEL));
// Event Handlers
DFBCHECK (dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard));
DFBCHECK (dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse));
DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer));
DFBCHECK (mouse->AttachEventBuffer(mouse,buffer));
SetupFonts();
int quit = 0;
int menu = 1;
int scroll = 1;
drawMainMenu(1);
while(!quit)
{
DFBInputEvent event;
buffer->WaitForEvent(buffer);
while ( buffer->GetEvent(buffer, DFB_EVENT(&event)) == DFB_OK)
{
if(event.type == DIET_KEYPRESS)
{
printf("KEY pressed event\n");
if(event.key_id == DIKI_ESCAPE || event.key_id ==
DIKI_Q)
{
ReleaseGovenorInfo();
quit = 1;
}
else if(menu == 1) // at main menu
{
switch(event.key_id)
{
case DIKI_G:
govenor_id = 26;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_H:
govenor_id = 25;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_K:
govenor_id = 24;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_1:
govenor_id = 1;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_2:
govenor_id = 2;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_3:
govenor_id = 3;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_4:
govenor_id = 4;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_5:
govenor_id = 5;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_6:
govenor_id = 6;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_7:
govenor_id = 7;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_8:
govenor_id = 8;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_9:
govenor_id = 9;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
case DIKI_0:
govenor_id = 13;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
default:
govenor_id = 1;
if(last_gov_id != govenor_id)
{
last_gov_id = govenor_id;
ReleaseGovenorInfo();
GetGovenorInfo();
}
break;
}
scroll = 1;
menu = 0;
drawGovenorScreen(scroll);
}
else if(menu == 0 )
{
if(event.key_id == DIKI_M)
{
menu = 1;
scroll = 1;
drawMainMenu(1);
}
}
}
else if(event.type == DIET_KEYRELEASE)
{
printf("KEY released event\n");
}
else
printf("Unknown event\n");
}
}
ReleaseFonts();
keyboard->Release(keyboard);
mouse->Release(keyboard);
buffer->Release(buffer);
primary->Release(primary);
dfb->Release(dfb);
mysql_close(&Conn);
return 0;
}
--
Nathanael D. Noblet
Gnat Solutions, Inc
http://www.gnat.ca/
T 250.385.4613
C 250.383.4613
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users