Commit 57e9dc29 authored by Philippe De Swert's avatar Philippe De Swert

* Improved udev support with configurable udev path

* Fix some configure.ac bugs
Signed-off-by: default avatarPhilippe De Swert <phdeswer@lumi.maa>
parent 4784aa47
......@@ -51,6 +51,14 @@ AC_ARG_ENABLE([nokia], AS_HELP_STRING([--enable-nokia], [Enable Nokia extra's @<
esac],[nokia=false])
AM_CONDITIONAL([NOKIA], [test x$nokia = 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" ;;
no) bme=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-bme]) ;;
esac],[bme=false])
AM_CONDITIONAL([BME], [test x$bme = xtrue])
AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable application syncing @<:@default=false@:>@]),
[case "${enableval}" in
yes) app_sync=true ; CFLAGS="-DAPP_SYNC $CFLAGS" ;;
......@@ -69,10 +77,10 @@ AM_CONDITIONAL([HAL], [test x$hal = xtrue])
AC_ARG_ENABLE([udev], AS_HELP_STRING([--enable-udev], [Enable udev interface @<:@default=true@:>@]),
[case "${enableval}" in
yes) hal=true ; CFLAGS="-DUDEV -ludev $CFLAGS" ;;
no) hal=false ;;
yes) udev=true ; CFLAGS="-DUDEV -ludev $CFLAGS" ;;
no) udev=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-udev]) ;;
esac],[hal=false])
esac],[udev=false])
AM_CONDITIONAL([UDEV], [test x$udev = xtrue])
......
usb-moded (0.34) unstable; urgency=low
* Delay unloading a bit more (5s instead of 3). Fixes: NB#225492
* Delay unloading a bit more (8s instead of 3). Fixes: NB#225492
* Fixes for USB autoplay. Fixes: NB#220474
* Added cdrom emulation support.
* Added udev option for cable detection
-- Philippe De Swert <philippe.de-swert@nokia.com> Fri, 01 Apr 2011 13:22:51 +0300
......
......@@ -23,7 +23,7 @@ configure-stamp:
dh_testdir
# Add here commands to configure the package.
if [ ! -x configure ]; then ./autogen.sh; fi
./configure --prefix=/usr --enable-nokia --enable-app-sync
./configure --prefix=/usr --enable-nokia --enable-app-sync --enable-bme
touch configure-stamp
......
......@@ -31,10 +31,14 @@ usb_moded_SOURCES = \
if HAL
usb_moded_SOURCES += \
usb_moded-hal.c
else if NOKIA
endif
if BME
usb_moded_SOURCES += \
usb_moded-chargerdetection.c
else
endif
if UDEV
usb_moded_SOURCES += \
usb_moded-udev.c
endif
......
......@@ -127,6 +127,41 @@ const char * find_alt_mount(void)
return(ret);
}
#ifdef UDEV
const char * find_udev_path(void)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
gchar **keys;
const char *ret = NULL, *tmp_char;
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 cdrom path.\n");
g_key_file_free(settingsfile);
return(ret);
}
keys = g_key_file_get_keys (settingsfile, UDEV_PATH_ENTRY, NULL, NULL);
while (*keys != NULL)
{
if(!strcmp(*keys, UDEV_PATH_KEY))
{
tmp_char = g_key_file_get_string(settingsfile, UDEV_PATH_ENTRY, *keys, NULL);
if(tmp_char)
{
log_debug("cdrom key value = %s\n", tmp_char);
ret = g_strdup(tmp_char);
}
}
keys++;
}
g_key_file_free(settingsfile);
return(ret);
}
#endif /* UDEV */
#ifdef NOKIA
const char * find_cdrom_path(void)
{
......
......@@ -29,12 +29,18 @@
#define FS_SYNC_KEY "nofua"
#define ALT_MOUNT_ENTRY "altmount"
#define ALT_MOUNT_KEY "mount"
#define UDEV_PATH_ENTRY "udev"
#define UDEV_PATH_KEY "path"
#define CDROM_PATH_ENTRY "cdrom"
#define CDROM_PATH_KEY "path"
const char * find_mounts(void);
int find_sync(void);
const char * find_alt_mount(void);
#ifdef UDEV
const char * find_udev_path(void);
#endif
#ifdef NOKIA
const char * find_cdrom_path(void);
#endif
......@@ -10,6 +10,7 @@
#include <glib.h>
#include "usb_moded-log.h"
#include "usb_moded-config.h"
#include "usb_moded-hw-ab.h"
#include "usb_moded.h"
......@@ -24,6 +25,7 @@ gpointer monitor_udev(gpointer data) __attribute__ ((noreturn));
gboolean hwal_init(void)
{
GThread * thread;
const gchar *udev_path;
/* Create the udev object */
udev = udev_new();
......@@ -32,7 +34,12 @@ gboolean hwal_init(void)
log_err("Can't create udev\n");
return 0;
}
dev = udev_device_new_from_syspath(udev, "/sys/class/power_supply/usb");
udev_path = find_udev_path();
if(udev_path)
dev = udev_device_new_from_syspath(udev, udev_path);
else
dev = udev_device_new_from_syspath(udev, "/sys/class/power_supply/usb");
if (!dev)
{
log_err("Unable to find /sys/class/power_supply/usb device.");
......
......@@ -116,7 +116,7 @@ void set_usb_connected(gboolean connected)
usb_moded_mode_cleanup(get_usb_module());
usb_moded_send_signal(USB_DISCONNECTED);
#ifdef NOKIA
timeout_source = g_timeout_add_seconds(5, usb_module_timeout_cleanup, NULL);
timeout_source = g_timeout_add_seconds(8, usb_module_timeout_cleanup, NULL);
#else
/* unload modules and general cleanup */
usb_moded_module_cleanup(get_usb_module());
......
......@@ -5,6 +5,6 @@ libdir=${prefix}/lib
Name: usb_moded
Description: usb_moded defines for dbus and mode names
Version: @VERSION@
Requires:
Requires: dbus-1
Libs:
Cflags: -I${includedir}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment