/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* efb_properties - efb device-specific properties
*
* XVR-50 (pfb w/ Xsun)
* XVR-100 (pfb w/ Xsun)
* XVR-300 (nfb w/ Xsun)
* XVR-300x8 (nfb w/ Xsun)
*/
#include <stdlib.h> /* free() */
#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
#include "fbc_error.h" /* Error reporting */
#include "fbc_getargs.h" /* Program command line processing */
#include "fbc_help.h" /* Program usage and help messages */
#include "fbc_properties.h" /* Establish fbconf_xorg program properties */
#include "fbc_propt.h" /* Display the current option settings */
#include "fbc_query_device.h" /* Query a frame buffer device */
#include "fbc_xorg.h" /* Edit config file data representations */
#include "efb_prconf.h" /* Display efb hardware configuration */
#include "efb_predid.h" /* Display EDID data */
#include "efb_properties.h" /* efb device-specific properties */
#include "efb_query_device.h" /* Query the efb graphics device */
#include "efb_res_try_now.h" /* Video mode setting (-res try now) */
/*
* Tell fbconf_xorg(1M) what API version libSUNWefb_conf is using
*/
/*
* Usage (error) message text
*/
static const char *efb_usage_text_body_xvr_50 =
" [-dev device-filename]\n"
"\t\t [-file machine | system | config-path]\n"
"\t\t [-res video-mode [nocheck | noconfirm] [try] [now]]\n"
"\t\t [-g gamma-value]\n"
"\t\t [-rscreen enable | disable]\n"
"\t\t [-defaults]\n"
"\t\t [-help]\n"
"\t\t [-res \\?]\n"
"\t\t [-prconf] [-predid [raw] [parsed]] [-propt]\n"
"\n";
static const char *efb_usage_text_body_xvr_100 =
" [-dev device-filename]\n"
"\t\t [-file machine | system | config-path]\n"
"\t\t [-res video-mode [nocheck | noconfirm] [try] [now]]\n"
"\t\t [-clone enable | disable]\n"
"\t\t [-doublewide enable | disable]\n"
"\t\t [-doublehigh enable | disable]\n"
"\t\t [-g gamma-value]\n"
"\t\t [-offset xoff-value yoff-value]\n"
"\t\t [-outputs swapped | direct]\n"
"\t\t [-defaults]\n"
"\t\t [-help]\n"
"\t\t [-res \\?]\n"
"\t\t [-prconf] [-predid [raw] [parsed]] [-propt]\n"
"\n";
static const char *efb_usage_text_body_xvr_300 =
" [-dev devname] [-file machine | system | config-path]\n"
"\t\t [-res video-mode [nocheck | noconfirm] [try] [now]]\n"
"\t\t [-clone enable | disable]\n"
"\t\t [-doublewide enable | disable]\n"
"\t\t [-doublehigh enable | disable]\n"
"\t\t [-g gamma-value]\n"
"\t\t [-offset xoff-value yoff-value]\n"
"\t\t [-outputs swapped | direct]\n"
"\t\t [-defaults]\n"
"\t\t [-help]\n"
"\t\t [-res \\?]\n"
"\t\t [-prconf] [-predid [raw] [parsed]] [-propt]\n"
"\n";
/*
* Help (-help) message text
*/
" -offset Adjusts the position of the secondary stream.\n"
" Currently only implemented in -doublewide and\n"
" -doublehigh modes.\n"
" With -doublewide, the xoff-value is used to position\n"
" the secondary DVI stream. With -doublehigh, the\n"
" yoff-value is used instead. The secondary stream is\n"
" 2 if the -outputs setting is direct, and 1 if it is\n"
" swapped. A negative value specifies the overlapped\n"
" region with the primary stream. A positive value is\n"
" treated as 0.\n"
" Default: [0,0]\n";
/*
* Command line option descriptors for fbconf_xorg(1M) and efb devices
*
* These table entries must be in -help display order.
*
* When fbc_Option_keyword() is the "Option handler function"
* (fbopt_descr_t.fbc_getopt_fn member), the "Config Option entry
* name(s)" string (fbopt_descr_t.conf_name member) is composed of
* contiguous Nul-terminated Option names that are terminated by an
* additional Nul, e.g.:
* FBC_KEYWD_DoubleWide "\0" FBC_KEYWD_DoubleHigh "\0"
* or (nominally):
* "DoubleWide\0DoubleHigh\0\0"
*
* See fbc_getopt.h for the relevant declarations and definitions.
*/
{
/* -defaults */
"defaults", /* Command line option name */
fbc_help_defaults, /* Help text */
0, /* Min # of option arguments */
fbc_opt_defaults, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* *** POSITIVELY NO RECURSIVE DEFAULTS! *** */
},
{
/* -dev <device> */
"dev", /* Command line option name */
fbc_help_dev, /* Help text */
1, /* Min # of option arguments */
fbc_opt_dev, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTN_Device, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -file machine|system|<config-path> */
"file", /* Command line option name */
fbc_help_file, /* Help text */
1, /* Min # of option arguments */
fbc_opt_file, /* Option handler function */
fbc_keywds_file, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -g <gamma-value> */
"g", /* Command line option name */
fbc_help_g, /* Help text */
1, /* Min # of option arguments */
fbc_opt_Gamma, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_Gamma, /* Config section code */
NULL, /* Config Option entry name(s) */
fbc_defargv_g /* argv[] invoked by -defaults */
},
{
/* -help */
"help", /* Command line option name */
fbc_help_help, /* Help text */
0, /* Min # of option arguments */
fbc_opt_help, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -prconf */
"prconf", /* Command line option name */
fbc_help_prconf, /* Help text */
0, /* Min # of option arguments */
fbc_opt_prconf, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -predid [raw] [parsed] */
"predid", /* Command line option name */
fbc_help_predid, /* Help text */
0, /* Min # of option arguments */
fbc_opt_predid, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -propt */
"propt", /* Command line option name */
fbc_help_propt, /* Help text */
0, /* Min # of option arguments */
fbc_opt_propt, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -res ? */
/* -res <video-mode> [nocheck|noconfirm] [try] [now] */
"res", /* Command line option name */
fbc_help_res_nntn, /* Help text */
1, /* Min # of option arguments */
fbc_opt_res, /* Option handler function */
fbc_keywds_res_nntn, /* Command line option keywords */
FBC_SECTN_Res, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -rscreen enable|disable */
"rscreen", /* Command line option name */
fbc_help_rscreen, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_RScreen, /* Config section code */
fbc_defargv_rscreen /* argv[] invoked by -defaults */
},
{
/* End-of-table marker */
NULL, /* Command line option name */
NULL, /* Help text */
0, /* Min # of option arguments */
NULL, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
}
};
{
/* -clone enable|disable */
"clone", /* Command line option name */
fbc_help_clone, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_Clone, /* Config section code */
fbc_defargv_clone /* argv[] invoked by -defaults */
},
{
/* -defaults */
"defaults", /* Command line option name */
fbc_help_defaults, /* Help text */
0, /* Min # of option arguments */
fbc_opt_defaults, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* *** POSITIVELY NO RECURSIVE DEFAULTS! *** */
},
{
/* -dev <device> */
"dev", /* Command line option name */
fbc_help_dev, /* Help text */
1, /* Min # of option arguments */
fbc_opt_dev, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTN_Device, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -doublewide enable|disable */
"doublewide", /* Command line option name */
fbc_help_doublewide, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_DoubleWide, /* Config section code */
FBC_KEYWD_DoubleWide "\0"
FBC_KEYWD_DoubleHigh "\0",
fbc_defargv_doublewide /* argv[] invoked by -defaults */
},
{
/* -doublehigh enable|disable */
"doublehigh", /* Command line option name */
fbc_help_doublehigh, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_DoubleHigh, /* Config section code */
FBC_KEYWD_DoubleHigh "\0"
FBC_KEYWD_DoubleWide "\0",
fbc_defargv_doublehigh /* argv[] invoked by -defaults */
},
{
/* -file machine|system|<config-path> */
"file", /* Command line option name */
fbc_help_file, /* Help text */
1, /* Min # of option arguments */
fbc_opt_file, /* Option handler function */
fbc_keywds_file, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -g <gamma-value> */
"g", /* Command line option name */
fbc_help_g, /* Help text */
1, /* Min # of option arguments */
fbc_opt_Gamma, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_Gamma, /* Config section code */
NULL, /* Config Option entry name(s) */
fbc_defargv_g /* argv[] invoked by -defaults */
},
{
/* -help */
"help", /* Command line option name */
fbc_help_help, /* Help text */
0, /* Min # of option arguments */
fbc_opt_help, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -offset <xoff> <yoff> */
"offset", /* Command line option name */
fbc_help_offset, /* Help text */
2, /* Min # of option arguments */
fbc_Option_Stream_Offset, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTN_StreamXOffset, /* Config section code */
fbc_defargv_offset /* argv[] invoked by -defaults */
},
{
/* -outputs swapped|direct */
"outputs", /* Command line option name */
fbc_help_outputs, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_swappedirect, /* Command line option keywords */
FBC_SECTN_Outputs, /* Config section code */
fbc_defargv_outputs /* argv[] invoked by -defaults */
},
{
/* -prconf */
"prconf", /* Command line option name */
fbc_help_prconf, /* Help text */
0, /* Min # of option arguments */
fbc_opt_prconf, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -predid [raw] [parsed] */
"predid", /* Command line option name */
fbc_help_predid, /* Help text */
0, /* Min # of option arguments */
fbc_opt_predid, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -propt */
"propt", /* Command line option name */
fbc_help_propt, /* Help text */
0, /* Min # of option arguments */
fbc_opt_propt, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -res ? */
/* -res <video-mode> [nocheck|noconfirm] [try] [now] */
"res", /* Command line option name */
fbc_help_res_nntn, /* Help text */
1, /* Min # of option arguments */
fbc_opt_res, /* Option handler function */
fbc_keywds_res_nntn, /* Command line option keywords */
FBC_SECTN_Res, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* End-of-table marker */
NULL, /* Command line option name */
NULL, /* Help text */
0, /* Min # of option arguments */
NULL, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
}
};
{
/* -clone enable|disable */
"clone", /* Command line option name */
fbc_help_clone, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_Clone, /* Config section code */
fbc_defargv_clone /* argv[] invoked by -defaults */
},
{
/* -defaults */
"defaults", /* Command line option name */
fbc_help_defaults, /* Help text */
0, /* Min # of option arguments */
fbc_opt_defaults, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* *** POSITIVELY NO RECURSIVE DEFAULTS! *** */
},
{
/* -dev <device> */
"dev", /* Command line option name */
fbc_help_dev, /* Help text */
1, /* Min # of option arguments */
fbc_opt_dev, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTN_Device, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -doublehigh enable|disable */
"doublehigh", /* Command line option name */
fbc_help_doublehigh, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_DoubleHigh, /* Config section code */
FBC_KEYWD_DoubleHigh "\0"
FBC_KEYWD_DoubleWide "\0",
fbc_defargv_doublehigh /* argv[] invoked by -defaults */
},
{
/* -doublewide enable|disable */
"doublewide", /* Command line option name */
fbc_help_doublewide, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_DoubleWide, /* Config section code */
FBC_KEYWD_DoubleWide "\0"
FBC_KEYWD_DoubleHigh "\0",
fbc_defargv_doublewide /* argv[] invoked by -defaults */
},
{
/* -file machine|system|<config-path> */
"file", /* Command line option name */
fbc_help_file, /* Help text */
1, /* Min # of option arguments */
fbc_opt_file, /* Option handler function */
fbc_keywds_file, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -g <gamma-value> */
"g", /* Command line option name */
fbc_help_g, /* Help text */
1, /* Min # of option arguments */
fbc_opt_Gamma, /* Option handler function */
fbc_keywds_xable, /* Command line option keywords */
FBC_SECTN_Gamma, /* Config section code */
NULL, /* Config Option entry name(s) */
fbc_defargv_g /* argv[] invoked by -defaults */
},
{
/* -help */
"help", /* Command line option name */
fbc_help_help, /* Help text */
0, /* Min # of option arguments */
fbc_opt_help, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -offset <xoff> <yoff> */
"offset", /* Command line option name */
efb_help_offset, /* Help text */
2, /* Min # of option arguments */
fbc_Option_Stream_Offset, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTN_StreamXOffset, /* Config section code */
fbc_defargv_offset /* argv[] invoked by -defaults */
},
{
/* -outputs swapped|direct */
"outputs", /* Command line option name */
fbc_help_outputs, /* Help text */
1, /* Min # of option arguments */
fbc_Option_keyword, /* Option handler function */
fbc_keywds_swappedirect, /* Command line option keywords */
FBC_SECTN_Outputs, /* Config section code */
fbc_defargv_outputs /* argv[] invoked by -defaults */
},
{
/* -prconf */
"prconf", /* Command line option name */
fbc_help_prconf, /* Help text */
0, /* Min # of option arguments */
fbc_opt_prconf, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -predid [raw] [parsed] */
"predid", /* Command line option name */
fbc_help_predid, /* Help text */
0, /* Min # of option arguments */
fbc_opt_predid, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -propt */
"propt", /* Command line option name */
fbc_help_propt, /* Help text */
0, /* Min # of option arguments */
fbc_opt_propt, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* -res ? */
/* -res <video_mode> [nocheck|noconfirm] [try] [now] */
"res", /* Command line option name */
fbc_help_res_nntn, /* Help text */
1, /* Min # of option arguments */
fbc_opt_res, /* Option handler function */
fbc_keywds_res_nntn, /* Command line option keywords */
FBC_SECTN_Res, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
},
{
/* End-of-table marker */
NULL, /* Command line option name */
NULL, /* Help text */
0, /* Min # of option arguments */
NULL, /* Option handler function */
NULL, /* Command line option keywords */
FBC_SECTION_NONE, /* Config section code */
NULL, /* Config Option entry name(s) */
NULL /* argv[] invoked by -defaults */
}
};
/*
* List of functions to display the current option settings (-propt)
*/
fbc_propt_file, /* Configuration file */
fbc_propt_video_mode, /* Current video mode name: -res */
fbc_propt_screen_title, /* Screen settings title */
fbc_propt_rscreen, /* Remote console setting: -rscreen */
fbc_propt_visual_title, /* Visual Information title */
fbc_propt_g, /* Gamma setting: -g only */
NULL /* End of table */
};
fbc_propt_file, /* Configuration file */
fbc_propt_video_mode, /* Current video mode name: -res */
fbc_propt_screen_title, /* Screen settings title */
fbc_propt_dual_screen, /* Dual-screen: -doublexxxxx */
fbc_propt_clone, /* Clone setting */
fbc_propt_offset, /* Screen offset settings */
fbc_propt_outputs, /* Outputs setting */
fbc_propt_visual_title, /* Visual Information title */
fbc_propt_g, /* Gamma setting: -g only */
NULL /* End of table */
};
fbc_propt_file, /* Configuration file */
fbc_propt_video_mode, /* Current video mode name: -res */
fbc_propt_screen_title, /* Screen settings title */
fbc_propt_dual_screen, /* Dual-screen: -doublexxxxx */
fbc_propt_clone, /* Clone setting */
fbc_propt_offset, /* Screen offset settings */
fbc_propt_outputs, /* Outputs setting */
fbc_propt_visual_title, /* Visual Information title */
fbc_propt_default_visual, /* Default visual: -defxxxxx" */
fbc_propt_g, /* Gamma setting: -g only */
NULL /* End of table */
};
/*
* SUNWefb_get_properties()
*
* Return the fbconf_xorg(1M) properties for the efb frame buffer
* device type.
*/
int
{
/*
* Provide some more frame buffer device information
*/
/*
* Establish the device properties and the fbconf_xorg(1M) behavior
*/
sizeof (efb_option_xvr_300) / sizeof (fbopt_descr_t)
+ 1; /* StreamYOffset */
/*
* Distinguish between the various frame buffer models
*/
if (full_model_name != NULL) {
sizeof (efb_option_xvr_50)
/ sizeof (fbopt_descr_t);
} else
sizeof (efb_option_xvr_100)
/ sizeof (fbopt_descr_t);
} else {
/*
* XVR-300[x8]
*/
sizeof (efb_option_xvr_300)
/ sizeof (fbopt_descr_t);
}
}
return (FBC_SUCCESS);
} /* SUNWefb_get_properties() */
/* End of efb_properties.c */