Skip to content

Commit

Permalink
[rbp] hack: wait for splash to complete before changing hdmi mode
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed May 18, 2015
1 parent 8995b3c commit e63b9d0
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
Expand Up @@ -214,12 +214,61 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve
}
#endif

#include <dirent.h>

pid_t proc_find(const char* name)
{
DIR* dir;
struct dirent* ent;
char buf[512];

long pid;
char pname[100] = {0,};
char state;
FILE *fp=NULL;

if (!(dir = opendir("/proc"))) {
perror("can't open /proc");
return -1;
}

while((ent = readdir(dir)) != NULL) {
long lpid = atol(ent->d_name);
if(lpid < 0)
continue;
snprintf(buf, sizeof(buf), "/proc/%ld/stat", lpid);
fp = fopen(buf, "r");

if (fp) {
if ( (fscanf(fp, "%ld (%[^)]) %c", &pid, pname, &state)) != 3 ){
printf("fscanf failed \n");
fclose(fp);
closedir(dir);
return -1;
}
if (!strcmp(pname, name)) {
fclose(fp);
closedir(dir);
return (pid_t)lpid;
}
fclose(fp);
}
}

closedir(dir);
return -1;
}


bool CEGLNativeTypeRaspberryPI::SetNativeResolution(const RESOLUTION_INFO &res)
{
#if defined(TARGET_RASPBERRY_PI)
if(!m_DllBcmHost || !m_nativeWindow)
return false;

while (proc_find("hello_video.bin") >= 0)
Sleep(100);

DestroyDispmaxWindow();

if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags))
Expand Down

0 comments on commit e63b9d0

Please sign in to comment.