From 57cf9b4b06cf6bf722dd920fc9858d4dc569eb1e Mon Sep 17 00:00:00 2001 From: Philippe De Swert Date: Mon, 15 Aug 2011 15:33:54 +0300 Subject: [PATCH] restart udev trigger when socket gets destroyed Signed-off-by: Philippe De Swert --- debian/changelog | 6 ++++++ src/usb_moded-trigger.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1e4adb9..87c2767 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +usb-moded (0.46) unstable; urgency=low + + * Restart usb trigger if the socket gets destroyed. + + -- Philippe De Swert Mon, 15 Aug 2011 15:28:16 +0300 + usb-moded (0.45) unstable; urgency=low * Only signal MODE_UNDEFINED when we have actually done all the modesetting handling diff --git a/src/usb_moded-trigger.c b/src/usb_moded-trigger.c index f35171c..1878a6d 100644 --- a/src/usb_moded-trigger.c +++ b/src/usb_moded-trigger.c @@ -53,6 +53,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("trigger watch destroyed\n!"); + /* restart trigger */ + trigger_init(); +} + + gboolean trigger_init(void) { const gchar *udev_path = NULL; @@ -109,7 +117,7 @@ gboolean trigger_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 */ log_debug("Trigger enabled!\n");