Commit 43f67f17 authored by Philippe De Swert's avatar Philippe De Swert

clean up mode also before switching modes after trigger

Signed-off-by: default avatarPhilippe De Swert <phdeswer@lumi.maa>
parent 57cf9b4b
AC_INIT([usb_moded], [0.45])
AC_INIT([usb_moded], [0.46])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER([config.h])
......
usb-moded (0.46) unstable; urgency=low
* Restart usb trigger if the socket gets destroyed.
* Restart usb trigger if the socket gets destroyed. Fixes: NB#277395
* On usb trigger mode switch, clean up mode first.
-- Philippe De Swert <philippe.de-swert@nokia.com> Mon, 15 Aug 2011 15:28:16 +0300
......
......@@ -36,6 +36,7 @@
#include "usb_moded-log.h"
#include "usb_moded-config.h"
#include "usb_moded-hw-ab.h"
#include "usb_moded-modesetting.h"
#include "usb_moded-trigger.h"
#ifdef NOKIA
#include "usb_moded-devicelock.h"
......@@ -56,7 +57,8 @@ static void udev_parse(struct udev_device *dev);
static void notify_issue (gpointer data)
{
log_debug("trigger watch destroyed\n!");
/* restart trigger */
/* clean up & restart trigger */
trigger_stop();
trigger_init();
}
......@@ -188,8 +190,10 @@ static void udev_parse(struct udev_device *dev)
if(!usb_moded_get_export_permission())
#endif /* NOKIA */
if(strcmp(get_trigger_mode(), get_usb_mode()) != 0)
{
usb_moded_mode_cleanup(get_usb_module());
set_usb_mode(get_trigger_mode());
}
}
else
return;
......
......@@ -49,6 +49,14 @@ static gboolean monitor_udev(GIOChannel *iochannel G_GNUC_UNUSED, GIOCondition c
gpointer data G_GNUC_UNUSED);
static void udev_parse(struct udev_device *dev);
static void notify_issue (gpointer data)
{
log_debug("USB connection watch destroyed, restarting it\n!");
/* restart trigger */
hwal_cleanup();
hwal_init();
}
gboolean hwal_init(void)
{
const gchar *udev_path = NULL;
......@@ -103,7 +111,7 @@ gboolean hwal_init(void)
udev_parse(dev);
iochannel = g_io_channel_unix_new(udev_monitor_get_fd(mon));
watch_id = g_io_add_watch(iochannel, G_IO_IN, monitor_udev, NULL);
watch_id = g_io_add_watch_full(iochannel, 0, G_IO_IN, monitor_udev, NULL,notify_issue);
/* everything went well */
return TRUE;
......
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