added misc things
This commit is contained in:
parent
dd50528b71
commit
b9c47879aa
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||||||
//
|
//
|
||||||
//STATE - NOT WORKING
|
//STATE - NOT WORKING
|
||||||
//TODO execute adb in custom tcp port on method initialization
|
//TODO execute adb in custom tcp port on method initialization
|
||||||
|
//we must kill previous adb process or it wont be able to bind to listener install
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
|
|
||||||
@ -64,8 +65,6 @@ int sockfd;
|
|||||||
|
|
||||||
ssize_t write_socket(int fd, const void *buf, size_t count)
|
ssize_t write_socket(int fd, const void *buf, size_t count)
|
||||||
{
|
{
|
||||||
// L("--Writing %d \n",count);
|
|
||||||
|
|
||||||
int n = write(fd,buf,count);
|
int n = write(fd,buf,count);
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
@ -79,27 +78,23 @@ void read_socket(int fd, void *buf, size_t count)
|
|||||||
{
|
{
|
||||||
int n=0;
|
int n=0;
|
||||||
|
|
||||||
while (count>0)
|
while (count>0) {
|
||||||
{
|
|
||||||
n=read(fd,buf,count);
|
n=read(fd,buf,count);
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
L("ERROR reading from socket\n");
|
L("ERROR reading from socket\n");
|
||||||
|
|
||||||
|
count -= n;
|
||||||
count-=n;
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_connect_string()
|
void send_connect_string()
|
||||||
{
|
{
|
||||||
write_socket(sockfd,connect_string,sizeof(connect_string));
|
write_socket(sockfd,connect_string,sizeof(connect_string));
|
||||||
|
|
||||||
read_socket(sockfd,message,sizeof(struct _message));
|
read_socket(sockfd,message,sizeof(struct _message));
|
||||||
|
|
||||||
if (message->command!=A_CNXN)
|
if (message->command!=A_CNXN)
|
||||||
L("bad A_CNXN response\n");
|
L("bad A_CNXN response\n");
|
||||||
|
|
||||||
//lets read, i don't want this
|
//lets read, i don't want this
|
||||||
read_socket(sockfd,message,message->data_length);
|
read_socket(sockfd,message,message->data_length);
|
||||||
@ -110,20 +105,29 @@ void send_framebuffer_string();
|
|||||||
int initADB()
|
int initADB()
|
||||||
{
|
{
|
||||||
L("--Initializing adb access method--\n");
|
L("--Initializing adb access method--\n");
|
||||||
|
pid_t pid;
|
||||||
int portno;
|
int portno;
|
||||||
struct sockaddr_in serv_addr;
|
struct sockaddr_in serv_addr;
|
||||||
struct hostent *server;
|
struct hostent *server;
|
||||||
adbbuf=NULL;
|
adbbuf=NULL;
|
||||||
|
|
||||||
// property_set("service.adb.tcp.port", "5555");
|
// property_set("service.adb.tcp.port", "5555");
|
||||||
system("setprop service.adb.tcp.port 5555");
|
|
||||||
system("adbd");
|
switch (pid = fork()) {
|
||||||
|
case -1:
|
||||||
|
perror("adb::fork()");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
case 0: // in the child
|
||||||
|
system("killall adbd");
|
||||||
|
system("setprop service.adb.tcp.port -1");
|
||||||
|
system("/sbin/adbd");
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
message=malloc(sizeof(struct _message));
|
sleep(1);
|
||||||
okay_message=malloc(sizeof(struct _message));
|
message = malloc(sizeof(struct _message));
|
||||||
|
okay_message = malloc(sizeof(struct _message));
|
||||||
|
|
||||||
// L("1\n");
|
|
||||||
|
|
||||||
portno = 5555;
|
portno = 5555;
|
||||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
@ -256,18 +260,6 @@ void updateADBFrame()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ANDROID
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
connect_to_adb();
|
|
||||||
L("up\n");
|
|
||||||
update_frame();
|
|
||||||
L("up\n");
|
|
||||||
update_frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// test start point
|
// test start point
|
||||||
// int main(int argc, char *argv[])
|
// int main(int argc, char *argv[])
|
||||||
// {
|
// {
|
||||||
|
@ -35,15 +35,13 @@ void setFramebufferDevice(char *s)
|
|||||||
strcpy(framebuffer_device,s);
|
strcpy(framebuffer_device,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int initFramebuffer(void)
|
int initFramebuffer(void)
|
||||||
{
|
{
|
||||||
L("--Initializing framebuffer access method--\n");
|
L("--Initializing framebuffer access method--\n");
|
||||||
|
|
||||||
fbmmap = MAP_FAILED;
|
fbmmap = MAP_FAILED;
|
||||||
|
|
||||||
if ((fbfd = open(framebuffer_device, O_RDWR)) == -1)
|
if ((fbfd = open(framebuffer_device, O_RDWR)) == -1) {
|
||||||
{
|
|
||||||
L("Cannot open fb device %s\n", framebuffer_device);
|
L("Cannot open fb device %s\n", framebuffer_device);
|
||||||
sendMsgToGui("~SHOW|Cannot open fb device, please try out other display grab method\n");
|
sendMsgToGui("~SHOW|Cannot open fb device, please try out other display grab method\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -52,8 +50,7 @@ int initFramebuffer(void)
|
|||||||
update_fb_info();
|
update_fb_info();
|
||||||
|
|
||||||
|
|
||||||
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &fscrinfo) != 0)
|
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &fscrinfo) != 0) {
|
||||||
{
|
|
||||||
L("ioctl error\n");
|
L("ioctl error\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -64,69 +61,57 @@ int initFramebuffer(void)
|
|||||||
(int)scrinfo.xoffset, (int)scrinfo.yoffset,
|
(int)scrinfo.xoffset, (int)scrinfo.yoffset,
|
||||||
(int)scrinfo.bits_per_pixel);
|
(int)scrinfo.bits_per_pixel);
|
||||||
|
|
||||||
|
size_t size = scrinfo.yres_virtual;
|
||||||
|
if (size < scrinfo.yres * 2) {
|
||||||
|
|
||||||
size_t size=scrinfo.yres_virtual;
|
|
||||||
if (size<scrinfo.yres*2)
|
|
||||||
{
|
|
||||||
L("Using Droid workaround\n");
|
L("Using Droid workaround\n");
|
||||||
size=scrinfo.yres*2;
|
size = scrinfo.yres * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((scrinfo.bits_per_pixel==24))// && (fscrinfo.line_length/scrinfo.xres_virtual==CHAR_BIT*4))
|
if ((scrinfo.bits_per_pixel == 24)) {// && (fscrinfo.line_length/scrinfo.xres_virtual==CHAR_BIT*4))
|
||||||
{
|
scrinfo.bits_per_pixel = 32;
|
||||||
scrinfo.bits_per_pixel=32;
|
|
||||||
|
|
||||||
L("24-bit XRGB display detected\n");
|
L("24-bit XRGB display detected\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t fbSize = roundUpToPageSize(fscrinfo.line_length * size);
|
size_t fbSize = roundUpToPageSize(fscrinfo.line_length * size);
|
||||||
|
|
||||||
fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0);
|
fbmmap = mmap(NULL, fbSize , PROT_READ|PROT_WRITE , MAP_SHARED , fbfd, 0);
|
||||||
|
|
||||||
if (fbmmap == MAP_FAILED)
|
if (fbmmap == MAP_FAILED) {
|
||||||
{
|
|
||||||
L("mmap failed\n");
|
L("mmap failed\n");
|
||||||
sendMsgToGui("~SHOW|Framebuffer mmap failed, please try out other display grab method\n");
|
sendMsgToGui("~SHOW|Framebuffer mmap failed, please try out other display grab method\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayInfo.bpp = scrinfo.bits_per_pixel;
|
displayInfo.bpp = scrinfo.bits_per_pixel;
|
||||||
displayInfo.size = scrinfo.xres * scrinfo.yres * scrinfo.bits_per_pixel / CHAR_BIT;
|
displayInfo.size = scrinfo.xres * scrinfo.yres * scrinfo.bits_per_pixel / CHAR_BIT;
|
||||||
displayInfo.width = scrinfo.xres;
|
displayInfo.width = scrinfo.xres;
|
||||||
displayInfo.height = scrinfo.yres;
|
displayInfo.height = scrinfo.yres;
|
||||||
displayInfo.red_offset = scrinfo.red.offset;
|
displayInfo.red_offset = scrinfo.red.offset;
|
||||||
displayInfo.red_length = scrinfo.red.length;
|
displayInfo.red_length = scrinfo.red.length;
|
||||||
displayInfo.green_offset = scrinfo.green.offset;
|
displayInfo.green_offset = scrinfo.green.offset;
|
||||||
displayInfo.green_length = scrinfo.green.length;
|
displayInfo.green_length = scrinfo.green.length;
|
||||||
displayInfo.blue_offset = scrinfo.blue.offset;
|
displayInfo.blue_offset = scrinfo.blue.offset;
|
||||||
displayInfo.blue_length = scrinfo.blue.length;
|
displayInfo.blue_length = scrinfo.blue.length;
|
||||||
displayInfo.alpha_offset = scrinfo.transp.offset;
|
displayInfo.alpha_offset = scrinfo.transp.offset;
|
||||||
displayInfo.alpha_length = scrinfo.transp.length;
|
displayInfo.alpha_length = scrinfo.transp.length;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupFramebuffer(void)
|
void cleanupFramebuffer(void)
|
||||||
{
|
{
|
||||||
if(fbfd != -1)
|
if(fbfd != -1)
|
||||||
{
|
close(fbfd);
|
||||||
close(fbfd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void update_fb_info()
|
void update_fb_info()
|
||||||
{
|
{
|
||||||
|
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &scrinfo) != 0) {
|
||||||
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &scrinfo) != 0)
|
|
||||||
{
|
|
||||||
L("ioctl error\n");
|
L("ioctl error\n");
|
||||||
sendMsgToGui("~SHOW|Framebuffer ioctl error, please try out other display grab method\n");
|
sendMsgToGui("~SHOW|Framebuffer ioctl error, please try out other display grab method\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BIN
libs/GoogleAdMobAdsSdk-6.0.1.jar
Executable file
BIN
libs/GoogleAdMobAdsSdk-6.0.1.jar
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user