Commit 4bc50dd0 authored by Philippe De Swert's avatar Philippe De Swert

config: rewrite kernel cmdline parser to be in sync with existing kernel cmdline parameters

Signed-off-by: default avatarPhilippe De Swert <>
parent 032043bb
AC_INIT([usb_moded], [0.61])
AC_INIT([usb_moded], [0.62])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
usb-moded (0.62) unstable; urgency=low
* Kernel command line parameters are now in sync with regular kernel command parameters
* Save the udev path setting in config file merging so it does not get lost on upgrades
-- Philippe De Swert <> Fri, 24 May 2013 17:20:54 +0300
usb-moded (0.61) unstable; urgency=low
* Add basic version of usb_moded_util to not having to remember dbus-send commands
......@@ -124,9 +124,17 @@ change and udev rules / network manager etc will not think it is a new device ea
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.
It is possible to set the configuration on the kernel command line also. For this the regular ip setting from the kernel is
being re-used.
for example : ip= gateway= mode=developer_mode
The format followed is:
For more info see the kernel source: Documentation/filesystems/nfs/nfsroot.txt
for example : ip=
NOTE: The device must be usb0! The autoconf value is ignored.
Functional overview
......@@ -236,6 +236,7 @@ static const char * get_kcmdline_string(const char *entry)
int len;
gint argc = 0;
gchar **argv = NULL;
gchar **arg_tokens = NULL, **network_tokens = NULL;
GError *optErr = NULL;
int i;
......@@ -257,24 +258,42 @@ static const char * get_kcmdline_string(const char *entry)
cmdLine[len] = '\0';
/* we're looking for a piece of the kernel command line matching this:
ip= */
ip= */
if (!g_shell_parse_argv(cmdLine, &argc, &argv, &optErr))
/* find the ip token */
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], "ip"))
log_debug("use '%s' for '%s' from kernel command line", arg_tokens[1], entry);
ret = g_strdup(arg_tokens[1]);
network_tokens = g_strsplit(arg_tokens[1], ":", 7);
/* check if it is for the usb */
if(!strcmp(network_tokens[5], "usb0"))
if(!strcmp(entry, NETWORK_IP_KEY))
ret = g_strdup(network_tokens[0]);
log_debug("Command line ip = %s\n", ret);
if(!strcmp(entry, NETWORK_GATEWAY_KEY))
/* gateway might be empty, so we do not want to return an empty string */
if(strlen(network_tokens[2]) > 2)
ret = g_strdup(network_tokens[2]);
log_debug("Command line gateway = %s\n", ret);
......@@ -440,7 +459,7 @@ int conf_file_merge(void)
#ifdef UDEV
set_settings_option(UDEV_PATH_ENTRY, UDEV_PATH_KEY, udev);
set_config_setting(UDEV_PATH_ENTRY, UDEV_PATH_KEY, udev);
#endif /* UDEV */
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