diff --git a/src/driver/fb_accel_arm.cpp b/src/driver/fb_accel_arm.cpp index 193f7f0f6..717f8a7b4 100644 --- a/src/driver/fb_accel_arm.cpp +++ b/src/driver/fb_accel_arm.cpp @@ -43,6 +43,8 @@ #include #endif +#include +#include #include #include @@ -327,13 +329,10 @@ void CFbAccelARM::setBlendMode(uint8_t mode) /* level = 100 -> transparent, level = 0 -> nontransparent */ void CFbAccelARM::setBlendLevel(int level) { - char tmp[3]={0x0}; - int _level = 0xff - ( level * 0xff / 100); - sprintf(tmp,"%d", _level); - int pfd = open("/proc/stb/video/alpha", O_WRONLY); - if (pfd) - write(pfd, tmp, sizeof(tmp)); - close(pfd); + char buf[16]; + int value = 255 - (level * 255 / 100); + int len = snprintf(buf, sizeof(buf), "%d", value); + proc_put("/proc/stb/video/alpha", buf, len); } int CFbAccelARM::setMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp) diff --git a/src/driver/fb_accel_mips.cpp b/src/driver/fb_accel_mips.cpp index ae331518c..7e39daba7 100644 --- a/src/driver/fb_accel_mips.cpp +++ b/src/driver/fb_accel_mips.cpp @@ -43,6 +43,8 @@ #include #endif +#include +#include #include #include @@ -328,13 +330,10 @@ void CFbAccelMIPS::setBlendMode(uint8_t mode) /* level = 100 -> transparent, level = 0 -> nontransparent */ void CFbAccelMIPS::setBlendLevel(int level) { - char tmp[3]={0x0}; - int _level = 0xff - ( level * 0xff / 100); - sprintf(tmp,"%d", _level); - int pfd = open("/proc/stb/video/alpha", O_WRONLY); - if (pfd) - write(pfd, tmp, sizeof(tmp)); - close(pfd); + char buf[16]; + int value = 255 - (level * 255 / 100); + int len = snprintf(buf, sizeof(buf), "%d", value); + proc_put("/proc/stb/video/alpha", buf, len); } int CFbAccelMIPS::setMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)