diff mbox

[2/3] Support to disable KMS using config file

Message ID 1362998781-4651-3-git-send-email-kix@kix.es (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rodolfo García Peñas (kix) March 11, 2013, 10:46 a.m. UTC
From: "Rodolfo García Peñas (kix)" <kix@kix.es>

This patch adds support to disable the KMS via config file.

The user can add "s2ram_disable_kms = y" to the configuration file
to avoid the use of KMS.

We need move up the call to read the config file for s2ram (get_s2ram_config())
because the test for the "no_kms_flag" [line 90: "if (!no_kms_flag) {"].

In s2ram.c, the function to read the config file search for s2ram_disable_kms" and assign the value to s2ram_disable_kms variable.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
---
 s2ram-main.c |    6 +++---
 s2ram.c      |   11 ++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/s2ram-main.c b/s2ram-main.c
index b430054..27d4823 100644
--- a/s2ram-main.c
+++ b/s2ram-main.c
@@ -84,6 +84,9 @@  int main(int argc, char *argv[])
 		}
 	}
 
+	/* Test if s2ram will use quirks from the configuration file */
+	ret = get_s2ram_config();
+
 	/* Check if the KMS support is disabled by user */
 	if (!no_kms_flag) {
 		/* KMS */
@@ -96,9 +99,6 @@  int main(int argc, char *argv[])
 		printf("KMS disabled by user.\n");
 	}
 
-	/* Test if s2ram will use quirks from the configuration file */
-	ret = get_s2ram_config();
-
 	if (ret) {
 		/* No configuration file, using quirks form database */
 		ret = s2ram_is_supported();
diff --git a/s2ram.c b/s2ram.c
index aa2a605..e04cae6 100644
--- a/s2ram.c
+++ b/s2ram.c
@@ -23,11 +23,16 @@ 
 #include "s2ram.h"
 #include "config_parser.h"
 
-static char s2ram_force;
+static char s2ram_force, s2ram_disable_kms;
 static char s2ram_quirks[MAX_STR_LEN];
 
 static struct config_par s2ram_parameters[] = {
 	{
+		.name = "s2ram_disable_kms",
+		.fmt = "%c",
+		.ptr = &s2ram_disable_kms,
+	},
+	{
 		.name = "s2ram_force",
 		.fmt = "%c",
 		.ptr = &s2ram_force,
@@ -110,6 +115,10 @@  int get_s2ram_config(void)
 			fprintf(stderr, "%s: Could not parse config file\n", ret_name);
 			return error;
 		}
+
+		if (s2ram_disable_kms == 'y')
+			no_kms_flag = 1;
+
 		if (s2ram_force == 'y') {
 			force = 1;