patch to fix OSD Font Problems with VDR-1.5.3 and fix kill VDR by call the plugin on OSD based on fix, found on linuxtv ML Joerg Bornkessel 03 Jul 2007 diff -Naur sysinfo-0.1.0a.orig/sysinfoosd.c sysinfo-0.1.0a/sysinfoosd.c --- sysinfo-0.1.0a.orig/sysinfoosd.c 2007-07-03 23:48:48.943355433 +0200 +++ sysinfo-0.1.0a/sysinfoosd.c 2007-07-03 23:51:42.181449172 +0200 @@ -81,7 +81,11 @@ int iHalfWidth = (int)(iWidth/2); int iHalfHeight = (int)(iHeight/2); asprintf(&cTemp, tr("PLEASE WAIT...")); +#if VDRVERSNUM >=10503 + osd->DrawText(iHalfWidth-100, iHalfHeight-20, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); +#else osd->DrawText(iHalfWidth-100, iHalfHeight-20, cTemp, pal[3],pal[1],font); +#endif free (cTemp); DisplayBitmap(); } @@ -140,15 +144,39 @@ osd->DrawRectangle(iWidth-129, 0, 2, 33, pal[2]); // Draw test asprintf(&cTemp, "SysInfo %s", VERSION); +#if VDRVERSNUM >=10503 + osd->DrawText(10, 3, cTemp, pal[2],pal[3],cFont::GetFont(fontOsd)); + free (cTemp); + osd->DrawText(iWidth-120, 3, "by Kikko77", pal[2],pal[3],cFont::GetFont(fontOsd)); +#else osd->DrawText(10, 3, cTemp, pal[2],pal[3],font); free (cTemp); osd->DrawText(iWidth-120, 3, "by Kikko77", pal[2],pal[3],font); +#endif } void cSysInfoOsd::SensorData(int iTop) { // Temperature char cTemp[100]; // 2DO sprintf(cTemp, tr("CPU temperature:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + sprintf(cTemp, tr("M/B temperature:")); + osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh cputemp", cTemp); + osd->DrawText(270, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh mbtemp", cTemp); + osd->DrawText(270, iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + // Fan rpm + sprintf(cTemp, tr("Fan1:")); + osd->DrawText(((iWidth/2)+20), iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + sprintf(cTemp, tr("Fan2:")); + osd->DrawText(((iWidth/2)+20), iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh cpufan", cTemp); + osd->DrawText(((iWidth/2)+170), iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh mbfan", cTemp); + osd->DrawText(((iWidth/2)+170), iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); +#else osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],font); sprintf(cTemp, tr("M/B temperature:")); osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],font); @@ -165,6 +193,7 @@ osd->DrawText(((iWidth/2)+170), iTop+10, cTemp, pal[3],pal[1],font); ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh mbfan", cTemp); osd->DrawText(((iWidth/2)+170), iTop+40, cTemp, pal[3],pal[1],font); +#endif // Draw line separator osd->DrawRectangle(iTop+74, 0, iWidth, 1, pal[2]); } @@ -173,9 +202,15 @@ void cSysInfoOsd::VideoSpace(int iTop) { char cTemp[100]; // 2DO sprintf(cTemp, tr("Video disk free space:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh vidspace", cTemp); + osd->DrawText(285, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); +#else osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],font); ExecShellCmd("/usr/share/vdr/sysinfo/sysinfo.sh vidspace", cTemp); osd->DrawText(285, iTop+10, cTemp, pal[3],pal[1],font); +#endif // Draw line separator osd->DrawRectangle(iTop+46, 0, iWidth, 1, pal[2]); } @@ -184,6 +219,22 @@ char cTemp[100]; // 2DO sprintf(cTemp, tr("Linux kernel:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, 40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + sprintf(cTemp, tr("CPU type:")); + osd->DrawText(15, 70, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + // Kernel and cpu type + ExecShellCmd("uname -r", cTemp); + osd->DrawText(160, iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("cat /proc/cpuinfo | grep 'processor' |grep '1'", cTemp); + if (cTemp[0]=='\0') { + ExecShellCmd("cat /proc/cpuinfo | grep 'model name' | cut -c 14-58 | uniq", cTemp); + osd->DrawText(160, iTop+70, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + } else { + ExecShellCmd("cat /proc/cpuinfo | grep 'model name' | cut -c 14-58 | uniq", cTemp); + osd->DrawText(160, iTop+70, "2 x ", pal[3],pal[1],cFont::GetFont(fontOsd)); + osd->DrawText(200, iTop+70, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); +#else osd->DrawText(15, 40, cTemp, pal[3],pal[1],font); sprintf(cTemp, tr("CPU type:")); osd->DrawText(15, 70, cTemp, pal[3],pal[1],font); @@ -198,6 +249,7 @@ ExecShellCmd("cat /proc/cpuinfo | grep 'model name' | cut -c 14-58 | uniq", cTemp); osd->DrawText(160, iTop+70, "2 x ", pal[3],pal[1],font); osd->DrawText(200, iTop+70, cTemp, pal[3],pal[1],font); +#endif } // Draw line separator osd->DrawRectangle(iTop+104, 0, iWidth, 1, pal[2]); @@ -214,10 +266,17 @@ // Cpu Speed sprintf(cTemp, tr("CPU speed:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("cat /proc/cpuinfo | grep 'cpu MHz' | cut -c 12-60", cTemp); + asprintf(&cTmp, "%d MHz", atoi(cTemp)); + osd->DrawText(190, iTop+10, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 110, 0, taRight); +#else osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],font); ExecShellCmd("cat /proc/cpuinfo | grep 'cpu MHz' | cut -c 12-60", cTemp); asprintf(&cTmp, "%d MHz", atoi(cTemp)); osd->DrawText(190, iTop+10, cTmp, pal[3],pal[1],font, 110, 0, taRight); +#endif free(cTmp); // Calculate cpu free @@ -226,16 +285,28 @@ iPerCentCpu=atoi(cTemp); if (iPerCentCpu>100) iPerCentCpu=100; sprintf(cTemp, tr("CPU used:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + asprintf(&cTmp, "%d%%", iPerCentCpu); + osd->DrawText(215, iTop+40, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 85, 0, taRight); +#else osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],font); asprintf(&cTmp, "%d%%", iPerCentCpu); osd->DrawText(215, iTop+40, cTmp, pal[3],pal[1],font, 85, 0, taRight); +#endif free(cTmp); // CPU free sprintf(cTemp, tr("CPU free:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+70, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + asprintf(&cTmp, "%d%%", 100-iPerCentCpu); + osd->DrawText(215, iTop+70, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 85, 0, taRight); +#else osd->DrawText(15, iTop+70, cTemp, pal[3],pal[1],font); asprintf(&cTmp, "%d%%", 100-iPerCentCpu); osd->DrawText(215, iTop+70, cTmp, pal[3],pal[1],font, 85, 0, taRight); +#endif free(cTmp); // Cpu Graph @@ -259,30 +330,55 @@ // total memory sprintf(cTemp, tr("Total memory:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("cat /proc/meminfo | grep -i 'MEMTOTAL' | cut -c 16-23 | tr -d ' '", cTemp); + dTemp=atof(cTemp); + int iMemTotal=(int)(dTemp/1024); + asprintf(&cTmp, "%d MB", iMemTotal); + osd->DrawText(215, iTop+10, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 85, 0, taRight); +#else osd->DrawText(15, iTop+10, cTemp, pal[3],pal[1],font); ExecShellCmd("cat /proc/meminfo | grep -i 'MEMTOTAL' | cut -c 16-23 | tr -d ' '", cTemp); dTemp=atof(cTemp); int iMemTotal=(int)(dTemp/1024); asprintf(&cTmp, "%d MB", iMemTotal); osd->DrawText(215, iTop+10, cTmp, pal[3],pal[1],font, 85, 0, taRight); +#endif free(cTmp); // Free memory sprintf(cTemp, tr("Free memory:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + ExecShellCmd("cat /proc/meminfo | grep -i 'MEMFREE' | cut -c 16-23 | tr -d ' '", cTemp); + dTemp=atof(cTemp); + int iMemFree=(int)(dTemp/1024); + asprintf(&cTmp, "%d MB", iMemFree); + osd->DrawText(215, iTop+40, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 85, 0, taRight); +#else osd->DrawText(15, iTop+40, cTemp, pal[3],pal[1],font); ExecShellCmd("cat /proc/meminfo | grep -i 'MEMFREE' | cut -c 16-23 | tr -d ' '", cTemp); dTemp=atof(cTemp); int iMemFree=(int)(dTemp/1024); asprintf(&cTmp, "%d MB", iMemFree); osd->DrawText(215, iTop+40, cTmp, pal[3],pal[1],font, 85, 0, taRight); +#endif free(cTmp); // Used memory sprintf(cTemp, tr("Used memory:")); +#if VDRVERSNUM >=10503 + osd->DrawText(15, iTop+70, cTemp, pal[3],pal[1],cFont::GetFont(fontOsd)); + int iMemUsed=iMemTotal-iMemFree; + asprintf(&cTmp, "%d MB", iMemUsed); + osd->DrawText(215, iTop+70, cTmp, pal[3],pal[1],cFont::GetFont(fontOsd), 85, 0, taRight); +#else osd->DrawText(15, iTop+70, cTemp, pal[3],pal[1],font); int iMemUsed=iMemTotal-iMemFree; asprintf(&cTmp, "%d MB", iMemUsed); osd->DrawText(215, iTop+70, cTmp, pal[3],pal[1],font, 85, 0, taRight); +#endif free(cTmp); // Mem Graph @@ -336,7 +432,11 @@ //static const cFont *font = cFont::GetFont(fontOsd); char *cTmp; asprintf(&cTmp, "%d %%", iValue); +#if VDRVERSNUM >=10503 + osd->DrawText(iTextLeft, iTextTop, cTmp, pal[3], pal[2], cFont::GetFont(fontOsd)); +#else osd->DrawText(iTextLeft, iTextTop, cTmp, pal[3], pal[2], font); +#endif free(cTmp); //oProgressOsd->DrawText(iTextLeft, iTextTop, cTemp, pal[3], pal[2], font); diff -Naur sysinfo-0.1.0a.orig/sysinfoosd.h sysinfo-0.1.0a/sysinfoosd.h --- sysinfo-0.1.0a.orig/sysinfoosd.h 2007-07-03 23:48:48.963354060 +0200 +++ sysinfo-0.1.0a/sysinfoosd.h 2007-07-03 23:49:21.531115750 +0200 @@ -5,8 +5,10 @@ #include #include +#if VDRVERSNUM <10503 static const cFont *font = cFont::GetFont(fontOsd); static const int LINEHEIGHT = font->Height(); +#endif #define NBLINES 4 class cSysInfoOsd : public cThread, public cOsdObject {