Skip to content

Commit 1f76ea4

Browse files
committed
fix Triumph CWM
1 parent d316196 commit 1f76ea4

File tree

5 files changed

+41
-13
lines changed

5 files changed

+41
-13
lines changed

BoardConfig.mk

-2
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,3 @@ BOARD_HAS_NO_MISC_PARTITION := true
7777
BOARD_USES_MMCUTILS := true
7878
BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/motorola/triumph/recovery/recovery_ui.c
7979
BOARD_CUSTOM_GRAPHICS := ../../../device/motorola/triumph/recovery/minui/graphics.c
80-
BOARD_HAS_NO_SELECT_BUTTON := true
81-
TARGET_PREBUILT_RECOVERY_KERNEL := device/motorola/triumph/recovery_kernel

recovery.fstab

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
/boot emmc /dev/block/mmcblk0p5 NULL NULL
44
/fat vfat /dev/block/mmcblk0p1 NULL NULL
5-
/cache ext4 /dev/block/mmcblk0p11 NULL ext3
6-
/data ext4 /dev/block/mmcblk0p8 NULL ext3
7-
/system ext4 /dev/block/mmcblk0p7 NULL ext3
8-
/recovery ext4 /dev/block/mmcblk0p99 NULL ext3
5+
/cache ext3 /dev/block/mmcblk0p11 NULL NULL
6+
/data ext3 /dev/block/mmcblk0p8 NULL NULL
7+
/system ext3 /dev/block/mmcblk0p7 NULL NULL
98
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 NULL

recovery/minui/graphics.c

+36-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/kd.h>
2929

3030
#include <pixelflinger/pixelflinger.h>
31+
#include <cutils/memory.h>
3132

3233
#ifndef BOARD_LDPI_RECOVERY
3334
#include "font_10x18.h"
@@ -109,7 +110,7 @@ static int get_framebuffer(GGLSurface *fb)
109110
fb->data = (void*) (((unsigned) bits) + vi.yres * fi.line_length);
110111
#else
111112
fb->stride = vi.xres;
112-
fb->data = (void*) (((unsigned) bits) + vi.yres * vi.xres * 2);
113+
fb->data = (void*) (((unsigned) bits) + (vi.yres * vi.xres * vi.bits_per_pixel / 8));
113114
#endif
114115
fb->format = GGL_PIXEL_FORMAT_RGB_565;
115116
memset(fb->data, 0, vi.yres * vi.xres * 2);
@@ -129,14 +130,35 @@ static void get_memory_surface(GGLSurface* ms) {
129130
static void set_active_framebuffer(unsigned n)
130131
{
131132
if (n > 1) return;
132-
//vi.yres_virtual = vi.yres * 2;
133+
vi.yres_virtual = vi.yres * 2;
133134
vi.yoffset = n * vi.yres;
134-
vi.bits_per_pixel = 16;
135135
if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
136136
perror("active fb swap failed");
137137
}
138138
}
139139

140+
void gr_flip_32(unsigned *bits, unsigned short *ptr, unsigned count)
141+
{
142+
unsigned i=0;
143+
while (i<count) {
144+
uint32_t rgb32, red, green, blue, alpha;
145+
146+
/* convert 16 bits to 32 bits */
147+
rgb32 = ((ptr[i] >> 11) & 0x1F);
148+
red = (rgb32 << 3) | (rgb32 >> 2);
149+
rgb32 = ((ptr[i] >> 5) & 0x3F);
150+
green = (rgb32 << 2) | (rgb32 >> 4);
151+
rgb32 = ((ptr[i]) & 0x1F);
152+
blue = (rgb32 << 3) | (rgb32 >> 2);
153+
alpha = 0xff;
154+
rgb32 = (alpha << 24) | (blue << 16)
155+
| (green << 8) | (red);
156+
android_memset32((uint32_t *)bits, rgb32, 4);
157+
i++;
158+
bits++;
159+
}
160+
}
161+
140162
void gr_flip(void)
141163
{
142164
GGLContext *gl = gr_context;
@@ -156,8 +178,17 @@ void gr_flip(void)
156178

157179
/* copy data from the in-memory surface to the buffer we're about
158180
* to make active. */
159-
memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
160-
vi.xres * vi.yres * 2);
181+
if( vi.bits_per_pixel == 16)
182+
{
183+
memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
184+
vi.xres * vi.yres * 2);
185+
}
186+
else
187+
{
188+
gr_flip_32((unsigned *)gr_framebuffer[gr_active_fb].data,
189+
(unsigned short *)gr_mem_surface.data,
190+
(vi.xres * vi.yres));
191+
}
161192

162193
/* inform the display driver */
163194
set_active_framebuffer(gr_active_fb);

recovery/recovery_ui.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ int device_handle_key(int key_code, int visible) {
5959
if (visible) {
6060
switch (key_code) {
6161
//case KEY_VOLUMEDOWN:
62-
case 115:
62+
case 114:
6363
return HIGHLIGHT_DOWN;
6464

6565
//case KEY_VOLUMEUP:
66-
case 114:
66+
case 115:
6767
return HIGHLIGHT_UP;
6868

6969
//case KEY_MENU:

recovery_kernel

-3.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)