Esempio n. 1
0
static void newPacket(const uint8_t* data, int len)
{
	MTFrameHeader* header = (MTFrameHeader*) data;
	if(header->type != 0x44 && header->type != 0x43)
		bufferPrintf("multitouch: unknown frame type 0x%x\r\n", header->type);

	FingerData* finger = (FingerData*)(data + (header->headerLen));

	if(header->headerLen < 12)
		bufferPrintf("multitouch: no finger data in frame\r\n");

	//bufferPrintf("------START------\r\n");

	int i;
	for(i = 0; i < header->numFingers; ++i)
	{
		/*bufferPrintf("multitouch: finger %d -- id=%d, event=%d, X(%d/%d, vel: %d), Y(%d/%d, vel: %d), radii(%d, %d, %d, angle: %d), contactDensity: %d\r\n",
				i, finger->id, finger->event,
				finger->x, SensorWidth, finger->velX,
				finger->y, SensorHeight, finger->velY,
				finger->radius1, finger->radius2, finger->radius3, finger->angle,
				finger->contactDensity);*/

		framebuffer_draw_rect(0xFF0000, (finger->x * framebuffer_width()) / SensorWidth - 2 , ((SensorHeight - finger->y) * framebuffer_height()) / SensorHeight - 2, 4, 4);
		//hexdump((uint32_t) finger, sizeof(FingerData));
		finger = (FingerData*) (((uint8_t*) finger) + header->fingerDataLen);
	}
	fingerData = (FingerData*)(data + (header->headerLen));
	//bufferPrintf("-------END-------\r\n");
}
Esempio n. 2
0
bool init_framebuffer() {

    fw = framebuffer_width();
    fh = framebuffer_height();

    if (fw <= 0 || fh <= 0)
        return false;

    uint64_t fbitsize = fw*fh;
    uint64_t fbsize = fbitsize*4;

    return true;
}
Esempio n. 3
0
static void installer_init()
{
	framebuffer_setdisplaytext(FALSE);
	framebuffer_clear();

	{
		int w, h;
		uint32_t *bgImg = framebuffer_load_image(datainstallerLogoPNG, sizeof(datainstallerLogoPNG), &w, &h, TRUE);
		if(bgImg)
		{
			int x = (framebuffer_width() - w)/2;
			int y = (framebuffer_height() - h)/3;

			framebuffer_draw_image(bgImg, x, y, w, h);
		}
		else
		{
			framebuffer_setdisplaytext(TRUE);
			bufferPrintf("Failed to load image...\n");
		}
	}
}
Esempio n. 4
0
void OpenIBootStart() {
	setup_openiboot();
	pmu_charge_settings(TRUE, FALSE, FALSE);

#ifdef OPENIBOOT_INSTALLER
	framebuffer_setdisplaytext(FALSE);
	framebuffer_clear();

	{
		int w, h;
		uint32_t *bgImg = framebuffer_load_image(datainstallerLogoPNG, sizeof(datainstallerLogoPNG), &w, &h, TRUE);
		if(bgImg)
		{
			int x = (framebuffer_width() - w)/2;
			int y = (framebuffer_height() - h)/3;

			framebuffer_draw_image(bgImg, x, y, w, h);
		}
		else
		{
			framebuffer_setdisplaytext(TRUE);
			bufferPrintf("Failed to load image...\n");
		}
	}

#else
	framebuffer_setdisplaytext(TRUE);
	framebuffer_clear();
	bufferPrintf("Loading openiBoot...");
#ifndef SMALL
#ifndef NO_STBIMAGE
	int defaultOS = 0;
	int tempOS = 0;
	const char* hideMenu = nvram_getvar("opib-hide-menu");
	const char* sDefaultOS = nvram_getvar("opib-default-os");
	const char* sTempOS = nvram_getvar("opib-temp-os");
	if(sDefaultOS)
		defaultOS = parseNumber(sDefaultOS);
	if(sTempOS)
		tempOS = parseNumber(sTempOS);
	if(tempOS!=defaultOS) {
				
		switch (tempOS) {
			case 0:
				framebuffer_clear();
				bufferPrintf("Loading iOS...");
				reset_tempos(sDefaultOS);
				Image* image = images_get(fourcc("ibox"));
				if(image == NULL)
					image = images_get(fourcc("ibot"));
				void* imageData;
				images_read(image, &imageData);
				chainload((uint32_t)imageData);
				break;
			
			case 1:
				framebuffer_clear();
				bufferPrintf("Loading iDroid...");
				reset_tempos(sDefaultOS);
#ifndef NO_HFS
#ifndef CONFIG_IPOD
				radio_setup();
#endif
				nand_setup();
				fs_setup();
				if(globalFtlHasBeenRestored) {
					if(ftl_sync()) {
						bufferPrintf("ftl synced successfully");
					} else {
						bufferPrintf("error syncing ftl");
					}
				}	
				pmu_set_iboot_stage(0);
				startScripting("linux"); //start script mode if there is a script file
				boot_linux_from_files();
#endif
				break;
				
			case 2:
				framebuffer_clear();
				bufferPrintf("Loading Console...");
				reset_tempos(sDefaultOS);
				hideMenu = "1";
				break;
		}
		
	} else if(hideMenu && (strcmp(hideMenu, "1") == 0 || strcmp(hideMenu, "true") == 0)) {
		bufferPrintf("Boot menu hidden. Use 'setenv opib-hide-menu false' and then 'saveenv' to unhide.\r\n");
	} else {
        	framebuffer_setdisplaytext(FALSE);
        	isMultitouchLoaded = load_multitouch_images();
		framebuffer_clear();
		const char* sMenuTimeout = nvram_getvar("opib-menu-timeout");
		int menuTimeout = -1;
		if(sMenuTimeout)
			menuTimeout = parseNumber(sMenuTimeout);
		menu_setup(menuTimeout, defaultOS);
	}
#endif
#endif
#endif //OPENIBOOT_INSTALLER

	startUSB();

#ifndef CONFIG_IPOD
	camera_setup();
	radio_setup();
#endif
	sdio_setup();
	wlan_setup();
	accel_setup();
#ifndef CONFIG_IPOD
	als_setup();
#endif

	nand_setup();
#ifndef NO_HFS
	fs_setup();
#endif

	pmu_set_iboot_stage(0);
	startScripting("openiboot"); //start script mode if there is a file
	bufferPrintf("version: %s\r\n", OPENIBOOT_VERSION_STR);
	bufferPrintf("-----------------------------------------------\r\n");
	bufferPrintf("              WELCOME TO OPENIBOOT\r\n");
	bufferPrintf("-----------------------------------------------\r\n");
	DebugPrintf("                    DEBUG MODE\r\n");

	audiohw_postinit();

	setReady(TRUE);

	// Process command queue
	while(TRUE) {
		char* command = NULL;
		CommandQueue* cur;
		EnterCriticalSection();
		if(commandQueue != NULL) {
			cur = commandQueue;
			command = cur->command;
			commandQueue = commandQueue->next;
			free(cur);
		}
		LeaveCriticalSection();

		if(command) {
			setReady(FALSE);
			processCommand(command);
			setReady(TRUE);
			free(command);
		}
	}
	// should not reach here

}
Esempio n. 5
0
static error_t cmd_progress(int argc, char **argv)
{
	if(argc != 2)
	{
		bufferPrintf("Usage: %s <percentage>\n", argv[0]);
		return EINVAL;		
	}

	int x,y,w;
	int percent = parseNumber(argv[1]);

	if(cmd_progress_empty == NULL)
		cmd_progress_empty = framebuffer_load_image(
				datainstallerBarEmptyPNG, sizeof(datainstallerBarEmptyPNG),
				&cmd_progress_empty_width, &cmd_progress_empty_height, 0);
		
	if(cmd_progress_full == NULL)
		cmd_progress_full = framebuffer_load_image(
				datainstallerBarFullPNG, sizeof(datainstallerBarFullPNG),
				&cmd_progress_full_width, &cmd_progress_full_height, 0);

	x = (framebuffer_width()-cmd_progress_empty_width)/2;
	y = 2*((framebuffer_height()-cmd_progress_empty_height)/3);
	w = (percent*cmd_progress_full_width)/100;

	if(percent < 0)
	{
		framebuffer_fill_rect(0, x, y, cmd_progress_empty_width, cmd_progress_empty_height);
	}
	else if(percent > 100)
	{
		int left = ((percent-100)%120)-20;
		int right = left + 20;
		if(left < 0)
			left = 0;
		if(right > 100)
			right = 100;

		left = (left*cmd_progress_full_width)/100;
		right = (right*cmd_progress_full_width)/100;

		if(right < 100)
			framebuffer_draw_image(cmd_progress_empty, x, y,
					cmd_progress_empty_width, cmd_progress_empty_height);	
		
		framebuffer_draw_image_clip(cmd_progress_full, x, y,
				cmd_progress_full_width, cmd_progress_full_height,
				right, cmd_progress_full_height);

		if(left > 0)
			framebuffer_draw_image_clip(cmd_progress_empty, x, y,
					cmd_progress_empty_width, cmd_progress_empty_height,
					left, cmd_progress_empty_height);
	}
	else
	{	
		framebuffer_draw_image(cmd_progress_empty, x, y,
				cmd_progress_empty_width, cmd_progress_empty_height);	

		framebuffer_draw_image_clip(cmd_progress_full, x, y,
				cmd_progress_full_width, cmd_progress_full_height,
				w, cmd_progress_full_height);
	}
	
	return SUCCESS;
}