From e7b1195f8542ce7c178835beca4715b8907937e8 Mon Sep 17 00:00:00 2001 From: Philippe De Swert Date: Sat, 16 Feb 2013 00:17:19 +0200 Subject: [PATCH] Add dbus method to query set config and update docs Signed-off-by: Philippe De Swert --- configure.ac | 2 +- debian/changelog | 7 +++++++ docs/usb_moded-doc.txt | 17 +++++++++++++++++ src/usb_moded-dbus.c | 7 +++++++ src/usb_moded-dbus.h | 8 +++++--- 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 08e8819..0efd829 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([usb_moded], [0.58]) +AC_INIT([usb_moded], [0.59]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AM_CONFIG_HEADER([config.h]) diff --git a/debian/changelog b/debian/changelog index 51b0f60..39f69cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +usb-moded (0.59) unstable; urgency=low + + * Do not depend on the config, but always go to developer mode in rescue mode + * Add a dbus method to query the currently set config option + + -- Philippe De Swert Fri, 15 Feb 2013 23:32:55 +0200 + usb-moded (0.58) unstable; urgency=low * Fix bug with ask mode since module loading failed diff --git a/docs/usb_moded-doc.txt b/docs/usb_moded-doc.txt index d10c766..a3f8e59 100644 --- a/docs/usb_moded-doc.txt +++ b/docs/usb_moded-doc.txt @@ -43,6 +43,12 @@ Even the configuration can be set over DBus (this will set either the gconf key dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.set_config string:'' +To get the currently stored default mode from the config: + +dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.get_config + +=== WITH GCONF ONLY === + However this can also be optionally handled by setting the following GConf key (gconf has to be compiled in). /Meego/System/UsbMode (querying and setting can be done as follows: @@ -50,6 +56,8 @@ However this can also be optionally handled by setting the following GConf key ( gconftool-2 -g /Meego/System/UsbMode gconftool-2 -s /Meego/System/UsbMode --type=string +=== END WITH GCONF ONLY === + Usb_moded will also broadcast changes and errors over the system bus. This will happen on the com.meego.usb_moded interface @@ -243,3 +251,12 @@ android kernels. atm only networking mode is fully supported, mass-storage partly. +rescue mode +----------- + +When started with -r usb_moded will always enable developer mode (networking) +if it can. This is a debug feature and should not be used in a final image. + +Turning it off when the device is booted completely can easily be done over dbus. + +dbus-send --system --type=method_call --print-reply --dest=com.meego.usb_moded /com/meego/usb_moded com.meego.usb_moded.rescue_off diff --git a/src/usb_moded-dbus.c b/src/usb_moded-dbus.c index 6b335a3..a328bd1 100644 --- a/src/usb_moded-dbus.c +++ b/src/usb_moded-dbus.c @@ -152,6 +152,13 @@ static DBusHandlerResult msg_handler(DBusConnection *const connection, DBusMessa } dbus_error_free(&err); } + else if(!strcmp(member, USB_MODE_CONFIG_GET)) + { + const char *config = get_mode_setting(); + + if((reply = dbus_message_new_method_return(msg))) + dbus_message_append_args (reply, DBUS_TYPE_STRING, &config, DBUS_TYPE_INVALID); + } else if(!strcmp(member, USB_MODE_RESCUE_OFF)) { rescue_mode = FALSE; diff --git a/src/usb_moded-dbus.h b/src/usb_moded-dbus.h index 43bda36..cc45f13 100644 --- a/src/usb_moded-dbus.h +++ b/src/usb_moded-dbus.h @@ -31,12 +31,14 @@ /* supported methods */ #define USB_MODE_STATE_REQUEST "mode_request" #define USB_MODE_RESCUE_OFF "rescue_off" +#define USB_MODE_CONFIG_GET "get_config" /* returns the mode set in the config */ + /** * @credential usb-moded::USBControl Credential needed to be able to call the set_mode or set_config methods **/ -#define USB_MODE_STATE_SET "set_mode" -#define USB_MODE_CONFIG_SET "set_config" -#define USB_MODE_NETWORK_SET "net_config" +#define USB_MODE_STATE_SET "set_mode" /* set a mode (only works when connected) */ +#define USB_MODE_CONFIG_SET "set_config" /* set the mode that needs to be activated in the config file */ +#define USB_MODE_NETWORK_SET "net_config" /* set the network config in the config file */ /* state definitions for signals and method parameters */ #define USB_CONNECTED "USB connected"