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 Apr 3, 2020
1 parent 83420c8 commit 8c962b2
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions xbmc/windowing/rpi/RPIUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,60 @@ int CRPIUtils::AddUniqueResolution(RESOLUTION_INFO &res, std::vector<RESOLUTION_
return i;
}

#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 CRPIUtils::SetNativeResolution(const RESOLUTION_INFO res, EGLSurface m_nativeWindow)
{
if(!m_DllBcmHost || !m_nativeWindow)
return false;

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

DestroyDispmanxWindow();

RENDER_STEREO_MODE stereo_mode = CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode();
Expand Down

0 comments on commit 8c962b2

Please sign in to comment.