Commit 83477c32 authored by Philippe De Swert's avatar Philippe De Swert

update android modes to use rndis0, fix up networking to accept dyn config values

Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent c52488a9
......@@ -2,7 +2,7 @@
name = adb_mode
module = none
network = 1
network_interface = usb0
network_interface = rndis0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis,adb
sysfs_reset_value = none
......
......@@ -2,7 +2,7 @@
name = developer_mode
module = none
network = 1
network_interface = usb0
network_interface = rndis0
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
......
......@@ -437,7 +437,6 @@ int conf_file_merge(void)
{
log_debug("%d failed loading config file %s\n", test, filename_full);
g_free(filename_full);
break;
}
g_free(filename_full);
log_debug("file data = %s\n", g_key_file_to_data(settingsfile, NULL, NULL));
......
......@@ -263,8 +263,8 @@ int set_ovi_suite_mode(void)
#ifdef DEBIAN
system("ifdown usb0 ; ifup usb0");
#else
usb_network_down();
usb_network_up();
usb_network_down(NULL);
usb_network_up(NULL);
#endif /* DEBIAN */
#ifdef NOKIA
......@@ -293,13 +293,14 @@ int set_dynamic_mode(struct mode_list_elem *data)
g_snprintf(command, 256, "ifdown %s ; ifup %s", data->network_interface, data->network_interface);
system(command);
#else
usb_network_down();
usb_network_up();
usb_network_down(data);
usb_network_up(data);
#endif /* DEBIAN */
}
if(data->sysfs_path)
{
write_to_file(data->sysfs_path, data->sysfs_value);
log_debug("writing to file %s, value %s\n", data->sysfs_path, data->sysfs_reset_value);
}
if(data->softconnect)
{
......@@ -322,6 +323,7 @@ void unset_dynamic_mode(void)
if(data->sysfs_path)
{
write_to_file(data->sysfs_path, data->sysfs_reset_value);
log_debug("writing to file %s, value %s\n", data->sysfs_path, data->sysfs_reset_value);
}
if(data->softconnect)
{
......@@ -437,7 +439,7 @@ int usb_moded_mode_cleanup(const char *module)
sync();
/* bring network down immediately */
/*system("ifdown usb0"); */
usb_network_down();
usb_network_down(NULL);
/* do soft disconnect
write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "0"); */
/* DIRTY WORKAROUND: acm/phonet does not work as it should, remove when it does */
......
......@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "usb_moded-network.h"
#include "usb_moded-config.h"
......@@ -43,7 +45,7 @@
* Activate the network interface
*
*/
int usb_network_up(void)
int usb_network_up(struct mode_list_elem *data)
{
const char *ip, *interface, *gateway;
char command[128];
......@@ -75,8 +77,19 @@ int usb_network_up(void)
return(ret);
#else
if(data)
{
if(data->network_interface)
{
interface = malloc(32*sizeof(char));
strncpy((char *)interface, data->network_interface, 32);
}
}
else
interface = get_network_interface();
ip = get_network_ip();
interface = get_network_interface();
interface = get_network_interface();
gateway = get_network_gateway();
if(ip == NULL)
{
......@@ -103,6 +116,10 @@ int usb_network_up(void)
system(command);
}
free((char *)interface);
free((char *)gateway);
free((char *)ip);
return(0);
#endif /* CONNMAN */
}
......@@ -111,11 +128,32 @@ int usb_network_up(void)
* Deactivate the network interface
*
*/
int usb_network_down(void)
int usb_network_down(struct mode_list_elem *data)
{
#if CONNMAN
#else
system("ifconfig usb0 down");
const char *interface;
char command[128];
if(data)
{
if(data->network_interface)
{
interface = malloc(32*sizeof(char));
strncpy((char *)interface, data->network_interface, 32);
}
}
else
interface = get_network_interface();
if(interface == NULL)
sprintf(command, "ifconfig usb0 down\n");
else
sprintf(command, "ifconfig %s down\n", interface);
system(command);
free((char *)interface);
return(0);
#endif /* CONNMAN */
}
......@@ -22,5 +22,7 @@
/*============================================================================= */
int usb_network_up(void);
int usb_network_down(void);
#include "usb_moded-dyn-config.h"
int usb_network_up(struct mode_list_elem *data);
int usb_network_down(struct mode_list_elem *data);
......@@ -359,6 +359,7 @@ gchar *get_mode_list(void)
{
struct mode_list_elem *data = iter->data;
modelist_str = g_string_append(modelist_str, data->mode_name);
modelist_str = g_string_append(modelist_str, ", ");
}
}
}
......
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