How to get Recovery (System firmware upgrade),Charger (Power off charge animation) when the screen rotates 180 degrees
Workaround:
1. Find the gr_flip (void) method in the bootable\recovery\minui\graphics.c file
Put memcpy (Gr_framebuffer[gr_active_fb].data,gr_mem_surface.data,
fi.line_length*vi.yres); Revision changed to
rotate_180 (Gr_framebuffer[gr_active_fb].data,gr_mem_surface.data
, fi.line_length*vi.yres);
2. Add a method
void *rotate_180 (void *_dst,const void *_src,int len)
{
int pixelsize = Pixel_size,size,step = number of len/pixelsize;//pixels
unsigned char *dst = _DST;
Const unsigned char *src = _src + len;
while (step--> 0) {
size = Pixelsize;
SRC-=size;
while (size--> 0) {
*dst++ = *src++;
}
SRC-=pixelsize;
}
Return _DST;
}
The function of the rotate_180 method is to reverse the data in buffer by pixels .
Example: Raw data
{(+), (4,5,6), (7,8,9),
(A,b,c), (d,e,f), (G,h,i),
(A,b,c), (d,e,f), (g,h,i)
}
180 degree rotation after data
{(g,h,i), (d,e,f), (A,b,c),
(G,h,i), (d,e,f), (A,b,c),
(7,8,9), (4,5,6), ()
}
The data for each pixel is constant, in pixels, in the order of rotation
This completes the rotation
Recovery and Charger mode screen rotation 180 degrees [turn]