From db38a54e6fd74ae9097724cc3a329b57a75c8432 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Fri, 24 Apr 2015 15:02:09 +0200 Subject: [PATCH] [cleanup] Remove NOKIA and N900 defines --- configure.ac | 16 -------- src/usb_moded-appsync.c | 6 --- src/usb_moded-config.c | 12 ------ src/usb_moded-config.h | 5 --- src/usb_moded-modesetting.c | 76 ------------------------------------- src/usb_moded-modesetting.h | 5 --- src/usb_moded-modules.c | 12 ------ src/usb_moded-modules.h | 13 +------ src/usb_moded.c | 25 ------------ 9 files changed, 2 insertions(+), 168 deletions(-) diff --git a/configure.ac b/configure.ac index 821611f..6b1cf1c 100644 --- a/configure.ac +++ b/configure.ac @@ -32,14 +32,6 @@ AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[Enable debug @<:@default esac],[debug=false]) AM_CONDITIONAL([DEBUG], [test x$debug = xtrue]) -AC_ARG_ENABLE([nokia], AS_HELP_STRING([--enable-nokia], [Enable Nokia extra's @<:@default=false@:>@]), - [case "${enableval}" in - yes) nokia=true ; CFLAGS="-DNOKIA -DN900 $CFLAGS" ;; - no) nokia=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-nokia]) ;; - esac],[nokia=false]) -AM_CONDITIONAL([NOKIA], [test x$nokia = xtrue]) - AC_ARG_ENABLE([meegodevlock], AS_HELP_STRING([--enable-meegodevlock], [Enable Meego devicelock @<:@default=false@:>@]), [case "${enableval}" in yes) meegodevlock=true ; CFLAGS="-DMEEGOLOCK $CFLAGS" ;; @@ -48,14 +40,6 @@ AC_ARG_ENABLE([meegodevlock], AS_HELP_STRING([--enable-meegodevlock], [Enable Me esac],[meegodevlock=false]) AM_CONDITIONAL([MEEGOLOCK], [test x$meegodevlock = xtrue]) -AC_ARG_ENABLE([n900], AS_HELP_STRING([--enable-n900], [Enable N900 extra's @<:@default=false@:>@]), - [case "${enableval}" in - yes) n900=true ; CFLAGS="-DN900 $CFLAGS" ;; - no) n900=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-n900]) ;; - esac],[n900=false]) -AM_CONDITIONAL([N900], [test x$n900 = xtrue]) - AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable application syncing @<:@default=true@:>@]), [case "${enableval}" in yes) app_sync=true ; CFLAGS="-DAPP_SYNC $CFLAGS" ;; diff --git a/src/usb_moded-appsync.c b/src/usb_moded-appsync.c index cb26186..7c179aa 100644 --- a/src/usb_moded-appsync.c +++ b/src/usb_moded-appsync.c @@ -403,12 +403,6 @@ static gboolean enumerate_usb(gpointer data) else { -#ifdef NOKIA - /* activate usb connection/enumeration */ - write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "1"); - log_debug("Softconnect enumeration done\n"); -#endif - enum_tag = sync_tag; /* Debug: how long it took from sync start to get here */ diff --git a/src/usb_moded-config.c b/src/usb_moded-config.c index 3782565..97d67b2 100644 --- a/src/usb_moded-config.c +++ b/src/usb_moded-config.c @@ -95,18 +95,6 @@ char * find_udev_subsystem(void) return(get_conf_string(UDEV_PATH_ENTRY, UDEV_SUBSYSTEM_KEY)); } -#ifdef NOKIA -const char * find_cdrom_path(void) -{ - return(get_conf_string(CDROM_ENTRY, CDROM_PATH_KEY)); -} - -int find_cdrom_timeout(void) -{ - return(get_conf_int(CDROM_ENTRY, CDROM_TIMEOUT_KEY)); -} -#endif /* NOKIA */ - char * check_trigger(void) { return(get_conf_string(TRIGGER_ENTRY, TRIGGER_PATH_KEY)); diff --git a/src/usb_moded-config.h b/src/usb_moded-config.h index ce052a3..4791596 100644 --- a/src/usb_moded-config.h +++ b/src/usb_moded-config.h @@ -63,11 +63,6 @@ const char * find_alt_mount(void); char * find_udev_path(void); char * find_udev_subsystem(void); -#ifdef NOKIA -const char * find_cdrom_path(void); -int find_cdrom_timeout(void); -#endif - char * check_trigger(void); char * get_trigger_subsystem(void); char * get_trigger_mode(void); diff --git a/src/usb_moded-modesetting.c b/src/usb_moded-modesetting.c index 1867c9a..28ea911 100644 --- a/src/usb_moded-modesetting.c +++ b/src/usb_moded-modesetting.c @@ -179,11 +179,7 @@ umount: command = g_strconcat("mount | grep ", mountpath, NULL); { log_err("Unmounting %s failed\n", mount); report_mass_storage_blocker(mount, 2); -#ifdef NOKIA - usb_moded_send_error_signal("qtn_usb_filessystem_inuse"); -#else usb_moded_send_error_signal(UMOUNT_ERROR); -#endif return(ret); } } @@ -339,39 +335,6 @@ static void report_mass_storage_blocker(const char *mountpoint, int try) } -#ifdef N900 -int set_ovi_suite_mode(void) -{ -#ifdef NOKIA - int timeout = 1; -#endif /* NOKIA */ - - -#ifdef APP_SYNC - activate_sync(MODE_OVI_SUITE); -#else - write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "1"); -#endif /* APP_SYNC */ - /* bring network interface up in case no other network is up */ -#ifdef DEBIAN - system("ifdown usb0 ; ifup usb0"); -#else - usb_network_down(NULL); - usb_network_up(NULL); -#endif /* DEBIAN */ - -#ifdef NOKIA - /* timeout for exporting CDROM image */ - timeout = find_cdrom_timeout(); - if(timeout == 0) - timeout = 1; - g_timeout_add_seconds(timeout, export_cdrom, NULL); -#endif /* NOKIA */ - - return(0); -} -#endif /* N900 */ - int set_dynamic_mode(void) { @@ -498,31 +461,6 @@ void unset_dynamic_mode(void) } } -#ifdef NOKIA -gboolean export_cdrom(gpointer data) -{ - const char *path = NULL; - - path = find_cdrom_path(); - - if(path == NULL) - { - log_debug("No cdrom path specified => not exporting.\n"); - return(FALSE); - } - if(access(path, F_OK) == 0) - { - write_to_file("/sys/devices/platform/musb_hdrc/gadget/lun0/file", path); - } - else - log_debug("Cdrom image file does not exist => no export.\n"); - g_free((gpointer *)path); - - return(FALSE); -} - -#endif /* NOKIA */ - /** clean up mode changes or extra actions to perform after a mode change * @param module Name of module currently in use * @return 0 on success, non-zero on failure @@ -551,20 +489,6 @@ int usb_moded_mode_cleanup(const char *module) return 0; unset_mass_storage_mode(NULL); } -#ifdef N900 - else if(!strcmp(module, MODULE_NETWORK)) - { - /* preventive sync in case of bad quality mtp clients */ - sync(); - /* bring network down immediately */ - /*system("ifdown usb0"); */ - usb_network_down(NULL); - /* do soft disconnect - write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "0"); */ - /* DIRTY WORKAROUND: acm/phonet does not work as it should, remove when it does */ - system("killall -SIGTERM acm"); - } -#endif /* N900 */ else if(get_usb_mode_data()) unset_dynamic_mode(); diff --git a/src/usb_moded-modesetting.h b/src/usb_moded-modesetting.h index d9adecb..b5f408a 100644 --- a/src/usb_moded-modesetting.h +++ b/src/usb_moded-modesetting.h @@ -26,13 +26,8 @@ int find_number_of_mounts(void); #endif int write_to_file(const char *path, const char *text); -int set_ovi_suite_mode(void); int set_mtp_mode(void); int set_dynamic_mode(void); void unset_dynamic_mode(void); /* clean up for the mode changes on disconnect */ int usb_moded_mode_cleanup(const char *module); -#ifdef NOKIA -gboolean export_cdrom (gpointer data); -#endif - diff --git a/src/usb_moded-modules.c b/src/usb_moded-modules.c index 4bd8706..a43ba7f 100644 --- a/src/usb_moded-modules.c +++ b/src/usb_moded-modules.c @@ -428,15 +428,3 @@ void check_module_state(const char *module_name) } -#ifdef NOKIA -gboolean usb_cleanup_timeout(gpointer data) -{ - /* signal usb disconnected */ - usb_moded_send_signal(USB_DISCONNECTED); - usb_moded_mode_cleanup(get_usb_module()); - usb_moded_module_cleanup(get_usb_module()); - set_usb_mode(MODE_UNDEFINED); - return FALSE; -} -#endif /* NOKIA */ - diff --git a/src/usb_moded-modules.h b/src/usb_moded-modules.h index b54f2b5..7654fef 100644 --- a/src/usb_moded-modules.h +++ b/src/usb_moded-modules.h @@ -19,12 +19,8 @@ */ /* module name definitions */ -#define MODULE_NETWORK "g_nokia" -#ifdef NOKIA -#define MODULE_NETWORK_MTP "g_nokia devmode=0" -#else -#define MODULE_NETWORK_MTP "g_nokia" -#endif /* NOKIA */ +#define MODULE_NETWORK "g_nokia" +#define MODULE_NETWORK_MTP "g_nokia" #define MODULE_MASS_STORAGE "g_mass_storage" #define MODULE_FILE_STORAGE "g_file_storage" #define MODULE_CHARGING "g_mass_storage luns=1 stall=0 removable=1" @@ -56,8 +52,3 @@ int usb_moded_module_switch_prepare(int force); /* check if the correct module is loaded or not and switch if not */ void check_module_state(const char *module_name); - -#ifdef NOKIA -/* handler for a cleanup after a timeout */ -gboolean usb_cleanup_timeout(gpointer data); -#endif /* NOKIA */ diff --git a/src/usb_moded.c b/src/usb_moded.c index f487256..a49e197 100644 --- a/src/usb_moded.c +++ b/src/usb_moded.c @@ -29,9 +29,6 @@ #include #include #include -#ifdef NOKIA -#include -#endif #include #ifdef SYSTEMD @@ -78,9 +75,6 @@ static gboolean systemd_notify = FALSE; struct usb_mode current_mode; guint charging_timeout = 0; -#ifdef NOKIA -guint timeout_source = 0; -#endif /* NOKIA */ static GList *modelist; /* static helper functions */ @@ -110,13 +104,6 @@ void set_usb_connected(gboolean connected) if(current_mode.connected == connected) return; -#ifdef NOKIA - if(timeout_source) - { - g_source_remove(timeout_source); - timeout_source = 0; - } -#endif /* NOKIA */ if(charging_timeout) { g_source_remove(charging_timeout); @@ -156,10 +143,6 @@ static gboolean set_disconnected(gpointer data) if(!get_usb_connection_state()) { log_debug("usb disconnected\n"); -#ifdef NOKIA - /* delayed clean-up of state */ - timeout_source = g_timeout_add_seconds(3, usb_cleanup_timeout, NULL); -#else /* signal usb disconnected */ usb_moded_send_signal(USB_DISCONNECTED); /* unload modules and general cleanup if not charging */ @@ -169,7 +152,6 @@ static gboolean set_disconnected(gpointer data) /* Nothing else as we do not need to do anything for cleaning up charging mode */ usb_moded_module_cleanup(get_usb_module()); set_usb_mode(MODE_UNDEFINED); -#endif /* NOKIA */ } return FALSE; @@ -264,13 +246,6 @@ void set_usb_connected_state(void) if(!strcmp(mode_to_set, current_mode.mode)) goto end; -#ifdef NOKIA - /* If we switch to another mode than the one that is still set before the - clean-up timeout expired we need to clean up */ - if(strcmp(mode_to_set, get_usb_mode())) - usb_moded_mode_cleanup(get_usb_module()); -#endif /* NOKIA */ - if(!strcmp(MODE_ASK, mode_to_set)) { /* send signal, mode will be set when the dialog service calls