Skip to content

Commit

Permalink
* N900 Meego support improvements
Browse files Browse the repository at this point in the history
* Autplay improvements for windows
Signed-off-by: Philippe De Swert <phdeswer@lumi.maa>
  • Loading branch information
Philippe De Swert committed Apr 15, 2011
1 parent 322e7e3 commit 30b9158
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 12 deletions.
13 changes: 11 additions & 2 deletions configure.ac
@@ -1,4 +1,4 @@
AC_INIT([usb_moded], [0.34])
AC_INIT([usb_moded], [0.35])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_CONFIG_HEADER([config.h])
Expand Down Expand Up @@ -45,12 +45,21 @@ 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 $CFLAGS" ;;
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([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([bme], AS_HELP_STRING([--enable-bme], [Enable Nokia bme cable connection interface @<:@default=false@:>@]),
[case "${enableval}" in
yes) bme=true ; CFLAGS="-DBME $CFLAGS" ;;
Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
@@ -1,3 +1,11 @@
usb-moded (0.35) unstable; urgency=low

* Have g_nokia support for N900 on Meego
* Increase mass-storage file export timeout to make sure autoplay keeps working
on Windows(tm)

-- Philippe De Swert <philippe.de-swert@nokia.com> Fri, 15 Apr 2011 16:30:08 +0300

usb-moded (0.34) unstable; urgency=low

* Fixes for USB autoplay. Fixes: NB#220474
Expand Down
35 changes: 33 additions & 2 deletions src/usb_moded-config.c
Expand Up @@ -186,14 +186,14 @@ const char * find_cdrom_path(void)
g_key_file_free(settingsfile);
return(ret);
}
keys = g_key_file_get_keys (settingsfile, CDROM_PATH_ENTRY, NULL, NULL);
keys = g_key_file_get_keys (settingsfile, CDROM_ENTRY, NULL, NULL);
if(keys == NULL)
return ret;
while (*keys != NULL)
{
if(!strcmp(*keys, CDROM_PATH_KEY))
{
tmp_char = g_key_file_get_string(settingsfile, CDROM_PATH_ENTRY, *keys, NULL);
tmp_char = g_key_file_get_string(settingsfile, CDROM_ENTRY, *keys, NULL);
if(tmp_char)
{
log_debug("cdrom key value = %s\n", tmp_char);
Expand All @@ -205,4 +205,35 @@ const char * find_cdrom_path(void)
g_key_file_free(settingsfile);
return(ret);
}

int find_cdrom_timeout(void)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
gchar **keys;
int ret = 0;

settingsfile = g_key_file_new();
test = g_key_file_load_from_file(settingsfile, FS_MOUNT_CONFIG_FILE, G_KEY_FILE_NONE, NULL);
if(!test)
{
log_debug("no conffile\n");
g_key_file_free(settingsfile);
return(ret);
}
keys = g_key_file_get_keys (settingsfile, CDROM_ENTRY, NULL, NULL);
if(keys == NULL)
return ret;
while (*keys != NULL)
{
if(!strcmp(*keys, CDROM_TIMEOUT_KEY))
{
ret = g_key_file_get_integer(settingsfile, CDROM_ENTRY, *keys, NULL);
log_debug("key value = %d\n", ret);
}
keys++;
}
g_key_file_free(settingsfile);
return(ret);
}
#endif /* NOKIA */
4 changes: 3 additions & 1 deletion src/usb_moded-config.h
Expand Up @@ -31,8 +31,9 @@
#define ALT_MOUNT_KEY "mount"
#define UDEV_PATH_ENTRY "udev"
#define UDEV_PATH_KEY "path"
#define CDROM_PATH_ENTRY "cdrom"
#define CDROM_ENTRY "cdrom"
#define CDROM_PATH_KEY "path"
#define CDROM_TIMEOUT_KEY "timeout"

const char * find_mounts(void);
int find_sync(void);
Expand All @@ -43,4 +44,5 @@ const char * find_udev_path(void);

#ifdef NOKIA
const char * find_cdrom_path(void);
int find_cdrom_timeout(void);
#endif
20 changes: 15 additions & 5 deletions src/usb_moded-modesetting.c
Expand Up @@ -130,8 +130,8 @@ umount: command = g_strconcat("mount | grep ", mounts[i], NULL);
ret = 0;
}

/* activate mounts after sleeping 1s to be sure enumeration happened and autoplay will work */
sleep(1);
/* activate mounts after sleeping 1s to be sure enumeration happened and autoplay will work in windows*/
usleep(1800);
for(i=0 ; mounts[i] != NULL; i++)
{
sprintf(command2, "echo %i > /sys/devices/platform/musb_hdrc/gadget/gadget-lun%d/nofua", fua, i);
Expand All @@ -152,10 +152,14 @@ umount: command = g_strconcat("mount | grep ", mounts[i], NULL);

}

#ifdef NOKIA
#ifdef N900
int set_ovi_suite_mode(GList *applist)
{
int net = 0;
#ifdef NOKIA
int timeout = 1;
#endif /* NOKIA */


#ifdef APP_SYNC
/* do not go through the appsync routine if there is no applist */
Expand All @@ -171,12 +175,18 @@ int set_ovi_suite_mode(GList *applist)
if(net)
net = system("ifdown usb0 ; ifup usb0");

#ifdef NOKIA
/* timeout for exporting CDROM image */
timeout = find_cdrom_timeout();
g_timeout_add_seconds(1, export_cdrom, NULL);
#endif /* NOKIA */

return(0);
}
#endif /* N900 */


#ifdef NOKIA
gboolean export_cdrom(gpointer data)
{
const char *path = NULL, *command = NULL;
Expand Down Expand Up @@ -262,7 +272,7 @@ int usb_moded_mode_cleanup(const char *module)
}

}
#ifdef NOKIA
#ifdef N900
if(!strcmp(module, MODULE_NETWORK))
{
/* preventive sync in case of bad quality mtp clients */
Expand All @@ -274,7 +284,7 @@ int usb_moded_mode_cleanup(const char *module)
/* DIRTY WORKAROUND: acm/phonet does not work as it should, remove when it does */
system("killall -SIGTERM acm");
}
#endif /* NOKIA */
#endif /* N900 */


return(ret);
Expand Down
1 change: 1 addition & 0 deletions src/usb_moded-modules.c
Expand Up @@ -156,6 +156,7 @@ int usb_moded_module_cleanup(const char *module)
system("for i in `lsof -t /dev/mtp*`; do kill -9 $i ; done");
/* try again since there seem to be hard to kill processes there */
system("killall -9 obexd");
system("killall -9 msycnd");
success = usb_moded_unload_module(module);
}

Expand Down
4 changes: 2 additions & 2 deletions src/usb_moded.c
Expand Up @@ -207,7 +207,7 @@ void set_usb_mode(const char *mode)
goto end;
}

#ifdef NOKIA
#ifdef N900
if(!strcmp(mode, MODE_OVI_SUITE))
{
check_module_state(MODULE_NETWORK);
Expand All @@ -216,7 +216,7 @@ void set_usb_mode(const char *mode)
if(!ret)
ret = set_ovi_suite_mode(applist);
}
#endif /* NOKIA */
#endif /* N900 */

if(!strcmp(mode, MODE_WINDOWS_NET))
{
Expand Down
4 changes: 4 additions & 0 deletions usb-moded.ini
Expand Up @@ -8,3 +8,7 @@ nofua = 1

[altmount]
mount = /home/user/MyDocs

[cdrom]
path =
timeout =

0 comments on commit 30b9158

Please sign in to comment.