Commit 3f720ca9 authored by Philippe De Swert's avatar Philippe De Swert

Include the new mode data in the mode setting chain

Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent fae2d26c
......@@ -296,6 +296,14 @@ int set_dynamic_mode(struct mode_list_elem *data)
usb_network_up();
#endif /* DEBIAN */
}
if(data->sysfs_path)
{
write_to_file(data->sysfs_path, data->sysfs_value);
}
if(data->softconnect)
{
write_to_file(data->softconnect_path, data->softconnect);
}
return(0);
}
......
......@@ -32,7 +32,6 @@
#define MODULE_NONE "none"
#define MODULE_DEVELOPER "g_ether"
#define MODULE_MTP "g_ffs"
#define MODULE_NONE "none"
/* load module */
int usb_moded_load_module(const char *module);
......
......@@ -279,16 +279,20 @@ void set_usb_mode(const char *mode)
set_usb_module(data->mode_module);
ret = usb_moded_load_module(data->mode_module);
ret = set_dynamic_mode(data);
set_usb_mode_data(data);
}
}
}
end:
/* if ret != 0 then usb_module loading failed */
/* if ret != 0 then usb_module loading failed
no mode matched or MODE_UNDEFINED was requested */
if(ret)
{
set_usb_module(MODULE_NONE);
mode = MODE_UNDEFINED;
/*TODO: unset_dynamic_mode */
set_usb_mode_data(NULL);
}
if(net)
log_debug("Network setting failed!\n");
......@@ -412,6 +416,26 @@ inline void set_usb_connection_state(gboolean state)
current_mode.connected = state;
}
/** set the mode_list_elem data
*
* @param data mode_list_element pointer
*
*/
void set_usb_mode_data(struct mode_list_elem *data)
{
current_mode.data = data;
}
/** get the usb mode data
*
* @return a pointer to the usb mode data
*
*/
inline struct mode_list_elem * get_usb_mode_data(void)
{
return(current_mode.data);
}
/*================ Static functions ===================================== */
/* set default values for usb_moded */
......
......@@ -35,6 +35,8 @@
#include <glib-2.0/glib.h>
#include <glib-object.h>
#include "usb_moded-dyn-config.h"
#define USB_MODED_LOCKFILE "/var/run/usb_moded.pid"
#define MAX_READ_BUF 512
......@@ -44,10 +46,11 @@
typedef struct usb_mode
{
/*@{*/
gboolean connected; /* connection status, 1 for connected */
gboolean mounted; /* mount status, 1 for mounted -UNUSED atm- */
char *mode; /* the mode name */
char *module; /* the module name for the specific mode */
gboolean connected; /* connection status, 1 for connected */
gboolean mounted; /* mount status, 1 for mounted -UNUSED atm- */
char *mode; /* the mode name */
char *module; /* the module name for the specific mode */
struct mode_list_elem *data; /* contains the mode data */
/*@}*/
}usb_mode;
......@@ -57,6 +60,8 @@ void set_usb_mode(const char *mode);
const char * get_usb_mode(void);
void set_usb_module(const char *module);
const char * get_usb_module(void);
void set_usb_mode_data(struct mode_list_elem *data);
struct mode_list_elem * get_usb_mode_data(void);
gboolean get_usb_connection_state(void);
void set_usb_connection_state(gboolean state);
void set_charger_connected(gboolean state);
......
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