Commit db659421 authored by Philippe De Swert's avatar Philippe De Swert

- Update changelog and configuration for kernel command line support

- Fix small memory leak in kernel command line handling
Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent 93816923
usb-moded (0.61) unstable; urgency=low
* Add basic version of usb_moded_util to not having to remember dbus-send commands
* Fix small bug in the android mode setting
* Add kernel command line support. Thank you Reto Zingg!
-- Philippe De Swert <philippe.deswert@jollamobile.com> Fri, 17 May 2013 14:23:34 +0300
usb-moded (0.60) unstable; urgency=low
* Add dedicated charger tracking
* Config file merging support
* Add basic version of usb_moded_util to not having to remember dbus-send commands
* Fix small bug in the android mode setting
-- Philippe De Swert <philippe.deswert@jollamobile.com> Fri, 10 May 2013 15:56:03 +0300
......
......@@ -119,13 +119,15 @@ for exmaple:
dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.net_config string:'ip' string:'192.168.2.15'
Usb_moded will generate a random mac address for the g_ether driver. Thus when plugging in the device repeatedly the mac address will not
change and udev rules / network manager etc will not think it is a new device each time.
This mac is stored using the default modprobe configuration and thus will be in /etc/modprobe.d/g_ether.conf
If this file exits usb_moded will assume there is a default mac set and will not do anything.
It is possible to set the configuration on the kernel command line also. Just add a valid keypair in the kernel command line.
for example : ip=192.168.2.15 gateway=192.168.2.2 mode=developer_mode
Functional overview
--------------------
......
......@@ -239,7 +239,8 @@ static const char * get_kcmdline_string(const char *entry)
GError *optErr = NULL;
int i;
if ((fd = open("/proc/cmdline", O_RDONLY)) < 0){
if ((fd = open("/proc/cmdline", O_RDONLY)) < 0)
{
log_debug("could not read /proc/cmdline");
return(ret);
}
......@@ -247,25 +248,30 @@ static const char * get_kcmdline_string(const char *entry)
len = read(fd, cmdLine, sizeof(cmdLine) - 1);
close(fd);
if (len <= 0){
if (len <= 0)
{
log_debug("kernel command line was empty");
return(ret);
}
cmdLine[len] = '\0';
if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr)) {
if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr))
{
g_error_free(optErr);
return(ret);
}
for (i=0; i < argc; i++) {
for (i=0; i < argc; i++)
{
gchar ** arg_tokens;
arg_tokens = g_strsplit(argv[i], "=", 2);
if (!g_ascii_strcasecmp(arg_tokens[0], entry)){
if (!g_ascii_strcasecmp(arg_tokens[0], entry))
{
log_debug("use '%s' for '%s' from kernel command line", arg_tokens[1], entry);
return(arg_tokens[1]);
ret = g_strdup(arg_tokens[1]);
}
g_strfreev(arg_tokens);
}
return(ret);
......
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