源码下载: fbplasma.tgz
离线


离线
M9 直接写屏红绿蓝
编译指令: arm-none-linux-gnueabi-gcc main.c -o test -static
#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define screen_height 960
#define screen_width 640
int main(void)
{
    int devfb0;
    unsigned char * fb0;
    unsigned char * framebuff;
    int i, j;
    printf("starting... ... !n");
   
    devfb0 = open("/dev/fb0", O_RDWR);
    fb0 = (char *) mmap(0, 960*640*4, PROT_READ | PROT_WRITE, MAP_SHARED, devfb0, 0);
    if ( (int) fb0 == -1)
    {
        printf ("Error: failed to map framebuffer device to memory.\n");
        exit (2);
    }
    else
    {
        printf ("The framebuffer device was mapped to memory successfully.\n");
    }
    while(1)
    {
        framebuff = fb0;
        //printf("AAAAAA........3333..............\n");
        for (i = 0; i < screen_height; ++i)
        {
         
          for (j = 0; j < screen_width; ++j)
            {
     
              /* magic transformation: color index to RGB24 */
              *framebuff ++ = 0x00;        /* blue */
              *framebuff ++ = 0x00;        /* green */
              *framebuff ++ = 0xFF;        /* red */
              *framebuff ++ = 0xFF;        /* alpha */         
            }     
        }
    }
}离线
gcc 静态链接, 然后用 adb push 到一个有权限的目录, 再执行这个命令.
昨天翻邮箱, 刚好看到就传上来了。
忘记当时有没有root手机了, 按理来说 /dev/fb0 是不能执行写操作的。
离线