Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add dbus method to query set config and update docs
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Feb 15, 2013
1 parent 3d2613d commit e7b1195
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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])
Expand Down
7 changes: 7 additions & 0 deletions 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 <philippe.deswert@jollamobile.com> Fri, 15 Feb 2013 23:32:55 +0200

usb-moded (0.58) unstable; urgency=low

* Fix bug with ask mode since module loading failed
Expand Down
17 changes: 17 additions & 0 deletions docs/usb_moded-doc.txt
Expand Up @@ -43,13 +43,21 @@ 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:'<mode_name>'

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:

gconftool-2 -g /Meego/System/UsbMode
gconftool-2 -s /Meego/System/UsbMode --type=string <mode_name>

=== 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

Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/usb_moded-dbus.c
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions src/usb_moded-dbus.h
Expand Up @@ -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"
Expand Down

0 comments on commit e7b1195

Please sign in to comment.