diff --git a/debian/changelog b/debian/changelog index 26bddd9..50a585c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,15 @@ +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 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 Fri, 10 May 2013 15:56:03 +0300 diff --git a/docs/usb_moded-doc.txt b/docs/usb_moded-doc.txt index a1dfc17..9fce9b8 100644 --- a/docs/usb_moded-doc.txt +++ b/docs/usb_moded-doc.txt @@ -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 -------------------- diff --git a/src/usb_moded-config.c b/src/usb_moded-config.c index 5c5f5fd..462a9f6 100644 --- a/src/usb_moded-config.c +++ b/src/usb_moded-config.c @@ -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);