Ejemplo n.º 1
0
/*---------------------------------------------------*/
void get_conf()
{
int n,m;
int da=1;
	get_modes(0,-1);
	if ((ret3!=42))
	{
		for(n=0;n<5;n++)
		{
			strcpy(rs_object[COL2R1+5*n].ob_spec.free_string,"-----");
			strcpy(rs_object[COL2R2+5*n].ob_spec.free_string,"-----");
			
			rs_object[COL2R1+5*n].ob_state|=DISABLED;
			rs_object[COL2R2+5*n].ob_state|=DISABLED;
			rs_object[COL2OFF+5*n].ob_state|=SELECTED;
			
		}
			rs_object[SAVER].ob_state=DISABLED;
			rs_object[SAVE].ob_state=DISABLED;
			da=0;
	}
	else
	{
	for(m=0;m<2;m++)
		for(n=0;n<5;n++)
		{
			get_modes(n+m*8,-1);
			rets[n+5*m]=ret2&7;
			set_rsc1(n,m);
		}
	}

	for(n=0;n<5;n++)
	{
		rs_object[COL2R1+5*n].ob_state|=SELECTED*(rets[n]==0);
		rs_object[COL2R2+5*n].ob_state|=SELECTED*(rets[n+5]==0);
		rs_object[COL2OFF+5*n].ob_state=SELECTED*((rets[n]!=0)&&(rets[n+5]!=0));
	}
	
	if (da)
		{
		get_modes(0,-2); /* -2: Saver abfragen */
		saver_flag = ret0;
		saver_time = ret1<<16+ret2;
		rs_object[SAVER].ob_state=SELECTED*(ret0==1);
		rs_object[SAVER].ob_state|=DISABLED*(saver_time==-1);
		}
}
Ejemplo n.º 2
0
/**
Редактировать атрибуты шрифта.
*/
void font::menu_Parametr ( void )
{
	int rez  = 0;
	int above = 0;
	int below = 0;
	int modes = 0;

	QString  attribute;

	do
	{
		print();
//  edit_menu::s_menu_font_parametr->run();
//  rez = edit_menu::s_menu_font_parametr->get_run_rez();

		switch ( rez )
		{

			case 0: //Above
				std_out << "Above (n>=1) <" << get_above () << "> =";
				std_out.flush();
				std_in >> above ;
				set_above ( above );
				break;

			case 1: //Below
				std_out << "Below (n>=1) <" << get_below() << "> =";
				std_out.flush();
				std_in >> below;
				set_below ( below );
				break;

			case 2: //Modes
				std_out << "Modes (0|2) <" << get_modes() << "> =";
				std_out.flush();
				std_in >> modes;
				set_modes ( modes );
				break;

			case 3: //Attribute
				std_out << "Attribute <" << get_attribute() << "> =";
				std_out.flush();
				attribute = std_in.readLine();
//    std_in >> attribute;
				set_attribute ( attribute );
				break;

			case 4: //Exit
				break;

			default:
				rez = 4;
				break;
		}
	}

	while ( rez >= 0 && rez < 4 );
}
bool DisplayManagerRPI::initialize()
{
  bcm_host_init();

  m_displays.clear();

  // create the main display
  DMDisplayPtr display = DMDisplayPtr(new DMDisplay);
  display->m_id = 0;
  display->m_name = "Display";
  m_displays[display->m_id] = display;

  // fills mode array with both CEA and DMT
  m_modes.resize(0);
  get_modes(m_modes, HDMI_RES_GROUP_CEA); // TV
  get_modes(m_modes, HDMI_RES_GROUP_DMT); // PC

  for (size_t n = 0; n < m_modes.size(); n++)
  {
    TV_SUPPORTED_MODE_NEW_T* tvmode = &m_modes[n];
    DMVideoModePtr mode = DMVideoModePtr(new DMVideoMode);
    mode->m_id = n * 2 + 0;
    display->m_videoModes[mode->m_id] = mode;

    mode->m_height = tvmode->height;
    mode->m_width = tvmode->width;
    mode->m_refreshRate = tvmode->frame_rate;
    mode->m_interlaced = (tvmode->scan_mode == 1);
    mode->m_bitsPerPixel = 32;

    mode = DMVideoModePtr(new DMVideoMode(*mode));
    mode->m_id = n * 2 + 1;
    display->m_videoModes[mode->m_id] = mode;
    mode->m_refreshRate /= 1.001;
  }

  if (m_modes.size() == 0)
    return false;
  else
    return DisplayManager::initialize();
}
Ejemplo n.º 4
0
static int fsl_dcu_drm_connector_get_modes(struct drm_connector *connector)
{
	struct fsl_dcu_drm_connector *fsl_connector;
	int (*get_modes)(struct drm_panel *panel);
	int num_modes = 0;

	fsl_connector = to_fsl_dcu_connector(connector);
	if (fsl_connector->panel && fsl_connector->panel->funcs &&
	    fsl_connector->panel->funcs->get_modes) {
		get_modes = fsl_connector->panel->funcs->get_modes;
		num_modes = get_modes(fsl_connector->panel);
	}

	return num_modes;
}
Ejemplo n.º 5
0
void font::font_save ( void )
{
//  if ( m_file.exists() )
//  {
//   if ( m_file.open ( QIODevice::WriteOnly | QIODevice::Text ) )
//    m_stream.setDevice ( &m_file );
//  }
//  else
//  {
//   std_out<<QString::fromUtf8("Файл не существует: ")<< m_file.fileName() <<endl;
//  }
	if ( m_file.open ( QIODevice::WriteOnly | QIODevice::Text ) )
		m_stream.setDevice ( &m_file );
	else
	{
		std_out << QString::fromUtf8 ( "Не могу открыть файт: " ) << m_file.fileName() << endl;
		return;
	}

//************************************************************
	m_stream << "*0," << "4," << get_attribute() << endl;

	std_out << "*0," << "4," << get_attribute() << endl;

	m_stream
	<< get_above() << ","
	<< get_below() << "," << get_modes() << ","
	<< "0" << endl;

	for ( int i = 0; i < m_forma_l_list->size(); ++i )
	{
		( *m_forma_l_list ) [ i ]->print_shapes ( m_stream );
	}

	m_file.close();
}
int main( int argc, char **argv )
{
   int32_t ret;
   char optstring[OPTSTRING_LEN];
   int  opt;
   int  opt_preferred = 0;
   int  opt_explicit = 0;
   int  opt_sdtvon = 0;
   int  opt_off = 0;
   int  opt_modes = 0;
   int  opt_monitor = 0;
   int  opt_status = 0;
   int  opt_audiosup = 0;
   int  opt_dumpedid = 0;
   int  opt_showinfo = 0;
   int  opt_3d = 0;
   int  opt_json = 0;
   int  opt_name = 0;

   char *dumpedid_filename = NULL;
   VCHI_INSTANCE_T    vchi_instance;
   VCHI_CONNECTION_T *vchi_connection;
   HDMI_RES_GROUP_T power_on_explicit_group = HDMI_RES_GROUP_INVALID;
   uint32_t         power_on_explicit_mode;
   uint32_t         power_on_explicit_drive = HDMI_MODE_HDMI;
   HDMI_RES_GROUP_T get_modes_group = HDMI_RES_GROUP_INVALID;
   SDTV_MODE_T sdtvon_mode;
   SDTV_ASPECT_T sdtvon_aspect;

   // Initialize VCOS
   vcos_init();

   // Create the option string that we will be using to parse the arguments
   create_optstring( optstring );

   // Parse the command line arguments
   while (( opt = getopt_long_only( argc, argv, optstring, long_opts,
                                    NULL )) != -1 )
   {
      switch ( opt )
      {
         case 0:
         {
            // getopt_long returns 0 for entries where flag is non-NULL
            break;
         }
         case OPT_PREFERRED:
         {
            opt_preferred = 1;
            break;
         }
         case OPT_EXPLICIT:
         {
            char group_str[32], drive_str[32];

            /* coverity[secure_coding] String length specified, so can't overflow */
            int s = sscanf( optarg, "%31s %u %31s", group_str, &power_on_explicit_mode, drive_str );
            if ( s != 2 && s != 3 )
            {
               LOG_ERR( "Invalid arguments '%s'", optarg );
               goto err_out;
            }

            // Check the group first
            if ( vcos_strcasecmp( "CEA", group_str ) == 0 )
            {
               power_on_explicit_group = HDMI_RES_GROUP_CEA;
            }
            else if ( vcos_strcasecmp( "DMT", group_str ) == 0 )
            {
               power_on_explicit_group = HDMI_RES_GROUP_DMT;
            }
            else if ( vcos_strcasecmp( "CEA_3D", group_str ) == 0  ||
                      vcos_strcasecmp( "CEA_3D_SBS", group_str ) == 0)
            {
               power_on_explicit_group = HDMI_RES_GROUP_CEA;
               opt_3d = 1;
            }
            else if ( vcos_strcasecmp( "CEA_3D_TB", group_str ) == 0 )
            {
               power_on_explicit_group = HDMI_RES_GROUP_CEA;
               opt_3d = 2;
            }
            else
            {
               LOG_ERR( "Invalid group '%s'", group_str );
               goto err_out;
            }
            if (s==3)
            {
               if (vcos_strcasecmp( "HDMI", drive_str ) == 0 )
               {
                  power_on_explicit_drive = HDMI_MODE_HDMI;
               }
               else if (vcos_strcasecmp( "DVI", drive_str ) == 0 )
               {
                  power_on_explicit_drive = HDMI_MODE_DVI;
               }
               else
               {
                  LOG_ERR( "Invalid drive '%s'", drive_str );
                  goto err_out;
               }
            }
            // Then check if mode is a sane number
            if ( power_on_explicit_mode > MAX_MODE_ID )
            {
               LOG_ERR( "Invalid mode '%u'", power_on_explicit_mode );
               goto err_out;
            }

            opt_explicit = 1;
            break;
         }
         case OPT_SDTVON:
         {
            char mode_str[32], aspect_str[32];

            if ( sscanf( optarg, "%s %s", mode_str,
                         aspect_str ) != 2 )
            {
               LOG_ERR( "Invalid arguments '%s'", optarg );
               goto err_out;
            }

            // Check the group first
            if ( vcos_strcasecmp( "NTSC", mode_str ) == 0 )
            {
               sdtvon_mode = SDTV_MODE_NTSC;
            }
            else if ( vcos_strcasecmp( "NTSC_J", mode_str ) == 0 )
            {
               sdtvon_mode = SDTV_MODE_NTSC_J;
            }
            else if ( vcos_strcasecmp( "PAL", mode_str ) == 0 )
            {
               sdtvon_mode = SDTV_MODE_PAL;
            }
            else if ( vcos_strcasecmp( "PAL_M", mode_str ) == 0 )
            {
               sdtvon_mode = SDTV_MODE_PAL_M;
            }
            else
            {
               LOG_ERR( "Invalid mode '%s'", mode_str );
               goto err_out;
            }

            if ( vcos_strcasecmp( "4:3", aspect_str ) == 0 )
            {
               sdtvon_aspect = SDTV_ASPECT_4_3;
            }
            else if ( vcos_strcasecmp( "14:9", aspect_str ) == 0 )
            {
               sdtvon_aspect = SDTV_ASPECT_14_9;
            }
            else if ( vcos_strcasecmp( "16:9", aspect_str ) == 0 )
            {
               sdtvon_aspect = SDTV_ASPECT_16_9;
            }

            opt_sdtvon = 1;
            break;
         }
         case OPT_OFF:
         {
            opt_off = 1;
            break;
         }
         case OPT_MODES:
         {
            if ( vcos_strcasecmp( "CEA", optarg ) == 0 )
            {
               get_modes_group = HDMI_RES_GROUP_CEA;
            }
            else if ( vcos_strcasecmp( "DMT", optarg ) == 0 )
            {
               get_modes_group = HDMI_RES_GROUP_DMT;
            }
            else
            {
               LOG_ERR( "Invalid group '%s'", optarg );
               goto err_out;
            }

            opt_modes = 1;
            break;
         }
         case OPT_MONITOR:
         {
            opt_monitor = 1;
            break;
         }
         case OPT_STATUS:
         {
            opt_status = 1;
            break;
         }
         case OPT_AUDIOSUP:
         {
            opt_audiosup = 1;
            break;
         }
         case OPT_DUMPEDID:
         {
            opt_dumpedid = 1;
            dumpedid_filename = optarg;
            break;
         }
         case OPT_SHOWINFO:
         {
            opt_showinfo = atoi(optarg)+1;
            break;
         }
         case OPT_JSON:
         {
            opt_json = 1;
            break;
         }
         case OPT_NAME:
         {
            opt_name = 1;
            break;
         }
         default:
         {
            LOG_ERR( "Unrecognized option '%d'\n", opt );
            goto err_usage;
         }
         case '?':
         case OPT_HELP:
         {
            goto err_usage;
         }
      } // end switch
   } // end while

   argc -= optind;
   argv += optind;

   if (( optind == 1 ) || ( argc > 0 ))
   {
      if ( argc > 0 )
      {
         LOG_ERR( "Unrecognized argument -- '%s'", *argv );
      }

      goto err_usage;
   }

   if (( opt_preferred + opt_explicit + opt_sdtvon > 1 ))
   {
      LOG_ERR( "Conflicting power on options" );
      goto err_usage;
   }

   if ((( opt_preferred == 1 ) || ( opt_explicit == 1 ) || ( opt_sdtvon == 1)) && ( opt_off == 1 ))
   {
      LOG_ERR( "Cannot power on and power off simultaneously" );
      goto err_out;
   }

   // Initialize the VCHI connection
   ret = vchi_initialise( &vchi_instance );
   if ( ret != 0 )
   {
      LOG_ERR( "Failed to initialize VCHI (ret=%d)", ret );
      goto err_out;
   }

   ret = vchi_connect( NULL, 0, vchi_instance );
   if ( ret != 0)
   {
      LOG_ERR( "Failed to create VCHI connection (ret=%d)", ret );
      goto err_out;
   }

//   LOG_INFO( "Starting tvservice" );

   // Initialize the tvservice
   vc_vchi_tv_init( vchi_instance, &vchi_connection, 1 );

   if ( opt_monitor == 1 )
   {
      LOG_STD( "Starting to monitor for HDMI events" );

      if ( start_monitor() != 0 )
      {
         goto err_stop_service;
      }
   }

   if ( opt_modes == 1 )
   {
      if ( get_modes( get_modes_group, opt_json ) != 0 )
      {
         goto err_stop_service;
      }
   }

   if ( opt_preferred == 1 )
   {
      if ( power_on_preferred() != 0 )
      {
         goto err_stop_service;
      }
   }
   else if ( opt_explicit == 1 )
   {
      //Distinguish between turning on 3D side by side and 3D top/bottom
      if(opt_3d == 1 && set_property( HDMI_PROPERTY_3D_STRUCTURE, HDMI_3D_FORMAT_SBS_HALF, 0) != 0)
      {
         goto err_stop_service;
      }
      else if(opt_3d == 2 && set_property( HDMI_PROPERTY_3D_STRUCTURE, HDMI_3D_FORMAT_TB_HALF, 0) != 0)
      {
         goto err_stop_service;
      }

      if ( power_on_explicit( power_on_explicit_group,
                              power_on_explicit_mode, power_on_explicit_drive ) != 0 )
      {
         goto err_stop_service;
      }
   }
   else if ( opt_sdtvon == 1 )
   {
      if ( power_on_sdtv( sdtvon_mode,
                              sdtvon_aspect ) != 0 )
      {
         goto err_stop_service;
      }
   }
   else if (opt_off == 1 )
   {
      if ( power_off() != 0 )
      {
         goto err_stop_service;
      }
   }

   if ( opt_status == 1 )
   {
      if ( get_status() != 0 )
      {
         goto err_stop_service;
      }
   }
   
   if ( opt_audiosup == 1 )
   {
      if ( get_audiosup() != 0 )
      {
         goto err_stop_service;
      }
   }
   
   if ( opt_dumpedid == 1 )
   {
      if ( dump_edid(dumpedid_filename) != 0 )
      {
         goto err_stop_service;
      }
   }

   if ( opt_showinfo )
   {
      if ( show_info(opt_showinfo-1) != 0 )
      {
         goto err_stop_service;
      }
   }

   if ( opt_name == 1 )
   {
      TV_DEVICE_ID_T id;
      memset(&id, 0, sizeof(id));
      if(vc_tv_get_device_id(&id) == 0) {
         if(id.vendor[0] == '\0' || id.monitor_name[0] == '\0') {
            LOG_ERR( "No device present" );
         } else {
            LOG_STD( "device_name=%s-%s", id.vendor, id.monitor_name);
         }
      } else {
         LOG_ERR( "Failed to obtain device name" );
      }
   }

   if ( opt_monitor == 1 )
   {
      // Wait until we get the signal to exit
      vcos_event_wait( &quit_event );

      vcos_event_delete( &quit_event );
   }

err_stop_service:
//   LOG_INFO( "Stopping tvservice" );

   // Stop the tvservice
   vc_vchi_tv_stop();

   // Disconnect the VCHI connection
   vchi_disconnect( vchi_instance );

   exit( 0 );

err_usage:
   show_usage();

err_out:
   exit( 1 );
}
Ejemplo n.º 7
0
void font::print_to_console ( QTextStream & stream )
{
	stream << QString::fromUtf8 ( "Содержит количество, созданных объектов font = " ) << s_font_main_count << endl;
	stream << QString::fromUtf8 ( "Имя файла оригинала                          = " ) << get_file_name() << endl;
	stream << QString::fromUtf8 ( "attribute                                    = " ) << get_attribute() << endl;
	stream << QString::fromUtf8 ( "Значение above                               = " ) << get_above() << endl;
	stream << QString::fromUtf8 ( "Значение below                               = " ) << get_below() << endl;
	stream << QString::fromUtf8 ( "Значение modes                               = " ) << get_modes() << endl;
	stream << QString::fromUtf8 ( "Количество символов в шрифте                 = " ) << m_forma_l_list->size() << endl;

	/*
	 stream << QString::fromUtf8 ( "Символы шрифта:" ) << endl;

	 for ( int i = 0; i < m_forma_l_list.size(); ++i )
	 {
	  stream << QString::fromUtf8 ( "Номер формы                                i = " ) << i << endl;
	  m_forma_l_list.at ( i ).print_to_console ( stream );
	 }
	*/
}
Ejemplo n.º 8
0
/*---------------------------------------------------*/
void event_handler()
{
	int dummy,ev_bkstate,ev_bkreturn,ev_bbutton,ev_breturn,ev_bmx,ev_bmy;
	int mbuff[8]/*,xs[4]*/;
	int mwhich,obn;
	int col,ba;

	while(1)
	{
		mwhich=evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,1,1,
			1,0,0,
			0,0,0,
			0,0,0,0,
			0,mbuff,0,
			0,&ev_bmx,&ev_bmy,
			&ev_bbutton,&ev_bkstate,
			&ev_bkreturn,&ev_breturn);
		
		if (mwhich&MU_KEYBD);
		
		
		if (mwhich&MU_BUTTON)
		{
			obn=objc_find(rs_object,0,10,ev_bmx,ev_bmy);
			if ((obn==SAVE)&!(rs_object[SAVE].ob_state&DISABLED))

			{
				rs_object[SAVE].ob_state=SELECTED;
				redraw(SAVE);
				save();
				rs_object[SAVE].ob_state=0;
				redraw(SAVE);
			}
			else
			if ((obn==SAVER)&!(rs_object[SAVER].ob_state&DISABLED))
			{
				saver_flag=!saver_flag;
				rs_object[SAVER].ob_state=SELECTED*saver_flag;
				redraw(SAVER);
				get_modes(saver_flag,-3); /* Saver setzten */
			}
			else
			{
				col=(obn-COL2R1)/5;
				ba=obn-5*col-COL2R1;
				if ((col>=0)&&(col<5)&&(ba>=0)&&(ba<=2)&&
					!(rs_object[COL2R1+5*col+ba].ob_state&DISABLED))
				{
					radio(COL2R1+5*col+ba,COL2R1+5*col,COL2R1+5*col+2);
					if (ba==2)
					{
						get_modes(col,0);
					}
					else  
					{
						get_modes(col,1+ba);
					}
					redraw(COL2BOX+5*col);
				}
			}
			(void)evnt_button(1,1,0,&dummy,&dummy,&dummy,&dummy);	
		}
		
		if (mwhich&MU_MESAG)
		{
			if (mbuff[0]==WM_REDRAW)
			{	
				get_conf();
				redraw(TREE1);
			}
			if (mbuff[0]==WM_MOVED)
			{	
				wind_set(wid,WF_CURRXYWH,
		 			mbuff[4],mbuff[5],mbuff[6],mbuff[7]);
		 		(void)wind_get(wid,WF_WORKXYWH,
					&rs_object[TREE1].ob_x,&rs_object[TREE1].ob_y,
					&dummy,&dummy);
			}
			if ((mbuff[0]==WM_TOPPED)||(mbuff[0]==WM_NEWTOP))
				wind_set(wid,WF_TOP);
			if (mbuff[0]==WM_CLOSED)
				quit_all();
			if ((mbuff[0]==AC_OPEN)&&(!open_f))
			{
				open_w();
			}
			if ((mbuff[0]==AC_CLOSE)&(open_f))
			{
				open_f=0;
			}
			if ((mbuff[0]==WM_ICONIFY)||(mbuff[0]==WM_ALLICONIFY))
			{
				wind_set(wid,WF_ICONIFY,mbuff[4],mbuff[5],82,32+24);
			}
			if ((mbuff[0]==WM_UNICONIFY))
			{
				wind_set(wid,WF_UNICONIFY,mbuff[4],mbuff[5],mbuff[6],mbuff[7]);
			}
		}
	}
}