Commit 7a2607c1 authored by spiiroin's avatar spiiroin

[android] Do not require android configuration block. Fixes JB#41303

Usb-moded does android usb initialization only if there is a non-empty
configuration block in the ini-files. This does not make sense anymore
as the values defined in the config file are used as fallback solution
if required data can't be obtained by other means.

If android_usb specific sysfs controls are present on the device, try
to initialize them regardless of whether ubs-moded configuration files
contain relevant information or not.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 70cb7de2
......@@ -29,19 +29,6 @@
#include "usb_moded-config.h"
#include "usb_moded-mac.h"
/** check if android settings are set
*
* @return 1 if settings are available, 0 if not
*
*/
int android_settings(void)
{
int ret = 0;
ret = check_android_section();
return ret;
}
/** Read android serial number from kernel command line
*/
......@@ -97,6 +84,11 @@ void android_init_values(void)
{
gchar *text;
if( access("/sys/class/android_usb/android0", F_OK) != 0 )
{
goto EXIT;
}
if( (text = get_android_serial()) )
{
write_to_file("/sys/class/android_usb/android0/iSerial", text);
......@@ -139,6 +131,9 @@ void android_init_values(void)
/* Make sure android_usb does not stay disabled in case usb moded
* has crashed / been killed in inconvenient time. */
write_to_file("/sys/class/android_usb/android0/enable", "1");
EXIT:
return;
}
/* Set a charging mode for the android gadget
......
......@@ -20,7 +20,6 @@
02110-1301 USA
*/
int android_settings(void);
void android_init_values(void);
int set_android_charging_mode(void);
int set_android_productid(char *id);
......
......@@ -859,33 +859,6 @@ char * get_mode_whitelist(void)
return(get_conf_string(MODE_SETTING_ENTRY, MODE_WHITELIST_KEY));
}
int check_android_section(void)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
gchar **keys;
int ret = 1;
settingsfile = g_key_file_new();
test = g_key_file_load_from_file(settingsfile, FS_MOUNT_CONFIG_FILE, G_KEY_FILE_NONE, NULL);
if(!test)
{
ret = 0;
goto cleanup;
}
keys = g_key_file_get_keys (settingsfile, ANDROID_ENTRY, NULL, NULL);
if(keys == NULL)
{
ret = 0;
goto cleanup;
}
g_strfreev(keys);
cleanup:
g_key_file_free(settingsfile);
return(ret);
}
int is_roaming_not_allowed(void)
{
return(get_conf_int(NETWORK_ENTRY, NO_ROAMING_KEY));
......
......@@ -83,8 +83,6 @@ char * get_android_product_id(void);
char * get_hidden_modes(void);
char * get_mode_whitelist(void);
int check_android_section(void);
int is_roaming_not_allowed(void);
typedef enum set_config_result_t {
......
......@@ -733,8 +733,8 @@ static void usb_moded_init(void)
usb_moded_module_ctx_init();
/* Android specific stuff */
if(android_settings())
android_init_values();
android_init_values();
/* TODO: add more start-up clean-up and init here if needed */
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment