/* droid VNC server - a vnc server for android Copyright (C) 2011 Jose Pereira Other contributors: Oleksandr Andrushchenko This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "framebuffer_method.h" #include "common.h" #include "gui.h" int fbfd = -1; char framebuffer_device[256] = "/dev/graphics/fb0"; void setFramebufferDevice(char *s) { strcpy(framebuffer_device,s); } int initFramebuffer(void) { L("--Initializing framebuffer access method--\n"); fbmmap = MAP_FAILED; if ((fbfd = open(framebuffer_device, O_RDWR)) == -1) { L("Cannot open fb device %s\n", framebuffer_device); sendMsgToGui("~SHOW|Cannot open fb device, please try out other display grab method\n"); return -1; } update_fb_info(); if (ioctl(fbfd, FBIOGET_FSCREENINFO, &fscrinfo) != 0) { L("ioctl error\n"); return -1; } L("line_lenght=%d xres=%d, yres=%d, xresv=%d, yresv=%d, xoffs=%d, yoffs=%d, bpp=%d\n", (int)fscrinfo.line_length,(int)scrinfo.xres, (int)scrinfo.yres, (int)scrinfo.xres_virtual, (int)scrinfo.yres_virtual, (int)scrinfo.xoffset, (int)scrinfo.yoffset, (int)scrinfo.bits_per_pixel); size_t size=scrinfo.yres_virtual; if (size