Skip to contentSkip to conversation

Allow override of phonesim conf

PATCH In review Jussi Pakkanen 2 participants 2 messages Mar 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow override of phonesim conf

Hi

Currently phonesim tries to open its conf file from the location specified at configure time (/etc/ofono/phonesim.conf). For testing purposes it would be nice to be able to override this. This patch allows you to override the location with the environment variable OFONO_PHONESIM_CONFIG.

Thanks,

plugins/phonesim.c +6 -2
index 918d2eb..991aaea 100644
@@ -1071,7 +1071,7 @@ done:
 static int phonesim_init(void)
 {
 	int err;
-
+	char *conf_override = getenv("OFONO_PHONESIM_CONFIG");
 	err = ofono_modem_driver_register(&phonesim_driver);
 	if (err < 0)
 		return err;
@@ -1081,7 +1081,11 @@ static int phonesim_init(void)
 	ofono_gprs_context_driver_register(&context_driver);
 	ofono_ctm_driver_register(&ctm_driver);
 
-	parse_config(CONFIGDIR "/phonesim.conf");
+	if(conf_override) {
+		parse_config(conf_override);
+	} else {
+		parse_config(CONFIGDIR "/phonesim.conf");
+	}
 
 	return 0;
 }
#1 lore raw

Hi Jussi,

Quoted 7 lines · Jussi Pakkanen

Hi

Currently phonesim tries to open its conf file from the location specified at configure time (/etc/ofono/phonesim.conf). For testing purposes it would be nice to be able to override this. This patch allows you to override the location with the environment variable OFONO_PHONESIM_CONFIG.

Can you please use git send-email to submit patches.

Also, the coding style in the patch is incorrect. Please review doc/coding-style.txt and the kernel coding style guidelines. Specifically the use of {} in if/else statements.

Regards,
-Denis