[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Freeze exception for colorhug-client 0.1.11



Hi

Dne Tue, 03 Jul 2012 21:58:38 +0100
"Adam D. Barratt" <adam@adam-barratt.org.uk> napsal(a):

> On Tue, 2012-07-03 at 09:46 +0200, Michal Čihař wrote:
> > I'd like to upload colorhug-client 0.1.11-1 to unstable and get freeze
> > exception for it. It's new upstream release which fixes few annoying
> > bugs (most notably broken dark offsets calibration). The package
> > contains tool for managing ColorHug device and there are no reverse
> > dependencies.
> > 
> > Not attaching the diff between versions as it is quite huge (mostly due
> > to translation updates).
> 
> We're not going to consider an exception without even an idea of the
> diff, I'm afraid.  Could you prepare a filtered version without the
> translation noise?  (e.g. "| filterdiff -x '*/*.po'")

Okay, attaching filtered diff without translations. Sorry for not
doing this at beginning.

-- 
	Michal Čihař | http://cihar.com | http://blog.cihar.com
diff --git a/NEWS b/NEWS
index c0448c1..0e36bb9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,24 @@
+Version 0.1.11
+~~~~~~~~~~~~~~
+Released: 2012-07-02
+
+Notes:
+ - If you've used the set-dark-offsets command, you've probably
+   overwritten your dark cal with values that are 3000x too large.
+ - Just install this version of colorhug-client and re-execute
+   '$ colorhug set-dark-offsets' and save the new values.
+
+New Features:
+ - Show the calibration types when doing 'list-calibration' (Richard Hughes)
+ - Ask the user to cover the aperture before doing a dark cal (Richard Hughes)
+
+Bugfixes:
+ - Do not hardcode the type as 'all' when loading a CCMX  (Richard Hughes)
+ - Recognise the INVALID_CALIBRATION error enum (Richard Hughes)
+ - Recognise the NO_WELCOME errata enum (Richard Hughes)
+ - Do not spin if enter is pressed at [Y/n] (Richard Hughes)
+ - Set the post-scale to unity for the dark offsets (Richard Hughes)
+
 Version 0.1.10
 ~~~~~~~~~~~~~~
 Released: 2012-06-11
diff --git a/RELEASE b/RELEASE
index 16b95d5..d339f0c 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
 
 1. Write NEWS entries in the same format as usual.
 
-git shortlog COLORHUG_CLIENT_0_1_9.. | grep -i -v trivial | uniq | grep -v Merge > NEWS.new
+git shortlog COLORHUG_CLIENT_0_1_10.. | grep -i -v trivial | uniq | grep -v Merge > NEWS.new
 
 --------------------------------------------------------------------------------
-Version 0.1.10
+Version 0.1.11
 ~~~~~~~~~~~~~~
 Released: 2012-xx-xx
 
@@ -20,8 +20,8 @@ Bugfixes:
 
 tx pull --all
 git add po/*.po
-git commit -a -m "Release version 0.1.10"
-git tag -s COLORHUG_CLIENT_0_1_10 -m "==== Version 0.1.10 ===="
+git commit -a -m "Release version 0.1.11"
+git tag -s COLORHUG_CLIENT_0_1_11 -m "==== Version 0.1.11 ===="
 <wait>
 git push --tags
 git push
@@ -45,7 +45,7 @@ tx push --source
 8. Send an email to colorhug-users
 
 =================================================
-colorhug-client 0.1.10 released!
+colorhug-client 0.1.11 released!
 
 This package includes the client tools which allows the user to upgrade
 the firmware on the sensor or to access the sensor from command line
diff --git a/configure.ac b/configure.ac
index a511c7a..e962eb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.63)
 
 m4_define([ch_major_version], [0])
 m4_define([ch_minor_version], [1])
-m4_define([ch_micro_version], [10])
+m4_define([ch_micro_version], [11])
 m4_define([ch_version],
           [ch_major_version.ch_minor_version.ch_micro_version])
 
diff --git a/libcolorhug/ch-common.c b/libcolorhug/ch-common.c
index eeeb5ec..3d629f3 100644
--- a/libcolorhug/ch-common.c
+++ b/libcolorhug/ch-common.c
@@ -108,6 +108,9 @@ ch_strerror (ChError error_enum)
 	case CH_ERROR_SELF_TEST_COLOR_SELECT:
 		str = "Self test failed: Color Select";
 		break;
+	case CH_ERROR_INVALID_CALIBRATION:
+		str = "Invalid calibration";
+		break;
 	default:
 		str = "Unknown error, please report";
 		break;
diff --git a/libcolorhug/ch-common.h b/libcolorhug/ch-common.h
index 356e37e..4a06ac5 100644
--- a/libcolorhug/ch-common.h
+++ b/libcolorhug/ch-common.h
@@ -722,6 +722,7 @@ typedef enum {
 	CH_ERROR_SELF_TEST_BLUE,
 	CH_ERROR_SELF_TEST_COLOR_SELECT,
 	CH_ERROR_SELF_TEST_MULTIPLIER,
+	CH_ERROR_INVALID_CALIBRATION,
 	CH_ERROR_LAST
 } ChError;
 
@@ -729,7 +730,7 @@ typedef enum {
 typedef enum {
 	CH_PCB_ERRATA_NONE		= 0,
 	CH_PCB_ERRATA_SWAPPED_LEDS	= 1 << 0,
-	CH_PCB_ERRATA_LAST		= 1 << 1
+	CH_PCB_ERRATA_NO_WELCOME	=  1 << 1,
 } ChPcbErrata;
 
 /* prototypes */
diff --git a/libcolorhug/ch-device-queue.c b/libcolorhug/ch-device-queue.c
index 2e0ba40..26e546f 100644
--- a/libcolorhug/ch-device-queue.c
+++ b/libcolorhug/ch-device-queue.c
@@ -1000,6 +1000,7 @@ ch_device_queue_set_calibration_ccmx (ChDeviceQueue *device_queue,
 	const gchar *description;
 	gboolean ret = TRUE;
 	gdouble *calibration_tmp;
+	guint8 types = 0;
 	guint i;
 
 	g_return_val_if_fail (CD_IS_IT8 (ccmx), FALSE);
@@ -1013,6 +1014,27 @@ ch_device_queue_set_calibration_ccmx (ChDeviceQueue *device_queue,
 		goto out;
 	}
 
+	/* get the supported display types */
+	if (cd_it8_has_option (ccmx, "TYPE_FACTORY")) {
+		types = CH_CALIBRATION_TYPE_ALL;
+	} else {
+		if (cd_it8_has_option (ccmx, "TYPE_LCD"))
+			types += CH_CALIBRATION_TYPE_LCD;
+		if (cd_it8_has_option (ccmx, "TYPE_LED"))
+			types += CH_CALIBRATION_TYPE_LED;
+		if (cd_it8_has_option (ccmx, "TYPE_CRT"))
+			types += CH_CALIBRATION_TYPE_CRT;
+		if (cd_it8_has_option (ccmx, "TYPE_PROJECTOR"))
+			types += CH_CALIBRATION_TYPE_PROJECTOR;
+	}
+
+	/* no types set in CCMX file */
+	if (types == 0) {
+		ret = FALSE;
+		g_set_error_literal (error, 1, 0, "No TYPE_x in ccmx file");
+		goto out;
+	}
+
 	/* get the description from the ccmx file */
 	description = cd_it8_get_title (ccmx);
 	if (description == NULL) {
@@ -1041,7 +1063,7 @@ ch_device_queue_set_calibration_ccmx (ChDeviceQueue *device_queue,
 					 device,
 					 calibration_index,
 					 calibration,
-					 CH_CALIBRATION_TYPE_ALL,
+					 types,
 					 description);
 out:
 	return ret;
diff --git a/po/de_DE.po b/po/de_DE.po
index 1b14c06..fd58814 100644
diff --git a/po/lv.po b/po/lv.po
index 396461b..c12331a 100644
diff --git a/po/nb.po b/po/nb.po
index c7b30db..e6b66e4 100644
diff --git a/src/ch-flash-md.c b/src/ch-flash-md.c
index fbd9d38..87f9c3a 100644
--- a/src/ch-flash-md.c
+++ b/src/ch-flash-md.c
@@ -163,7 +163,7 @@ ch_flash_md_start_element_cb (GMarkupParseContext *context,
 			priv->pos = CH_FLASH_MD_POS_CHANGELOG;
 			return;
 		}
-		g_debug ("unknown start tag %s for updates", element_name);
+		g_debug ("unknown start tag %s for update", element_name);
 		return;
 	}
 	if (priv->pos == CH_FLASH_MD_POS_CHANGELOG) {
@@ -175,7 +175,7 @@ ch_flash_md_start_element_cb (GMarkupParseContext *context,
 			priv->pos = CH_FLASH_MD_POS_WARNING;
 			return;
 		}
-		g_debug ("unknown start tag %s for updates", element_name);
+		g_debug ("unknown start tag %s for changelog", element_name);
 		return;
 	}
 	g_debug ("unknown start pos value: %s",
diff --git a/src/ch-main.c b/src/ch-main.c
index 25a15a9..93e91ad 100644
--- a/src/ch-main.c
+++ b/src/ch-main.c
@@ -183,23 +183,27 @@ static gboolean
 ch_util_get_prompt (const gchar *question, gboolean defaultyes)
 {
 	gboolean ret = FALSE;
-	gboolean valid = FALSE;
 	gchar value;
 
 	g_print ("%s %s ",
 		 question,
 		 defaultyes ? "[Y/n]" : "[N/y]");
-	while (!valid) {
+	while (TRUE) {
 		value = getchar ();
 		if (value == 'y' || value == 'Y') {
-			valid = TRUE;
 			ret = TRUE;
+			goto out;
 		}
 		if (value == 'n' || value == 'N') {
-			valid = TRUE;
 			ret = FALSE;
+			goto out;
+		}
+		if (value == '\n') {
+			ret = defaultyes;
+			goto out;
 		}
 	}
+out:
 	return ret;
 }
 
@@ -987,6 +991,24 @@ out:
 }
 
 /**
+ * ch_util_types_to_short_string:
+ **/
+static gchar *
+ch_util_types_to_short_string (guint8 types)
+{
+	GString *str = g_string_new ("");
+	if ((types & CH_CALIBRATION_TYPE_LCD) > 0)
+		g_string_append (str, "L");
+	if ((types & CH_CALIBRATION_TYPE_CRT) > 0)
+		g_string_append (str, "C");
+	if ((types & CH_CALIBRATION_TYPE_PROJECTOR) > 0)
+		g_string_append (str, "P");
+	if ((types & CH_CALIBRATION_TYPE_LED) > 0)
+		g_string_append (str, "E");
+	return g_string_free (str, FALSE);
+}
+
+/**
  * ch_util_list_calibration:
  **/
 static gboolean
@@ -994,9 +1016,11 @@ ch_util_list_calibration (ChUtilPrivate *priv, gchar **values, GError **error)
 {
 	gboolean ret;
 	gchar description[CH_CALIBRATION_DESCRIPTION_LEN];
+	gchar *tmp;
 	GError *error_local = NULL;
 	GString *string;
 	guint16 i;
+	guint8 types;
 
 	string = g_string_new ("");
 	for (i = 0; i < CH_CALIBRATION_MAX; i++) {
@@ -1005,7 +1029,7 @@ ch_util_list_calibration (ChUtilPrivate *priv, gchar **values, GError **error)
 						 priv->device,
 						 i,
 						 NULL,
-						 NULL,
+						 &types,
 						 description);
 		ret = ch_device_queue_process (priv->device_queue,
 					       CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
@@ -1013,8 +1037,10 @@ ch_util_list_calibration (ChUtilPrivate *priv, gchar **values, GError **error)
 					       &error_local);
 		if (ret) {
 			if (description[0] != '\0') {
-				g_string_append_printf (string, "%i\t%s\n",
-							i, description);
+				tmp = ch_util_types_to_short_string (types);
+				g_string_append_printf (string, "%i\t%s [%s]\n",
+							i, description, tmp);
+				g_free (tmp);
 			}
 		} else {
 			g_debug ("ignoring error: %s", error_local->message);
@@ -1403,6 +1429,8 @@ ch_util_get_pcb_errata (ChUtilPrivate *priv, gchar **values, GError **error)
 	}
 	if ((pcb_errata & CH_PCB_ERRATA_SWAPPED_LEDS) > 0)
 		g_print ("Errata: swapped-leds\n");
+	if ((pcb_errata & CH_PCB_ERRATA_NO_WELCOME) > 0)
+		g_print ("Errata: no-welcome\n");
 out:
 	return ret;
 }
@@ -1429,6 +1457,10 @@ ch_util_set_pcb_errata (ChUtilPrivate *priv, gchar **values, GError **error)
 		g_print ("Errata: swapped-leds\n");
 		pcb_errata += CH_PCB_ERRATA_SWAPPED_LEDS;
 	}
+	if (g_strstr_len (values[0], -1, "no-welcome") != NULL) {
+		g_print ("Errata: no-welcome\n");
+		pcb_errata += CH_PCB_ERRATA_NO_WELCOME;
+	}
 
 	/* nothing known by this client version */
 	if (pcb_errata == CH_PCB_ERRATA_NONE)
@@ -1556,22 +1588,38 @@ static gboolean
 ch_util_set_dark_offsets_auto (ChUtilPrivate *priv, GError **error)
 {
 	gboolean ret;
+	gdouble post_scale_old = 0.0f;
 	CdColorRGB value_old;
+	CdColorRGB value_zero;
 	CdColorRGB value;
 
+	/* TRANSLATORS: wait for user to press the device into a desk... */
+	ret = ch_util_get_prompt (_("Ensure the ColorHug aperture is blocked"), TRUE);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0,
+				     "user declined");
+		goto out;
+	}
+
 	/* set dark offsets */
-	cd_color_set_rgb (&value, 0.0f, 0.0f, 0.0f);
+	cd_color_set_rgb (&value_zero, 0.0f, 0.0f, 0.0f);
 
 	/* get from HW */
 	ch_device_queue_get_dark_offsets (priv->device_queue,
 					  priv->device,
 					  &value_old);
+	ch_device_queue_get_post_scale (priv->device_queue,
+					priv->device,
+					&post_scale_old);
 	ch_device_queue_set_dark_offsets (priv->device_queue,
 					  priv->device,
-					  &value);
+					  &value_zero);
 	ch_device_queue_set_integral_time (priv->device_queue,
 					   priv->device,
 					   CH_INTEGRAL_TIME_VALUE_MAX);
+	ch_device_queue_set_post_scale (priv->device_queue,
+					priv->device,
+					1);
 	ch_device_queue_set_multiplier (priv->device_queue,
 					priv->device,
 					CH_FREQ_SCALE_100);
@@ -1594,6 +1642,9 @@ ch_util_set_dark_offsets_auto (ChUtilPrivate *priv, GError **error)
 		ch_device_queue_set_dark_offsets (priv->device_queue,
 						  priv->device,
 						  &value_old);
+		ch_device_queue_set_post_scale (priv->device_queue,
+						priv->device,
+						post_scale_old);
 		ret = ch_device_queue_process (priv->device_queue,
 					       CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
 					       NULL,
@@ -1609,6 +1660,9 @@ ch_util_set_dark_offsets_auto (ChUtilPrivate *priv, GError **error)
 	ch_device_queue_set_dark_offsets (priv->device_queue,
 					  priv->device,
 					  &value);
+	ch_device_queue_set_post_scale (priv->device_queue,
+					priv->device,
+					post_scale_old);
 	ch_device_queue_write_eeprom (priv->device_queue,
 				      priv->device,
 				      CH_WRITE_EEPROM_MAGIC);

Attachment: signature.asc
Description: PGP signature


Reply to: