diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2011-10-03 12:29:10 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2011-10-03 12:29:10 -0700 |
commit | 9a47f16b93cbfbfaf8a4730740fdae1e381bb872 (patch) | |
tree | e71d10902910a491439f2fe98f2c1d70769e2054 | |
parent | 2404d4623d9febbe9dc23e82813c6fa211f110ac (diff) |
285.05.09285.05.09
-rw-r--r-- | src/XF86Config-parser/Input.c | 220 | ||||
-rw-r--r-- | src/XF86Config-parser/Read.c | 7 | ||||
-rw-r--r-- | src/XF86Config-parser/Write.c | 2 | ||||
-rw-r--r-- | src/XF86Config-parser/configProcs.h | 2 | ||||
-rw-r--r-- | src/XF86Config-parser/xf86Parser.h | 30 | ||||
-rw-r--r-- | src/XF86Config-parser/xf86tokens.h | 16 | ||||
-rw-r--r-- | src/command-line.c | 5 | ||||
-rw-r--r-- | src/command-line.h | 7 | ||||
-rw-r--r-- | src/config-file.c | 17 | ||||
-rw-r--r-- | src/option-table.h | 6 | ||||
-rw-r--r-- | version.mk | 2 |
11 files changed, 307 insertions, 7 deletions
diff --git a/src/XF86Config-parser/Input.c b/src/XF86Config-parser/Input.c index e016b4f..ea942b7 100644 --- a/src/XF86Config-parser/Input.c +++ b/src/XF86Config-parser/Input.c @@ -71,6 +71,29 @@ XConfigSymTabRec InputTab[] = {-1, ""}, }; +static +XConfigSymTabRec InputClassTab[] = +{ {ENDSECTION, "endsection"}, + {IDENTIFIER, "identifier"}, + {MATCHPRODUCT, "matchproduct"}, + {MATCHVENDOR, "matchvendor"}, + {MATCHOS, "matchos"}, + {MATCHDEVICEPATH, "matchdevicepath"}, + {MATCHPNPID, "matchpnpid"}, + {MATCHUSBID, "matchusbid"}, + {MATCHDRIVER, "matchdriver"}, + {MATCHTAG, "matchtag"}, + {MATCHISKEYBOARD, "matchiskeyboard"}, + {MATCHISJOYSTICK, "matchisjoystick"}, + {MATCHISTABLET, "matchistablet"}, + {MATCHISTOUCHSCREEN, "matchistouchscreen"}, + {MATCHISTOUCHPAD, "matchistouchpad"}, + {MATCHISPOINTER, "matchispointer"}, + {OPTION, "option"}, + {DRIVER, "driver"}, + {-1, ""}, +}; + #define CLEANUP xconfigFreeInputList XConfigInputPtr @@ -120,6 +143,125 @@ xconfigParseInputSection (void) #undef CLEANUP +#define CLEANUP xconfigFreeInputClassList + +XConfigInputClassPtr +xconfigParseInputClassSection (void) +{ + int has_ident = FALSE; + int token; + PARSE_PROLOGUE (XConfigInputClassPtr, XConfigInputClassRec) + + while ((token = xconfigGetToken (InputClassTab)) != ENDSECTION) + { + switch (token) + { + case COMMENT: + ptr->comment = xconfigAddComment(ptr->comment, val.str); + break; + case IDENTIFIER: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); + ptr->identifier = val.str; + has_ident = TRUE; + break; + case DRIVER: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "Driver"); + ptr->driver = val.str; + break; + case MATCHDEVICEPATH: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchDevicePath"); + ptr->match_device_path = val.str; + break; + case MATCHISPOINTER: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsPointer"); + ptr->match_is_pointer = val.str; + break; + case MATCHISTOUCHPAD: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsTouchpad"); + ptr->match_is_touchpad = val.str; + break; + case MATCHISKEYBOARD: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsKeyboard"); + ptr->match_is_keyboard = val.str; + break; + case MATCHISTOUCHSCREEN: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsTouchscreen"); + ptr->match_is_touchscreen = val.str; + break; + case MATCHISJOYSTICK: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsJoystick"); + ptr->match_is_joystick = val.str; + break; + case MATCHISTABLET: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchIsTablet"); + ptr->match_is_tablet = val.str; + break; + case MATCHUSBID: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchUSBID"); + ptr->match_usb_id = val.str; + break; + case MATCHPNPID: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchPnPID"); + ptr->match_pnp_id = val.str; + break; + case MATCHPRODUCT: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchProduct"); + ptr->match_product = val.str; + break; + case MATCHDRIVER: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchDriver"); + ptr->match_driver = val.str; + break; + case MATCHOS: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchOS"); + ptr->match_os = val.str; + break; + case MATCHTAG: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchTag"); + ptr->match_tag = val.str; + break; + case MATCHVENDOR: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "MatchVendor"); + ptr->match_vendor = val.str; + break; + case OPTION: + ptr->options = xconfigParseOption(ptr->options); + break; + case EOF_TOKEN: + Error (UNEXPECTED_EOF_MSG, NULL); + break; + default: + Error (INVALID_KEYWORD_MSG, xconfigTokenString ()); + break; + } + } + + if (!has_ident) + Error (NO_IDENT_MSG, NULL); + + return ptr; +} + +#undef CLEANUP + void xconfigPrintInputSection (FILE * cf, XConfigInputPtr ptr) { @@ -139,6 +281,50 @@ xconfigPrintInputSection (FILE * cf, XConfigInputPtr ptr) } void +xconfigPrintInputClassSection (FILE * cf, XConfigInputClassPtr ptr) +{ + while (ptr) + { + fprintf (cf, "Section \"InputClass\"\n"); + if (ptr->comment) + fprintf (cf, "%s", ptr->comment); + if (ptr->identifier) + fprintf (cf, " Identifier \"%s\"\n", ptr->identifier); + if (ptr->driver) + fprintf (cf, " Driver \"%s\"\n", ptr->driver); + if (ptr->match_is_pointer) + fprintf (cf, " MatchIsPointer \"%s\"\n", ptr->match_is_pointer); + if (ptr->match_is_touchpad) + fprintf (cf, " MatchIsTouchpad \"%s\"\n", ptr->match_is_touchpad); + if (ptr->match_is_keyboard) + fprintf (cf, " MatchIsKeyboard \"%s\"\n", ptr->match_is_keyboard); + if (ptr->match_is_joystick) + fprintf (cf, " MatchIsJoystick \"%s\"\n", ptr->match_is_joystick); + if (ptr->match_is_touchscreen) + fprintf (cf, " MatchIsTouchscreen \"%s\"\n", ptr->match_is_touchscreen); + if (ptr->match_is_tablet) + fprintf (cf, " MatchIsTablet \"%s\"\n", ptr->match_is_tablet); + if (ptr->match_device_path) + fprintf (cf, " MatchDevicePath \"%s\"\n", ptr->match_device_path); + if (ptr->match_os) + fprintf (cf, " MatchOS \"%s\"\n", ptr->match_os); + if (ptr->match_pnp_id) + fprintf (cf, " MatchPnPID \"%s\"\n", ptr->match_pnp_id); + if (ptr->match_driver) + fprintf (cf, " MatchDriver \"%s\"\n", ptr->match_driver); + if (ptr->match_usb_id) + fprintf (cf, " MatchUSBID \"%s\"\n", ptr->match_usb_id); + if (ptr->match_tag) + fprintf (cf, " MatchTag \"%s\"\n", ptr->match_tag); + if (ptr->match_vendor) + fprintf (cf, " MatchVendor \"%s\"\n", ptr->match_vendor); + xconfigPrintOptionList(cf, ptr->options, 1); + fprintf (cf, "EndSection\n\n"); + ptr = ptr->next; + } +} + +void xconfigFreeInputList (XConfigInputPtr *ptr) { XConfigInputPtr prev; @@ -159,6 +345,40 @@ xconfigFreeInputList (XConfigInputPtr *ptr) } } +void +xconfigFreeInputClassList (XConfigInputClassPtr *ptr) +{ + XConfigInputClassPtr prev; + + if (ptr == NULL || *ptr == NULL) + return; + + while (*ptr) + { + TEST_FREE ((*ptr)->identifier); + TEST_FREE ((*ptr)->driver); + TEST_FREE ((*ptr)->comment); + TEST_FREE ((*ptr)->match_product); + TEST_FREE ((*ptr)->match_vendor); + TEST_FREE ((*ptr)->match_driver); + TEST_FREE ((*ptr)->match_device_path); + TEST_FREE ((*ptr)->match_os); + TEST_FREE ((*ptr)->match_pnp_id); + TEST_FREE ((*ptr)->match_usb_id); + TEST_FREE ((*ptr)->match_is_pointer); + TEST_FREE ((*ptr)->match_is_touchpad); + TEST_FREE ((*ptr)->match_is_touchscreen); + TEST_FREE ((*ptr)->match_is_keyboard); + TEST_FREE ((*ptr)->match_is_tablet); + TEST_FREE ((*ptr)->match_is_joystick); + xconfigFreeOptionList (&((*ptr)->options)); + + prev = *ptr; + *ptr = (*ptr)->next; + free (prev); + } +} + int xconfigValidateInput (XConfigPtr p) { diff --git a/src/XF86Config-parser/Read.c b/src/XF86Config-parser/Read.c index 28b0432..836360e 100644 --- a/src/XF86Config-parser/Read.c +++ b/src/XF86Config-parser/Read.c @@ -195,6 +195,13 @@ XConfigError xconfigReadConfigFile(XConfigPtr *configPtr) READ_HANDLE_LIST(inputs, xconfigParseInputSection, XConfigInputPtr); } + else if ((xconfigNameCompare(val.str, "inputclass") == 0)) + { + free(val.str); + val.str = NULL; + READ_HANDLE_LIST(inputclasses, xconfigParseInputClassSection, + XConfigInputClassPtr); + } else if (xconfigNameCompare(val.str, "module") == 0) { free(val.str); diff --git a/src/XF86Config-parser/Write.c b/src/XF86Config-parser/Write.c index 98b1dd6..59f8fe6 100644 --- a/src/XF86Config-parser/Write.c +++ b/src/XF86Config-parser/Write.c @@ -116,6 +116,8 @@ int xconfigWriteConfigFile (const char *filename, XConfigPtr cptr) xconfigPrintInputSection (cf, cptr->inputs); + xconfigPrintInputClassSection (cf, cptr->inputclasses); + xconfigPrintVideoAdaptorSection (cf, cptr->videoadaptors); xconfigPrintModesSection (cf, cptr->modes); diff --git a/src/XF86Config-parser/configProcs.h b/src/XF86Config-parser/configProcs.h index 59bac71..2f18cb0 100644 --- a/src/XF86Config-parser/configProcs.h +++ b/src/XF86Config-parser/configProcs.h @@ -45,7 +45,9 @@ void xconfigPrintServerFlagsSection(FILE *f, XConfigFlagsPtr flags); /* Input.c */ XConfigInputPtr xconfigParseInputSection(void); +XConfigInputClassPtr xconfigParseInputClassSection(void); void xconfigPrintInputSection(FILE *f, XConfigInputPtr ptr); +void xconfigPrintInputClassSection(FILE *f, XConfigInputClassPtr ptr); int xconfigValidateInput (XConfigPtr p); /* Keyboard.c */ diff --git a/src/XF86Config-parser/xf86Parser.h b/src/XF86Config-parser/xf86Parser.h index 65855dc..09fccad 100644 --- a/src/XF86Config-parser/xf86Parser.h +++ b/src/XF86Config-parser/xf86Parser.h @@ -408,6 +408,34 @@ typedef struct __xconfigconfinputrec { /* + * Input Class Section + */ + +typedef struct __xconfigconfinputclassrec { + struct __xconfigconfinputclassrec *next; + char *identifier; + char *driver; + char *match_is_pointer; + char *match_is_touchpad; + char *match_is_touchscreen; + char *match_is_keyboard; + char *match_is_joystick; + char *match_is_tablet; + char *match_tag; + char *match_device_path; + char *match_os; + char *match_usb_id; + char *match_pnp_id; + char *match_product; + char *match_driver; + char *match_vendor; + XConfigOptionPtr options; + char *comment; +} XConfigInputClassRec, *XConfigInputClassPtr; + + + +/* * Input Reference; used by layout to store list of XConfigInputPtrs */ @@ -564,6 +592,7 @@ typedef struct { XConfigDevicePtr devices; XConfigScreenPtr screens; XConfigInputPtr inputs; + XConfigInputClassPtr inputclasses; XConfigLayoutPtr layouts; XConfigVendorPtr vendors; XConfigDRIPtr dri; @@ -638,6 +667,7 @@ void xconfigFreeDeviceList(XConfigDevicePtr *ptr); void xconfigFreeFiles(XConfigFilesPtr *p); void xconfigFreeFlags(XConfigFlagsPtr *flags); void xconfigFreeInputList(XConfigInputPtr *ptr); +void xconfigFreeInputClassList(XConfigInputClassPtr *ptr); void xconfigFreeLayoutList(XConfigLayoutPtr *ptr); void xconfigFreeAdjacencyList(XConfigAdjacencyPtr *ptr); void xconfigFreeInputrefList(XConfigInputrefPtr *ptr); diff --git a/src/XF86Config-parser/xf86tokens.h b/src/XF86Config-parser/xf86tokens.h index d44dcbf..67c1df0 100644 --- a/src/XF86Config-parser/xf86tokens.h +++ b/src/XF86Config-parser/xf86tokens.h @@ -169,6 +169,22 @@ typedef enum { LOAD_DRIVER, DISABLE, + /* InputClass tokens */ + MATCHPRODUCT, + MATCHISPOINTER, + MATCHISTOUCHPAD, + MATCHISTOUCHSCREEN, + MATCHISKEYBOARD, + MATCHISJOYSTICK, + MATCHISTABLET, + MATCHOS, + MATCHTAG, + MATCHUSBID, + MATCHPNPID, + MATCHVENDOR, + MATCHDRIVER, + MATCHDEVICEPATH, + /* Device tokens */ DRIVER, CHIPSET, diff --git a/src/command-line.c b/src/command-line.c index 8b21c46..c6f3763 100644 --- a/src/command-line.c +++ b/src/command-line.c @@ -53,6 +53,8 @@ static void print_help(void); int __verbosity = VERBOSITY_DEFAULT; int __terse = NV_FALSE; int __display_device_string = NV_FALSE; +int __verbosity_level_changed = NV_FALSE; + /* * print_version() - print version information */ @@ -271,6 +273,8 @@ Options *parse_command_line(int argc, char *argv[], char *dpy) if (!strval) { /* user didn't give argument, assume "all" */ __verbosity = VERBOSITY_ALL; + } else if (nv_strcasecmp(strval, "none") == NV_TRUE) { + __verbosity = VERBOSITY_NONE; } else if (nv_strcasecmp(strval, "errors") == NV_TRUE) { __verbosity = VERBOSITY_ERROR; } else if (nv_strcasecmp(strval, "warnings") == NV_TRUE) { @@ -283,6 +287,7 @@ Options *parse_command_line(int argc, char *argv[], char *dpy) strval, argv[0]); exit(0); } + __verbosity_level_changed = NV_TRUE; break; case 'a': n = op->num_assignments; diff --git a/src/command-line.h b/src/command-line.h index 307f767..b180c79 100644 --- a/src/command-line.h +++ b/src/command-line.h @@ -31,9 +31,10 @@ #define CONFIG_FILE_OPTION 1 -#define VERBOSITY_ERROR 0 /* errors only */ -#define VERBOSITY_WARNING 1 /* errors and warnings */ -#define VERBOSITY_ALL 2 /* errors, warnings and other info */ +#define VERBOSITY_NONE 0 /* nothing */ +#define VERBOSITY_ERROR 1 /* errors only */ +#define VERBOSITY_WARNING 2 /* errors and warnings */ +#define VERBOSITY_ALL 3 /* errors, warnings and other info */ #define VERBOSITY_DEFAULT VERBOSITY_ERROR diff --git a/src/config-file.c b/src/config-file.c index 8230d3f..9b5d977 100644 --- a/src/config-file.c +++ b/src/config-file.c @@ -84,6 +84,8 @@ static int parse_config_property(const char *file, const char *line, static void write_config_properties(FILE *stream, ConfigProperties *conf, char *locale); +extern int __verbosity; +extern int __verbosity_level_changed; /* * nv_read_config_file() - read the specified config file, building a @@ -582,6 +584,15 @@ static int process_config_file_attributes(const char *file, int i, j, ret, found, n = 0; CtrlHandles **h = NULL; + int old_verbosity = __verbosity; + + /* Override the verbosity in the default behavior so + * nvidia-settings isn't so alarmist when loading the RC file. + */ + if (!__verbosity_level_changed) { + __verbosity = VERBOSITY_NONE; + } + /* * make sure that all ParsedAttributes have displays (this will do * nothing if we already have a display name @@ -638,6 +649,12 @@ static int process_config_file_attributes(const char *file, */ } + /* Reset the default verbosity */ + + if (!__verbosity_level_changed) { + __verbosity = old_verbosity; + } + /* free all the CtrlHandles we allocated */ for (i = 0; i < n; i++) { diff --git a/src/option-table.h b/src/option-table.h index 3c21261..3e163d0 100644 --- a/src/option-table.h +++ b/src/option-table.h @@ -71,9 +71,9 @@ static const NVGetoptOption __options[] = { NVGETOPT_STRING_ARGUMENT | NVGETOPT_ARGUMENT_IS_OPTIONAL, NULL, "Controls how much information is printed. By default, the verbosity " "is <errors> and only error messages are printed. Valid values are " - "<'errors'> (print error messages), <'warnings'> (print error and " - "warning messages), and <'all'> (print error, warning and other " - "informational messages)." }, + "<'none'> (do not print messages), <'errors'> (print error messages), " + "<'warnings'> (print error and warning messages), and " + "<'all'> (print error, warning and other informational messages)." }, { "assign", 'a', NVGETOPT_STRING_ARGUMENT, NULL, "The ^ASSIGN> argument to the <'--assign'> command line option is of the " @@ -1 +1 @@ -NVIDIA_VERSION = 285.03 +NVIDIA_VERSION = 285.05.09 |