Beispiel #1
0
int fwparam_sysfs_boot_info(struct boot_context *context)
{
	struct dirent *dent;
	DIR *dirfd;
	int rc = 0;

	if (!get_boot_info(context, IBFT_SYSFS_ROOT, IBFT_SUBSYS))
		return 0;
	/*
	 * We could have multiple iscsi llds and each lld could have
	 * multiple targets/ethernet ports
	 */
	dirfd = opendir(ISCSI_LLD_ROOT);
	if (!dirfd)
		return ISCSI_ERR_SYSFS_LOOKUP;

	while ((dent = readdir(dirfd))) {
		char lld_root[FILENAMESZ];

		memset(&lld_root, 0 , FILENAMESZ);

		if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
			continue;

		if (strncmp(dent->d_name, ISCSI_LLD_SUBSYS_PREFIX, 10))
			continue;

		snprintf(lld_root, FILENAMESZ, ISCSI_LLD_ROOT"%s/",
			 dent->d_name);
		if (!get_boot_info(context, lld_root, dent->d_name))
			goto done;
	}
	rc = ISCSI_ERR_NO_OBJS_FOUND;
done:
	closedir(dirfd);
	return rc;
}
Beispiel #2
0
/* MTD-BSP-VT-RECOVERY-00*[ */
static int reboot_info_read_proc(char *page, char **start, off_t off,
                                 int count, int *eof, void *data)
{
    int len;
    char ver[10]= {0};
    unsigned int boot_info = get_boot_info();

    if (boot_info == 0x77665502) {
        strncpy( ver, "recovery", 8);
        ver[8]='\0';
    } else {
        strncpy( ver, "normal", 6);
        ver[6]='\0';
    }
    len = snprintf(page, count, "%s\n",ver); /* MTD-BSP-VT-PROC-00* */

    return proc_calc_metrics(page, start, off, count, eof, len);
}
Beispiel #3
0
UINT8 bootota_input_proc()
{
	union BOOT_INFO *boot_info;
	struct OSDRect rect;
	lpVSCR 		pVscr;
	UINT8 *pstr;
	UINT8 str[20];
	UINT16 ustr[100];
	UINT16 i;
	UINT16 back_sh,txt_sh,sh;
	UINT32 new_focus_id;
	UINT32 value;
	UINT32 strlen;

	boot_info = get_boot_info();

	input_data[LNBFREQ_ID-1] = 0;
	input_data[DISEQC_ID-1] = 0;
	input_data[K22_ID-1] = 0;
	input_data[FREQUENCEY_ID-1] = boot_info->s_info.ota_frequency;
	input_data[SYMBOL_ID-1] = boot_info->s_info.ota_symbol;
	input_data[PID_ID-1] = boot_info->s_info.ota_pid;
	input_data[POL_ID-1] =0;
	focus_id = LNBFREQ_ID;
	input_status = SELECT_STATUS;
	value = 0;

	// draw input frame
	OSD_SetRect(&rect, INPUT_CON_L, INPUT_CON_T, INPUT_CON_W, INPUT_CON_H);	
	OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,INPUT_CON_SH);

	for(i=0;i<7;i++)
	{
		pstr = input_strs[i];
		ComAscStr2Uni(pstr, ustr);
		OSD_SetRect(&rect, INPUT_TXTN_L, INPUT_TXTN_T+(INPUT_TXTN_H+INPUT_TXT_GAP)*i, INPUT_TXTN_W, INPUT_TXTN_H);	
		pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
		OSD_DrawText(&rect,ustr,INPUT_TXT_SH,C_ALIGN_LEFT,0,pVscr);

		if(pVscr->lpbScr != NULL)
			pVscr->updatePending = 1;
		OSD_UpdateVscr(pVscr);
		pVscr->lpbScr = NULL;

		if(focus_id-1 == i)
		{
			back_sh = INPUT_CON_HL;
			txt_sh = INPUT_TXT_HL;
		}
		else
		{
			back_sh = INPUT_CON_SH;
			txt_sh = INPUT_TXT_SH;
		}

		OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*i, INPUT_TXTS_W, INPUT_TXTS_H);	
		OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,back_sh);
		pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
		bootota_get_ustr(i,ustr);
		OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);
		if((focus_id-1==i) && (i<K22_ID||i==POL_ID-1))
		{
			OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*i, 26, INPUT_TXTS_H);	
			ComAscStr2Uni("<", ustr);
			OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

			OSD_SetRect(&rect, INPUT_TXTS_L+INPUT_TXTS_W-26, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*i, 26, INPUT_TXTS_H);	
			ComAscStr2Uni(">", ustr);
			OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);
		}
			
		if(pVscr->lpbScr != NULL)
			pVscr->updatePending = 1;
		OSD_UpdateVscr(pVscr);
		pVscr->lpbScr = NULL;
	}

	// start button
	pstr = input_strs[START_ID-1];
	ComAscStr2Uni(pstr, ustr);
	OSD_SetRect(&rect, INPUT_TXTSTART_L, INPUT_TXTSTART_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
	OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,INPUT_START_SH);
	pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
	OSD_DrawText(&rect,ustr,INPUT_TXT_HL,C_ALIGN_CENTER,0,pVscr);

	if(pVscr->lpbScr != NULL)
		pVscr->updatePending = 1;
	OSD_UpdateVscr(pVscr);
	pVscr->lpbScr = NULL;
	
		// cancel button
	pstr = input_strs[CANCEL_ID-1];
	ComAscStr2Uni(pstr, ustr);
	OSD_SetRect(&rect, INPUT_TXTCANCEL_L, INPUT_TXTCANCEL_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
	OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,INPUT_START_SH);
	pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
	OSD_DrawText(&rect,ustr,INPUT_TXT_HL,C_ALIGN_CENTER,0,pVscr);
	//

	if(pVscr->lpbScr != NULL)
		pVscr->updatePending = 1;
	OSD_UpdateVscr(pVscr);
	pVscr->lpbScr = NULL;

	UINT32 hkey;
	UINT32 vkey;
	UINT8 tmpdata;
	while(1)
	{
		hkey = boot_get_key_msg();
		if(hkey == INVALID_HK || hkey == INVALID_MSG)
			continue;

		ap_hk_to_vk(0,hkey, &vkey);

		if(vkey == V_KEY_ENTER)
		{
			if(focus_id != START_ID&&focus_id!=CANCEL_ID)
				continue;
			if(focus_id==CANCEL_ID)
			{
				return 1;
			}
			boot_info->s_info.ota_frequency = input_data[FREQUENCEY_ID-1];
			boot_info->s_info.ota_symbol = input_data[SYMBOL_ID-1];
			boot_info->s_info.ota_pid = input_data[PID_ID-1];

			if(input_data[LNBFREQ_ID-1]==0)
			{
				boot_info->s_info.antenna_info.lnb_type = LNB_CTRL_STD;
				boot_info->s_info.antenna_info.lnb_low = 5150;
				boot_info->s_info.antenna_info.lnb_high = 5150;
			}
			else if(input_data[LNBFREQ_ID-1]==1)
			{
				boot_info->s_info.antenna_info.lnb_type = LNB_CTRL_STD;
				boot_info->s_info.antenna_info.lnb_low = 11300;
				boot_info->s_info.antenna_info.lnb_high = 11300;
			}
			else if(input_data[LNBFREQ_ID-1]==2)
			{
				boot_info->s_info.antenna_info.lnb_type = LNB_CTRL_POL;
				boot_info->s_info.antenna_info.lnb_low = 5150;
				boot_info->s_info.antenna_info.lnb_high = 5750;
			}
			else if(input_data[LNBFREQ_ID-1]==3)
			{
				boot_info->s_info.antenna_info.lnb_type = LNB_CTRL_22K;
				boot_info->s_info.antenna_info.lnb_low = 9750;
				boot_info->s_info.antenna_info.lnb_high = 10600;
			}

			if(input_data[DISEQC_ID-1] == 0)
			{
				boot_info->s_info.antenna_info.DiSEqC11_type = 0;
			}
			else
			{
				boot_info->s_info.antenna_info.DiSEqC11_type = 2;
				boot_info->s_info.antenna_info.DiSEqC11_port = input_data[DISEQC_ID-1]-1;
			}

			boot_info->s_info.antenna_info.k22 = input_data[K22_ID-1]; 
			boot_info->s_info.antenna_info.pol = input_data[POL_ID-1]; 
			OSD_SetRect(&rect, INPUT_CON_L, INPUT_CON_T, INPUT_CON_W, INPUT_CON_H);	
			OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,OSD_TRANSPARENT_COLOR);

			return 0;
		}
		else if(vkey == V_KEY_UP || vkey == V_KEY_DOWN)
		{
			if(input_status == EDIT_STATUS)
			{
				input_status = SELECT_STATUS;
				if(value>=input_range[focus_id-1].min && value<=input_range[focus_id-1].max)
					input_data[focus_id-1] = value;
			}

FOCUS_CHANGE:
			if(vkey == V_KEY_UP)
				new_focus_id = id_navi[focus_id-1].upID;
			else if(vkey == V_KEY_DOWN)
				new_focus_id = id_navi[focus_id-1].downID;
			else if(vkey == V_KEY_LEFT)
				new_focus_id = id_navi[focus_id-1].leftID;
			else
				new_focus_id = id_navi[focus_id-1].rightID;

			if(new_focus_id == 0)
				continue;
				
			if(focus_id == START_ID)
			{
				ComAscStr2Uni(input_strs[START_ID-1], ustr);
				OSD_SetRect(&rect, INPUT_TXTSTART_L, INPUT_TXTSTART_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
				back_sh = INPUT_START_SH;
				txt_sh = INPUT_TXT_HL;
			}
			else if(focus_id == CANCEL_ID)
			{
				ComAscStr2Uni(input_strs[CANCEL_ID-1], ustr);
				OSD_SetRect(&rect, INPUT_TXTCANCEL_L, INPUT_TXTCANCEL_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
				back_sh = INPUT_START_SH;
				txt_sh = INPUT_TXT_HL;
			}
			else
			{
				
				bootota_get_ustr(focus_id-1, ustr);
				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), INPUT_TXTS_W, INPUT_TXTS_H);	
				back_sh = INPUT_CON_SH;
				txt_sh = INPUT_TXT_SH;
			}
			OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,back_sh);
			pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
			OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

			if(pVscr->lpbScr != NULL)
			pVscr->updatePending = 1;
			OSD_UpdateVscr(pVscr);
			pVscr->lpbScr = NULL;

			if(new_focus_id == START_ID)
			{
				ComAscStr2Uni(input_strs[START_ID-1], ustr);
				OSD_SetRect(&rect, INPUT_TXTSTART_L, INPUT_TXTSTART_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
				back_sh = INPUT_START_HL;
				txt_sh = INPUT_TXT_HL;
			}
			else  if(new_focus_id == CANCEL_ID)
			{
				ComAscStr2Uni(input_strs[CANCEL_ID-1], ustr);
				OSD_SetRect(&rect, INPUT_TXTCANCEL_L, INPUT_TXTCANCEL_T, INPUT_TXTSTART_W, INPUT_TXTSTART_H);	
				back_sh = INPUT_START_HL;
				txt_sh = INPUT_TXT_HL;
			}
			else
			{
				bootota_get_ustr(new_focus_id-1, ustr);
				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(new_focus_id-1), INPUT_TXTS_W, INPUT_TXTS_H);	
				back_sh = INPUT_CON_HL;
				txt_sh = INPUT_TXT_HL;
			}
			OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,back_sh);
			pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
			OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

			if(new_focus_id-1<K22_ID||new_focus_id==POL_ID)
			{
				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(new_focus_id-1), 26, INPUT_TXTS_H);	
				ComAscStr2Uni("<", ustr);
				OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

				OSD_SetRect(&rect, INPUT_TXTS_L+INPUT_TXTS_W-26, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(new_focus_id-1), 26, INPUT_TXTS_H);	
				ComAscStr2Uni(">", ustr);
				OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);
			}

			focus_id = new_focus_id;
		}
		else if(vkey>=V_KEY_0 && vkey<=V_KEY_9)
		{
			if(focus_id<FREQUENCEY_ID || focus_id>PID_ID)
				continue;
			
			if(input_status == SELECT_STATUS)
			{
				value = 0;
				input_status = EDIT_STATUS;
			}

			value = value*10 + vkey - V_KEY_0;
			
			sprintf(str,"%d",value);
			strlen = STRLEN(str);

			if(strlen >= input_range[focus_id-1].len)
			{
				input_status = SELECT_STATUS;
				if(value>=input_range[focus_id-1].min && value<=input_range[focus_id-1].max)
					input_data[focus_id-1] = value;
			}
			else
			{
				sprintf(str,"%d_",value);
			}
			ComAscStr2Uni(str, ustr);
			OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), INPUT_TXTS_W, INPUT_TXTS_H);	
			OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,INPUT_CON_HL);
			pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
			OSD_DrawText(&rect,ustr,INPUT_TXT_HL,C_ALIGN_CENTER,0,pVscr);
		}
		else if(vkey == V_KEY_LEFT || vkey == V_KEY_RIGHT)
		{
			if(focus_id == START_ID || focus_id ==CANCEL_ID)
				goto FOCUS_CHANGE;
			
			if(focus_id==FREQUENCEY_ID || focus_id==PID_ID || focus_id==SYMBOL_ID)
			{
				if(vkey == V_KEY_RIGHT || input_status == SELECT_STATUS)
					continue;

				value = value/10;
				sprintf(str,"%d_",value);
				ComAscStr2Uni(str, ustr);
				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), INPUT_TXTS_W, INPUT_TXTS_H);	
				OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,INPUT_CON_HL);
				pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
				OSD_DrawText(&rect,ustr,INPUT_TXT_HL,C_ALIGN_CENTER,0,pVscr);

				if(pVscr->lpbScr != NULL)
				pVscr->updatePending = 1;
				OSD_UpdateVscr(pVscr);
				pVscr->lpbScr = NULL;
			}
			else if(focus_id==LNBFREQ_ID || focus_id==DISEQC_ID || focus_id==K22_ID||focus_id==POL_ID)
			{
				if(vkey == V_KEY_LEFT)
					value = -1;
				else
					value = 1;

				input_data[focus_id-1] = (input_data[focus_id-1]+value+input_range[focus_id-1].len)%input_range[focus_id-1].len;
				bootota_get_ustr(focus_id-1, ustr);
				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), INPUT_TXTS_W, INPUT_TXTS_H);	
				back_sh = INPUT_CON_HL;
				txt_sh = INPUT_TXT_HL;
				OSDDrv_RegionFill((HANDLE)osd_dev,0,&rect,back_sh);
				pVscr = OSD_GetVscr(&rect,OSD_GET_BACK);
				OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

				OSD_SetRect(&rect, INPUT_TXTS_L, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), 26, INPUT_TXTS_H);	
				ComAscStr2Uni("<", ustr);
				OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);

				OSD_SetRect(&rect, INPUT_TXTS_L+INPUT_TXTS_W-26, INPUT_TXTS_T+(INPUT_TXTS_H+INPUT_TXT_GAP)*(focus_id-1), 26, INPUT_TXTS_H);	
				ComAscStr2Uni(">", ustr);
				OSD_DrawText(&rect,ustr,txt_sh,C_ALIGN_CENTER,0,pVscr);
			}
		}
		if(pVscr->lpbScr != NULL)
			pVscr->updatePending = 1;
		OSD_UpdateVscr(pVscr);
		pVscr->lpbScr = NULL;
	}
	return 0;
}