I have made the following changes intended for : CE:MW:Shared / usb-moded
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/7905 Thank You, philippedeswert [This message was auto-generated] --- Request # 7905: Messages from BOSS: State: review at 2013-02-15T22:47:26 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:philippedeswert:branches:CE:MW:Shared / usb-moded -> CE:MW:Shared / usb-moded changes files: -------------- --- usb-moded.changes +++ usb-moded.changes @@ -0,0 +1,4 @@ +* Sat Feb 16 2013 Philippe De Swert <[email protected]> - 0.59 +- 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 + old: ---- usb-moded-0.58.tar.bz2 new: ---- usb-moded-0.59.tar.bz2 spec files: ----------- --- usb-moded.spec +++ usb-moded.spec @@ -1,5 +1,5 @@ Name: usb-moded -Version: 0.58 +Version: 0.59 Release: 0 Summary: USB mode controller Group: System/System Control other changes: -------------- ++++++ usb-moded-0.58.tar.bz2 -> usb-moded-0.59.tar.bz2 --- configure.ac +++ 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]) --- debian/changelog +++ 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 <[email protected]> Fri, 15 Feb 2013 23:32:55 +0200 + usb-moded (0.58) unstable; urgency=low * Fix bug with ask mode since module loading failed --- docs/usb_moded-doc.txt +++ docs/usb_moded-doc.txt @@ -43,6 +43,12 @@ 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: @@ -50,6 +56,8 @@ 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 @@ -243,3 +251,12 @@ 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 --- src/usb_moded-dbus.c +++ src/usb_moded-dbus.c @@ -152,6 +152,13 @@ } 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; --- src/usb_moded-dbus.h +++ 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" --- src/usb_moded-modules.c +++ src/usb_moded-modules.c @@ -97,7 +97,6 @@ g_strfreev(strings); } - log_debug("module to load = %s\n", load); ret = kmod_module_new_from_name(ctx, load, &mod); /* since kmod_module_new_from_name does not check if the module exists we test it's path in case we deal with the mass-storage one */ @@ -112,7 +111,6 @@ ret = kmod_module_probe_insert_module(mod, probe_flags, NULL, NULL, NULL, NULL); else { - log_debug("Loading with module args\n"); ret = kmod_module_probe_insert_module(mod, probe_flags, charging_args, NULL, NULL, NULL); free(charging_args); } --- src/usb_moded.c +++ src/usb_moded.c @@ -165,7 +165,7 @@ const char *mode_to_set; #ifdef MEEGOLOCK - int export = 0; + int export = 1; /* assume locked */ #endif /* MEEGOLOCK */ /* signal usb connected */ @@ -175,9 +175,13 @@ #ifdef MEEGOLOCK /* check if we are allowed to export system contents 0 is unlocked */ export = usb_moded_get_export_permission(); - if(rescue_mode) - export = 1; #endif + if(rescue_mode) + { + log_debug("Entering rescue mode!\n"); + set_usb_mode(MODE_DEVELOPER); + return; + } #ifdef MEEGOLOCK int act_dead = 0; /* check if we are in acting dead or not, /tmp/USER will not exist in acting dead */
