[ohm] ohm: Branch 'debian' - 8 commits

Rob Taylor robtaylor at kemper.freedesktop.org
Thu Sep 13 05:47:15 PDT 2007


 configure.in                        |   16 +++++++++++++---
 debian/changelog                    |   13 +++++++++++++
 debian/control                      |    4 ++--
 debian/rules                        |    2 +-
 docs/Makefile.am                    |   24 +++++++++++++-----------
 libidletime/libidletime.c           |   35 +++++++++++++++++++++++++++++++++--
 libidletime/libidletime.h           |    4 +++-
 ohmd/ohm-plugin.c                   |    1 +
 plugins/glue/idle/ohm-plugin-idle.c |   30 +++++++++++++++++++++---------
 plugins/glue/xorg/ohm-plugin-xorg.c |   18 ++++++++++++++----
 10 files changed, 114 insertions(+), 33 deletions(-)

New commits:
diff-tree f4908f9a2508e79a1e58fb6c08f602f4cbccb97d (from a18ce83f522b6fc3db3aff0b26b4a3a718082dba)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Sep 13 12:16:02 2007 +0100

    build debian packages with --without-xauth
    
    As debian packages are only used for Maemo at the moment, configure --without-xauth as Maemo xserver doesnt require authentication.

diff --git a/debian/changelog b/debian/changelog
index 56375a7..fe31976 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ohm (0.1.1-2) experimental; urgency=low
+
+  * build --without-xauth
+
+ -- Rob Taylor <rob.taylor at codethink.co.uk>  Wed, 12 Sep 2007 16:21:13 +0100
+
 ohm (0.1.1-1) sardine; urgency=low
 
   * Fix up build depends.
diff --git a/debian/rules b/debian/rules
index ec3f70a..514b0a6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/autotools.mk
 
-DEB_CONFIGURE_EXTRA_FLAGS := --with-xauth-dir=/user/home \
+DEB_CONFIGURE_EXTRA_FLAGS := --without-xauth \
 			     --with-distro=debian \
 			     --with-doc-dor=/usr/share/doc/ohm \
 			     --with-html-dir=/usr/share/doc/ohm \
diff-tree a18ce83f522b6fc3db3aff0b26b4a3a718082dba (from 691eb0eee82027611ba761548390c4649a230aeb)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Sun Sep 9 20:54:24 2007 +0100

    fix up dependancies in debian packaging.
    
    Fix up build depends.
    Add hal to depends for ohm binary package.

diff --git a/debian/changelog b/debian/changelog
index 32c3f89..56375a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ohm (0.1.1-1) sardine; urgency=low
+
+  * Fix up build depends.
+  * Add hal to depends for ohm binary package.
+
+ -- Rob Taylor <rob.taylor at codethink.co.uk>  Fri, 07 Sep 2007 03:27:43 +0100
+
 ohm (0.1.1-0) experimental; urgency=low
 
   * Initial release.
diff --git a/debian/control b/debian/control
index 6efc141..eaac7ac 100644
--- a/debian/control
+++ b/debian/control
@@ -2,13 +2,13 @@ Source: ohm
 Section: admin
 Priority: optional
 Maintainer: Rob Taylor <rob.taylor at codethink.co.uk>
-Build-Depends: debhelper, cdbs, libdbus-glib-1-dev (>= 0.70), libglib2.0-dev, pkg-config, intltool (>= 0.22), libhal-dev (>= 0.5.7), libgtk2.0-dev (>= 2.10.0), x11proto-xext-dev, libx11-dev, x11proto-core-dev, gtk-doc-tools, docbook, docbook-dsssl, docbook-xml
+Build-Depends: debhelper, cdbs, libdbus-glib-1-dev (>= 0.70), libglib2.0-dev, pkg-config, intltool (>= 0.22), libhal-dev (>= 0.5.7), libgtk2.0-dev (>= 2.10.0), x11proto-xext-dev, libx11-dev, x11proto-core-dev, gtk-doc-tools, docbook, docbook-dsssl, docbook-xml, xmlto
 Standards-Version: 3.7.2
 XS-Python-Version: 2.4
 
 Package: ohm
 Architecture: any
-Depends: ${shlibs:Depends}, dbus (>= 0.60-1), lsb-base
+Depends: ${shlibs:Depends}, hal, dbus (>= 0.60-1), lsb-base
 Description: Open Hardware Manager
  OHM is a hardware state manager
  .
diff-tree 691eb0eee82027611ba761548390c4649a230aeb (from parents)
Merge: e3c5f2f25d390878f77cb03b978e3d3c5dcc7c3b f3e2735d7d2a1dcc9a6cff9cdadba79446c5dd7d
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Sep 13 13:34:08 2007 +0100

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/ohm into debian-origin

diff-tree f3e2735d7d2a1dcc9a6cff9cdadba79446c5dd7d (from dcd3cd3922cff75d4d1314529be560e8d3171d15)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Sep 13 12:14:40 2007 +0100

    add --without-xauth configure option
    
    Allow single-user-devices to be configured --without-xauth, which tells ohm that it can connect to the xserver without needing an .Xauthority.

diff --git a/configure.in b/configure.in
index 9eda015..1a4ecdd 100644
--- a/configure.in
+++ b/configure.in
@@ -118,16 +118,26 @@ single_user_device="yes"
 if test "$single_user_device" = yes; then
 	AC_DEFINE(OHM_SINGLE_USER_DEVICE, 1, [Whether OHM is built for a single-user device with a known .Xauthority location])
 
+	AC_ARG_WITH(xauth,
+		[AC_HELP_STRING([--without-xauth],
+			[Whether xauth is needed to access the Xserver.]
+			)],
+		[with_xauth="$withval"], [with_xauth="yes"]
+		)
+
+
 	AC_ARG_WITH(xauth-dir,
 		[AC_HELP_STRING([--with-xauth-dir=<dir>],
 			[directory where we can find .Xauthority (for single-user device)]
 			)]
 		)
 
-	if test -z "$with_xauth_dir"; then
-		AC_MSG_ERROR([Must use --with-xauth-dir for a single-user device]) 
+	if test "x$with_xauth" = "xno"; then
+		AC_DEFINE(OHM_DEVICE_NO_XAUTH, 1, [No Xauth needed for Xserver access])
+	elif test -z "$with_xauth_dir"; then
+		AC_MSG_ERROR([Must use --without-xauth or --with-xauth-dir for a single-user device])
 	else
-		AC_DEFINE(OHM_DEVICE_XAUTH_DIR, "$xauth_dir", [Where to find .Xauthority])
+		AC_DEFINE_UNQUOTED(OHM_DEVICE_XAUTH_DIR, "$with_xauth_dir", [Where to find .Xauthority])
 	fi
 fi
 
diff --git a/plugins/glue/xorg/ohm-plugin-xorg.c b/plugins/glue/xorg/ohm-plugin-xorg.c
index 28b3f1a..3bca47b 100644
--- a/plugins/glue/xorg/ohm-plugin-xorg.c
+++ b/plugins/glue/xorg/ohm-plugin-xorg.c
@@ -32,10 +32,13 @@ static gboolean
 plugin_poll_startup (gpointer data)
 {
 	OhmPlugin *plugin = (OhmPlugin *) data;
+
+#ifdef OHM_SINGLE_USER_DEVICE
+#ifndef OHM_DEVICE_NO_XAUTH
+
 	gboolean ret;
 	const gchar *xauth;
 
-#ifdef OHM_SINGLE_USER_DEVICE
 	xauth = OHM_DEVICE_XAUTH_DIR "/.Xauthority";
 	g_debug ("xorg: testing %s", xauth);
 	ret = g_file_test (xauth, G_FILE_TEST_EXISTS);
@@ -53,14 +56,21 @@ plugin_poll_startup (gpointer data)
 		g_debug ("xorg: no .Xauthority found");
 		return TRUE;
 	}
+	setenv ("XAUTHORITY", xauth, 1);
+	g_debug ("Using XAUTHORITY %s", xauth);
+#else
+	g_debug ("Not using XAuth");
+#endif
+
 #else
 #error ConsoleKit support not yet implemented
 #endif
+
+	setenv ("DISPLAY", ":0", 1);
+
 	/* woot! X is alive */
 	g_debug ("Got X!");
 	ohm_plugin_conf_set_key (plugin, "xorg.has_xauthority", 1);
-	setenv ("XAUTHORITY", xauth, 1);
-	setenv ("DISPLAY", ":0", 1);
 	/* we don't need to poll anymore */
 	return FALSE;
 }
diff-tree dcd3cd3922cff75d4d1314529be560e8d3171d15 (from 7569bf2c692216927ff3690a3fc24a58d33206cb)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Thu Sep 13 12:03:53 2007 +0100

    xorg plugin: first call of plugin_poll_startup handled incorrectly
    
    In plugin_initialize, the return value of the first call to plugin_poll_startup is handled incorrectly - as plugin_poll_startup is a GSourceFunc, it returns FALSE when it's successful..

diff --git a/plugins/glue/xorg/ohm-plugin-xorg.c b/plugins/glue/xorg/ohm-plugin-xorg.c
index f91c8af..28b3f1a 100644
--- a/plugins/glue/xorg/ohm-plugin-xorg.c
+++ b/plugins/glue/xorg/ohm-plugin-xorg.c
@@ -82,7 +82,7 @@ plugin_initialize (OhmPlugin *plugin)
 
 	/* naive try... we might be running under X */
 	ret = plugin_poll_startup (plugin);
-	if (ret == FALSE) {
+	if (ret == TRUE) {
 		/* we failed to connect to X - maybe X is not alive yet? */
 		g_debug ("Could not connect to X, polling until we can");
 		g_timeout_add (2000, plugin_poll_startup, plugin);
diff-tree 7569bf2c692216927ff3690a3fc24a58d33206cb (from dda8bc9397a3f81e265a68b184cd4293b3734b6d)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Wed Sep 5 12:52:13 2007 +0100

    add some debug for which plugin changed which key

diff --git a/ohmd/ohm-plugin.c b/ohmd/ohm-plugin.c
index 1480ebd..dcce2a6 100644
--- a/ohmd/ohm-plugin.c
+++ b/ohmd/ohm-plugin.c
@@ -159,6 +159,7 @@ ohm_plugin_conf_set_key (OhmPlugin   *pl
 	 * itself if it's interest in that key
 	 */
 	plugin->priv->key_being_set = key;
+	ohm_debug ("plugin %s setting key %s to %d", plugin->priv->name, key, value);
 	ret = ohm_conf_set_key_internal (plugin->priv->conf, key, value, TRUE, &error);
 	plugin->priv->key_being_set = NULL;
 
diff-tree dda8bc9397a3f81e265a68b184cd4293b3734b6d (from 437a86a4b18a2be033225432fd099bcb7f0c3114)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Wed Sep 5 13:03:07 2007 +0100

    add idle.reset
    
    Adds a reset key to the idle plugin. This allows other plugins to reset the state back to 0 and restart the timer. The idle plugin finds the current time idle and uses this as an offset until the xserver signals activity.

diff --git a/libidletime/libidletime.c b/libidletime/libidletime.c
index 0d75b50..feecef1 100644
--- a/libidletime/libidletime.c
+++ b/libidletime/libidletime.c
@@ -41,6 +41,21 @@ static void     idletime_finalize   (GOb
 
 #define LIBIDLETIME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LIBIDLETIME_TYPE, LibIdletimePrivate))
 
+inline gint64
+xsyncvalue_to_int64 (XSyncValue *value)
+{
+	return ((guint64) XSyncValueHigh32 (*value)) << 32
+		| (guint64) XSyncValueLow32 (*value);
+}
+
+inline XSyncValue
+int64_to_xsyncvalue (gint64 value)
+{
+	XSyncValue ret;
+	XSyncIntsToValue (&ret, value, ((guint64)value) >> 32);
+	return ret;
+}
+
 struct LibIdletimePrivate
 {
 	int			 sync_event;
@@ -268,7 +283,7 @@ idletime_alarm_get (LibIdletime *idletim
  * idletime_alarm_set:
  */
 gboolean
-idletime_alarm_set (LibIdletime *idletime, guint id, guint timeout)
+idletime_alarm_set (LibIdletime *idletime, guint id, gint64 timeout)
 {
 	LibIdletimeAlarm *alarm;
 	if (id == 0) {
@@ -294,7 +309,7 @@ idletime_alarm_set (LibIdletime *idletim
 	}
 
 	/* set the timeout */
-	XSyncIntToValue (&alarm->timeout, timeout);
+	alarm->timeout = int64_to_xsyncvalue(timeout);
 
 	/* set, and start the timer */
 	idletime_xsync_alarm_set (idletime, alarm, TRUE);
@@ -332,6 +347,22 @@ idletime_alarm_remove (LibIdletime *idle
 }
 
 /**
+ * idletime_get_current_idle:
+ * @idletime: An #LibIdletime instantiation
+ * 
+ * Returns the current number of milliseconds idle
+ */
+gint64
+idletime_get_current_idle (LibIdletime *idletime)
+{
+	XSyncValue value;
+	if (XSyncQueryCounter (idletime->priv->dpy, idletime->priv->idle_counter, &value))
+		return xsyncvalue_to_int64 (&value);
+	else
+		return 0LL;
+}
+
+/**
  * idletime_class_init:
  * @klass: This class instance
  **/
diff --git a/libidletime/libidletime.h b/libidletime/libidletime.h
index cfd7a81..dfaee7e 100644
--- a/libidletime/libidletime.h
+++ b/libidletime/libidletime.h
@@ -55,10 +55,12 @@ void		 idletime_alarm_reset_all		(LibIdl
 guint		 idletime_alarm_get			(LibIdletime	*idletime);
 gboolean	 idletime_alarm_set			(LibIdletime	*idletime,
 							 guint		 id,
-							 guint		 timeout);
+							 gint64		 timeout);
 gboolean	 idletime_alarm_remove			(LibIdletime	*idletime,
 							 guint		 id);
 
+gint64		 idletime_get_current_idle		(LibIdletime *idletime);
+
 G_END_DECLS
 
 #endif	/* __LIBIDLETIME_H */
diff --git a/plugins/glue/idle/ohm-plugin-idle.c b/plugins/glue/idle/ohm-plugin-idle.c
index 5c6bff4..3b55202 100644
--- a/plugins/glue/idle/ohm-plugin-idle.c
+++ b/plugins/glue/idle/ohm-plugin-idle.c
@@ -26,11 +26,12 @@
 #include <stdlib.h>
 
 static LibIdletime *idletime = NULL;
+static gint64 timeout_offset = 0;
 
 enum {
 	CONF_XORG_HASXAUTH_CHANGED,
 	CONF_IDLE_TIMEOUT_CHANGED,
-	CONF_IDLE_STATE_CHANGED,
+	CONF_IDLE_RESET,
 	CONF_LAST
 };
 
@@ -43,6 +44,7 @@ ohm_alarm_expired_cb (LibIdletime *idlet
 	if (alarm == 0 ) {
 		/* activity, reset state to 0 */
 		ohm_plugin_conf_set_key (plugin, "idle.state", 0);
+		timeout_offset = 0;
 	} else {
 		ohm_plugin_conf_get_key (plugin, "idle.state", &state);
 		ohm_plugin_conf_set_key (plugin, "idle.state", state+1);
@@ -68,6 +70,7 @@ plugin_connect_idletime (OhmPlugin *plug
 			  G_CALLBACK (ohm_alarm_expired_cb), plugin);
 
 	ohm_plugin_conf_set_key (plugin, "idle.state", 0);
+	ohm_plugin_conf_set_key (plugin, "idle.reset", 0);
 
 	ohm_plugin_conf_get_key (plugin, "idle.timeout", &timeout);
 
@@ -111,6 +114,7 @@ plugin_initalize (OhmPlugin *plugin)
 static void
 plugin_notify (OhmPlugin *plugin, gint id, gint value)
 {
+	g_debug ("idle got notify, id = %d, value = %d", id, value);
 	gint timeout;
 	if (id == CONF_XORG_HASXAUTH_CHANGED) {
 		if (value == 1) {
@@ -120,12 +124,20 @@ plugin_notify (OhmPlugin *plugin, gint i
 	if (idletime) {
 		if (id == CONF_IDLE_TIMEOUT_CHANGED ) {
 			g_debug("setting new timeout %d", value);
-			idletime_alarm_set (idletime, 1, value);
-		} else if (id == CONF_IDLE_STATE_CHANGED ) {
-			if (value == 0) {
-				ohm_plugin_conf_get_key (plugin, "idle.timeout", &timeout);
-				idletime_alarm_set (idletime, 1, timeout);
-			}
+			idletime_alarm_set (idletime, 1, timeout_offset+value);
+		} else if (id == CONF_IDLE_RESET && value == 1) {
+			timeout_offset = idletime_get_current_idle (idletime);
+			ohm_plugin_conf_get_key (plugin, "idle.timeout", &timeout);
+			g_debug ("idle plugin reset. current timeout = %d, timeout-offset = %lld", timeout, timeout_offset);
+
+			/* most of the time this isn't needed as the below set
+			 * of idle.state will result in a timout change,
+			 * but just incase it doesn't happen. or the
+			 * new timeout is the same as the old..
+			 */
+			idletime_alarm_set (idletime, 1, timeout_offset+timeout);
+			ohm_plugin_conf_set_key (plugin, "idle.reset", 0);
+			ohm_plugin_conf_set_key (plugin, "idle.state", 0);
 		}
 	}
 }
@@ -148,9 +160,9 @@ OHM_PLUGIN_DESCRIPTION (
 
 OHM_PLUGIN_REQUIRES ("xorg");
 
-OHM_PLUGIN_PROVIDES ("idle.state", "idle.timeout");
+OHM_PLUGIN_PROVIDES ("idle.state", "idle.timeout", "idle.reset");
 
 OHM_PLUGIN_INTERESTED (
 	{"xorg.has_xauthority", CONF_XORG_HASXAUTH_CHANGED},
 	{"idle.timeout", CONF_IDLE_TIMEOUT_CHANGED},
-	{"idle.state", CONF_IDLE_STATE_CHANGED});
+	{"idle.reset", CONF_IDLE_RESET});
diff-tree 437a86a4b18a2be033225432fd099bcb7f0c3114 (from b5f76d26d2e94f9279b03b56aaf20038cd853cdd)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Tue Sep 4 14:46:48 2007 +0100

    don't try to distribute index.html if we can't build it.
    
    Makes dist and install of index.html dependant on docbook-doc being enabled.

diff --git a/docs/Makefile.am b/docs/Makefile.am
index c3d3800..0b6cca2 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -21,15 +21,6 @@ SPEC_XML_FILES =			\
 SPEC_HTML_FILES =			\
 	index.html
 
-htmldocdir = $(docdir)
-htmldoc_DATA = index.html
-
-if DOCBOOK_DOCS_ENABLED
-
-index.html : introduction.xml
-	$(XMLTO) html-nochunks -m config.xsl index.xml
-endif # DOCBOOK_DOCS_ENABLED
-
 clean-local:
 	rm -f *~
 	rm -f *.html
@@ -39,5 +30,16 @@ EXTRA_DIST = 				\
 	config.xsl			\
 	docbook.css			\
 	$(SPEC_XML_FILES)		\
-	$(IMAGE_FILES)			\
-	$(SPEC_HTML_FILES)
+	$(IMAGE_FILES)
+
+if DOCBOOK_DOCS_ENABLED
+
+htmldocdir = $(docdir)
+htmldoc_DATA = index.html
+
+index.html : introduction.xml
+	$(XMLTO) html-nochunks -m config.xsl index.xml
+
+EXTRA_DIST += $(SPEC_HTML_FILES)
+
+endif #DOCBOOK_DOCS_ENABLED


More information about the Ohm-devel mailing list