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/7575

Thank You,
philippedeswert

[This message was auto-generated]

---

Request # 7575:

Messages from BOSS:

State: review at 2012-12-20T17:00:06 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,6 @@
+* Tue Dec 18 2012 Philippe De Swert <[email protected]> - 0.55
+- Add android gadget driver support (compile time feature)
+- Make udev default
+- Add rescue mode
+- Add softconnect support
+

old:
----
  usb-moded-0.54.1.tar.bz2

new:
----
  usb-moded-0.55.tar.bz2

spec files:
-----------
--- usb-moded.spec
+++ usb-moded.spec
@@ -1,5 +1,5 @@
 Name:     usb-moded
-Version:  0.54.1
+Version:  0.55
 Release:  0 
 Summary:  USB mode controller
 Group:    System/System Control

other changes:
--------------

++++++ usb-moded-0.54.1.tar.bz2 -> usb-moded-0.55.tar.bz2
--- configure.ac
+++ configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([usb_moded], [0.54])
+AC_INIT([usb_moded], [0.55])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 AM_CONFIG_HEADER([config.h])
@@ -86,7 +86,7 @@
    esac],[dynamic_modes=false])
 AM_CONDITIONAL([DYN_MODE], [test x$dynamic_modes = xtrue])
 
-AC_ARG_ENABLE([hal], AS_HELP_STRING([--enable-hal], [Enable deprecated hal 
interface @<:@default=false@:>@]),
+AC_ARG_ENABLE([hal], AS_HELP_STRING([--enable-hal], [Enable deprecated hal 
interface (use --disable-udev also) @<:@default=false@:>@]),
   [case "${enableval}" in
    yes) hal=true ; CFLAGS="-DHAL -I/usr/include/hal -lhal $CFLAGS" ;;
    no)  hal=false ;;
@@ -99,7 +99,7 @@
    yes) udev=true ; CFLAGS="-DUDEV -ludev $CFLAGS" ;;
    no)  udev=false ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-udev]) ;;
-   esac],[udev=false])
+   esac],[udev=true CFLAGS="-DUDEV -ludev $CFLAGS" ])
 AM_CONDITIONAL([UDEV], [test x$udev = xtrue])
 
 AC_ARG_ENABLE([upstart], AS_HELP_STRING([--enable-upstart], [Enable upstart 
interface for appsync @<:@default=true@:>@]),
@@ -110,6 +110,13 @@
    esac],[upstart=false])
 AM_CONDITIONAL([UPSTART], [test x$upstart = xtrue])
 
+AC_ARG_ENABLE([android], AS_HELP_STRING([--enable-android], [Enable Android 
"module" interface @<:@default=false@:>@]),
+  [case "${enableval}" in
+   yes) android=true ; CFLAGS="-DANDROID $CFLAGS" ;;
+   no)  android=false ;;
+   *) AC_MSG_ERROR([bad value ${enableval} for --enable-android]) ;;
+   esac],[android=false])
+AM_CONDITIONAL([ANDROID], [test x$android = xtrue])
 
 #TODO: Figure out how to check for this depending on the gconf flag
 # gconf-2.0 >= 2.16.0
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,12 @@
+usb-moded (0.55) unstable; urgency=low
+
+  * Add android gadget driver support
+  * Make udev default
+  * Add rescue mode
+  * Add softconnect support
+
+ -- Philippe De Swert <[email protected]> Wed, 12 Dec 2012 
22:57:42 +0200
+
 usb-moded (0.54) unstable; urgency=low
 
   * Instead of spawning shells with system() use libkmod
--- src/Makefile.am
+++ src/Makefile.am
@@ -18,7 +18,6 @@
        usb_moded-dbus-private.h \
        usb_moded-hw-ab.h \
        usb_moded-config-private.h \
-       usb_moded-modules.c \
        usb_moded-modules.h \
        usb_moded-log.h \
        usb_moded-log.c \
@@ -29,6 +28,14 @@
        usb_moded-modesetting.c \
        usb_moded-modesetting.h 
 
+if !ANDROID
+usb_moded_SOURCES += \
+       usb_moded-modules.c 
+else
+usb_moded_SOURCES += \
+       usb_moded-modules-android.c 
+endif
+
 if GCONF
 usb_moded_SOURCES += \
        usb_moded-gconf.c \
--- src/usb_moded-config.c
+++ src/usb_moded-config.c
@@ -132,6 +132,11 @@
   return(get_conf_string(NETWORK_ENTRY, NETWORK_GATEWAY_KEY));
 }
 
+const char * get_soft_connect_path(void)
+{
+  return(get_conf_string(SOFT_CONNECT_ENTRY, SOFT_CONNECT_PATH_KEY));
+}
+
 /* create basic conffile with sensible defaults */
 static void create_conf_file(void)
 {
--- src/usb_moded-config.h
+++ src/usb_moded-config.h
@@ -48,6 +48,8 @@
 #define NETWORK_IP_KEY                 "ip"
 #define NETWORK_INTERFACE_KEY          "interface"
 #define NETWORK_GATEWAY_KEY            "gateway"
+#define SOFT_CONNECT_ENTRY             "soft_connect"
+#define SOFT_CONNECT_PATH_KEY          "soft_connect_path"
 
 const char * find_mounts(void);
 int find_sync(void);
@@ -74,3 +76,5 @@
 const char * get_network_ip(void);
 const char * get_network_interface(void);
 const char * get_network_gateway(void);
+
+const char * get_soft_connect_path(void);
--- src/usb_moded-dbus.c
+++ src/usb_moded-dbus.c
@@ -2,8 +2,10 @@
   @file        usb_moded-dbus.c
 
   Copyright (C) 2010 Nokia Corporation. All rights reserved.
+  Copyright (C) 2012 Jolla. All rights reserved.
 
   @author: Philippe De Swert <[email protected]>
+  @author: Philippe De Swert <[email protected]>
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License 
@@ -39,6 +41,7 @@
 #endif
 
 static DBusConnection *dbus_connection_sys = NULL;
+extern gboolean rescue_mode;
 
 static DBusHandlerResult msg_handler(DBusConnection *const connection, 
DBusMessage *const msg, gpointer const user_data)
 {
@@ -146,6 +149,11 @@
                }
                dbus_error_free(&err);  
        }
+       else if(!strcmp(member, USB_MODE_RESCUE_OFF))
+       {
+               rescue_mode = FALSE;
+               reply = dbus_message_new_method_return(msg);
+       }
        else
        { 
                /*unknown methods are handled here */
--- src/usb_moded-dbus.h
+++ src/usb_moded-dbus.h
@@ -30,6 +30,7 @@
 
 /* supported methods */
 #define USB_MODE_STATE_REQUEST "mode_request"
+#define USB_MODE_RESCUE_OFF    "rescue_off"
 /**
   * @credential usb-moded::USBControl  Credential needed to be able to call 
the set_mode or set_config methods
 **/
--- src/usb_moded-modules-android.c
+++ src/usb_moded-modules-android.c
@@ -0,0 +1,123 @@
+/**
+  @file usb_moded-modules-android.c
+ 
+  Copyright (C) 2012 Jolla. All rights reserved.
+
+  @author: Philippe De Swert <[email protected]>
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the Lesser GNU General Public License 
+  version 2 as published by the Free Software Foundation. 
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+ 
+  You should have received a copy of the Lesser GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  02110-1301 USA
+*/
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <glib.h>
+
+#include <libkmod.h>
+
+#include "usb_moded.h"
+#include "usb_moded-modules.h"
+#include "usb_moded-log.h"
+#include "usb_moded-config.h"
+#include "usb_moded-dbus.h"
+#include "usb_moded-dbus-private.h"
+#include "usb_moded-config.h"
+#include "usb_moded-modesetting.h"
+
+/* kmod context - initialized at start in usb_moded_init */
+struct kmod_ctx *ctx;
+
+/** load module 
+ *
+ * @param module Name of the module to load
+ * @return 0 on success, non-zero on failure
+ *
+ */
+int usb_moded_load_module(const char *module)
+{
+       int ret = 0;
+
+       write_to_file("/sys/class/android_usb/android0/functions", module);
+       write_to_file("/sys/class/android_usb/android0/enable", "0");
+       if( ret == 0)
+               log_info("Module setting to %s successfully\n", module);
+       return(ret);
+}
+
+/** unload module
+ *  
+ * @param module Name of the module to unload
+ * @return 0 on success, non-zero on failure
+ *
+ */
+int usb_moded_unload_module(const char *module)
+{
+       write_to_file("/sys/class/android_usb/android0/enable", "0");
+       return(0);
+}
+
+/** Check which state a module is in
+ *
+ * @return 1 if loaded, 0 when not loaded
+ */
+inline static int module_state_check(const char *module)
+{
+       return(0);
+}
+
+/** find which module is loaded 
+ *
+ * @return The name of the loaded module, or NULL if no modules are loaded.
+ */
+inline const char * usb_moded_find_module(void)
+{
+  return(0);
+}
+
+/** clean up for modules when usb gets disconnected
+ *
+ * @param module The name of the module to unload
+ * @return 0 on success, non-zero on failure
+ *
+ */
+inline int usb_moded_module_cleanup(const char *module)
+{
+       return(0);
+}
+
+/** try to unload modules to support switching
+ *
+ *
+ * @param force force unloading with a nasty clean-up on TRUE, or just try 
unloading when FALSE
+ * @return 0 on success, 1 on failure, 2 if hard clean-up failed
+ */
+inline int usb_moded_module_switch_prepare (int force)
+{
+       return 0;
+}
+
+/** check for loaded modules and clean-up if they are not for the chosen mode 
+ *
+ * @param module_name  module name to check for
+ *
+ */
+inline void check_module_state(const char *module_name)
+{
+  return;
+}
+
+
--- src/usb_moded-modules.c
+++ src/usb_moded-modules.c
@@ -2,8 +2,10 @@
   @file usb_moded-modules.c
  
   Copyright (C) 2010 Nokia Corporation. All rights reserved.
+  Copyright (C) 2012 Jolla. All rights reserved.
 
   @author: Philippe De Swert <[email protected]>
+  @author: Philippe De Swert <[email protected]>
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License 
@@ -36,10 +38,8 @@
 #include "usb_moded-dbus.h"
 #include "usb_moded-dbus-private.h"
 #include "usb_moded-config.h"
-#ifdef NOKIA
 #include "usb_moded-modesetting.h"
 #include "usb_moded-modes.h"
-#endif
 
 /* kmod context - initialized at start in usb_moded_init */
 struct kmod_ctx *ctx;
@@ -53,6 +53,7 @@
 int usb_moded_load_module(const char *module)
 {
        int ret = 0;
+       const char * softconnect;
 #ifdef NO_KMOD
        gchar *command; 
        
@@ -93,6 +94,12 @@
        kmod_module_unref(mod);
 #endif /* NO_KMOD */
 
+       softconnect = get_soft_connect_path();
+       if(softconnect) 
+       {
+               write_to_file(softconnect, "connect");
+               free((void *)softconnect);
+       }
        if( ret == 0)
                log_info("Module %s loaded successfully\n", module);
        return(ret);
--- src/usb_moded-modules.h
+++ src/usb_moded-modules.h
@@ -18,6 +18,7 @@
   02110-1301 USA
 */
 
+#ifndef ANDROID
 /* module name definitions */
 #define MODULE_NETWORK          "g_nokia" 
 #ifdef NOKIA
@@ -33,6 +34,15 @@
 #define MODULE_WINDOWS_NET     "g_ether"
 #define MODULE_DEVELOPER       "g_ether"
 #define MODULE_MTP             "g_ffs"
+#else
+#define MODULE_MASS_STORAGE     "mass_storage"
+#define MODULE_FILE_STORAGE    "mass_storage"
+#define MODULE_WINDOWS_NET     "rndis"
+#define MODULE_DEVELOPER       "rndis"
+#define MODULE_MTP             "mtp"
+#define MODULE_NONE             "none"
+#define MODULE_CHARGING                "mass_storage"
+#endif
 
 /* load module */
 int usb_moded_load_module(const char *module);
--- src/usb_moded-network.c
+++ src/usb_moded-network.c
@@ -1,8 +1,11 @@
 /*
   @file usb-moded_network.c : (De)activates network depending on the network 
setting system.
+
   Copyright (C) 2011 Nokia Corporation. All rights reserved.
+  Copyright (C) 2012 Jolla. All rights reserved.
 
-  Author: Philippe De Swert <[email protected]>
+  @author: Philippe De Swert <[email protected]>
+  @author: Philippe De Swert <[email protected]>
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License 
--- src/usb_moded-udev.c
+++ src/usb_moded-udev.c
@@ -159,10 +159,16 @@
 
 void hwal_cleanup(void)
 {
-  g_source_remove(watch_id);
-  watch_id = 0;
-  g_io_channel_unref(iochannel);
-  iochannel = NULL;
+  if(watch_id != 0)
+  {
+    g_source_remove(watch_id);
+    watch_id = 0;
+  }
+  if(iochannel != NULL)
+  {
+    g_io_channel_unref(iochannel);
+    iochannel = NULL;
+  }
   udev_monitor_unref(mon);
   udev_unref(udev);
 }
--- src/usb_moded.c
+++ src/usb_moded.c
@@ -2,8 +2,10 @@
   @file usb_moded.c
 
   Copyright (C) 2010 Nokia Corporation. All rights reserved.
+  Copyright (C) 2012 Jolla. All rights reserved.
 
   @author: Philippe De Swert <[email protected]>
+  @author: Philippe De Swert <[email protected]>
 
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License 



Reply via email to