diff mbox

[6/7] Support to disable KMS using config file

Message ID 1373118556-27472-7-git-send-email-kix@kix.es (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rodolfo García Peñas (kix) July 6, 2013, 1:49 p.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 as sign the value to s2ram_disable_kms variable.

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

Patch

diff --git a/s2ram-main.c b/s2ram-main.c
index 40ba17b..c37d578 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 */
@@ -98,9 +101,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-x86.c b/s2ram-x86.c
index ec581a2..78b9433 100644
--- a/s2ram-x86.c
+++ b/s2ram-x86.c
@@ -32,7 +32,7 @@  static unsigned char vga_pci_state[256];
 static struct pci_dev vga_dev;
 static struct pci_access *pacc;
 static int vbe_mode = -1, dmi_scanned;
-static char s2ram_force;
+static char s2ram_force, s2ram_disable_kms;
 static char s2ram_quirks[MAX_STR_LEN];
 int flags, force, fb_nosuspend;
 
@@ -44,6 +44,11 @@  int flags, force, fb_nosuspend;
 
 static struct config_par s2ram_parameters[] = {
 	{
+		.name = "s2ram_disable_kms",
+		.fmt = "%c",
+		.ptr = &s2ram_disable_kms,
+	},
+	{
 		.name = "s2ram_force",
 		.fmt = "%c",
 		.ptr = &s2ram_force,
@@ -431,6 +436,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;