Skip to content

Commit

Permalink
[cleanup] Remove NOKIA and N900 defines
Browse files Browse the repository at this point in the history
  • Loading branch information
thp authored and philippedeswert committed Apr 28, 2015
1 parent ee7b1f7 commit db38a54
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 168 deletions.
16 changes: 0 additions & 16 deletions configure.ac
Expand Up @@ -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" ;;
Expand All @@ -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" ;;
Expand Down
6 changes: 0 additions & 6 deletions src/usb_moded-appsync.c
Expand Up @@ -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 */
Expand Down
12 changes: 0 additions & 12 deletions src/usb_moded-config.c
Expand Up @@ -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));
Expand Down
5 changes: 0 additions & 5 deletions src/usb_moded-config.h
Expand Up @@ -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);
Expand Down
76 changes: 0 additions & 76 deletions src/usb_moded-modesetting.c
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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)
{

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions src/usb_moded-modesetting.h
Expand Up @@ -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

12 changes: 0 additions & 12 deletions src/usb_moded-modules.c
Expand Up @@ -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 */

13 changes: 2 additions & 11 deletions src/usb_moded-modules.h
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */
25 changes: 0 additions & 25 deletions src/usb_moded.c
Expand Up @@ -29,9 +29,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#ifdef NOKIA
#include <string.h>
#endif

#include <libkmod.h>
#ifdef SYSTEMD
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit db38a54

Please sign in to comment.