summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-06-10 08:59:56 +0100
committerRichard Hughes <richard@hughsie.com>2014-10-24 09:43:45 +0100
commitd60f4b7110b3fb7357e4af01d69cfb04c3434403 (patch)
treef8a654cf30ef07c6780526fe22c86b3d260a73f0
parentc711eba78570cc2d7039291f8698266813c8dba3 (diff)
downloadcolord-d60f4b7110b3fb7357e4af01d69cfb04c3434403.tar.gz
Use the ColorHug sensor driver for the ColorHug2 hardware
-rw-r--r--lib/colord/cd-enum.c1
-rw-r--r--lib/colord/cd-enum.h1
-rw-r--r--lib/colorhug/ch-common.c6
-rw-r--r--lib/colorhug/ch-common.h6
-rw-r--r--lib/colorhug/ch-device.c6
-rw-r--r--rules/69-cd-sensors.rules.in2
-rw-r--r--src/cd-sensor.c14
-rw-r--r--src/sensors/cd-sensor-argyll.c2
-rw-r--r--src/sensors/cd-sensor-colorhug.c14
9 files changed, 44 insertions, 8 deletions
diff --git a/lib/colord/cd-enum.c b/lib/colord/cd-enum.c
index cd18785..eba4664 100644
--- a/lib/colord/cd-enum.c
+++ b/lib/colord/cd-enum.c
@@ -48,6 +48,7 @@ typedef struct {
static const CdEnumMatch enum_sensor_kind[] = {
{CD_SENSOR_KIND_UNKNOWN, "unknown"}, /* fall though value */
{CD_SENSOR_KIND_COLORHUG, "colorhug"},
+ {CD_SENSOR_KIND_COLORHUG2, "colorhug2"},
{CD_SENSOR_KIND_COLORHUG_PLUS, "colorhug-plus"},
{CD_SENSOR_KIND_COLORIMTRE_HCFR, "colorimtre-hcfr"},
{CD_SENSOR_KIND_COLOR_MUNKI_PHOTO, "color-munki-photo"},
diff --git a/lib/colord/cd-enum.h b/lib/colord/cd-enum.h
index 7b054a1..131509f 100644
--- a/lib/colord/cd-enum.h
+++ b/lib/colord/cd-enum.h
@@ -190,6 +190,7 @@ typedef enum {
CD_SENSOR_KIND_I1_MONITOR, /* Since: 0.1.25 */
CD_SENSOR_KIND_SPYDER4, /* Since: 0.1.26 */
CD_SENSOR_KIND_COLOR_MUNKI_SMILE, /* Since: 0.1.27 */
+ CD_SENSOR_KIND_COLORHUG2, /* Since: 1.2.2 */
/*< private >*/
CD_SENSOR_KIND_LAST
} CdSensorKind;
diff --git a/lib/colorhug/ch-common.c b/lib/colorhug/ch-common.c
index 9553739..0424d0d 100644
--- a/lib/colorhug/ch-common.c
+++ b/lib/colorhug/ch-common.c
@@ -390,6 +390,12 @@ ch_device_mode_to_string (ChDeviceMode device_mode)
case CH_DEVICE_MODE_FIRMWARE_PLUS:
str = "firmware-plus";
break;
+ case CH_DEVICE_MODE_FIRMWARE2:
+ str = "firmware2";
+ break;
+ case CH_DEVICE_MODE_BOOTLOADER2:
+ str = "bootloader2";
+ break;
default:
str = "unknown";
break;
diff --git a/lib/colorhug/ch-common.h b/lib/colorhug/ch-common.h
index 5c8e931..35024c1 100644
--- a/lib/colorhug/ch-common.h
+++ b/lib/colorhug/ch-common.h
@@ -34,9 +34,11 @@ G_BEGIN_DECLS
/* device constants */
#define CH_USB_VID 0x273f
#define CH_USB_PID_BOOTLOADER 0x1000
+#define CH_USB_PID_BOOTLOADER2 0x1005
+#define CH_USB_PID_BOOTLOADER_PLUS 0x1003
#define CH_USB_PID_FIRMWARE 0x1001
+#define CH_USB_PID_FIRMWARE2 0x1004
#define CH_USB_PID_FIRMWARE_PLUS 0x1002
-#define CH_USB_PID_BOOTLOADER_PLUS 0x1003
#define CH_USB_CONFIG 0x0001
#define CH_USB_INTERFACE 0x0000
#define CH_USB_HID_EP 0x0001
@@ -1005,6 +1007,8 @@ typedef enum {
CH_DEVICE_MODE_FIRMWARE,
CH_DEVICE_MODE_BOOTLOADER_PLUS,
CH_DEVICE_MODE_FIRMWARE_PLUS,
+ CH_DEVICE_MODE_FIRMWARE2, /* since 1.1.8 */
+ CH_DEVICE_MODE_BOOTLOADER2, /* since 1.1.8 */
CH_DEVICE_MODE_LAST
} ChDeviceMode;
diff --git a/lib/colorhug/ch-device.c b/lib/colorhug/ch-device.c
index 464aeb7..acc7f76 100644
--- a/lib/colorhug/ch-device.c
+++ b/lib/colorhug/ch-device.c
@@ -117,12 +117,18 @@ ch_device_get_mode (GUsbDevice *device)
case CH_USB_PID_BOOTLOADER:
state = CH_DEVICE_MODE_BOOTLOADER;
break;
+ case CH_USB_PID_BOOTLOADER2:
+ state = CH_DEVICE_MODE_BOOTLOADER2;
+ break;
case CH_USB_PID_BOOTLOADER_PLUS:
state = CH_DEVICE_MODE_BOOTLOADER_PLUS;
break;
case CH_USB_PID_FIRMWARE:
state = CH_DEVICE_MODE_FIRMWARE;
break;
+ case CH_USB_PID_FIRMWARE2:
+ state = CH_DEVICE_MODE_FIRMWARE2;
+ break;
case CH_USB_PID_FIRMWARE_PLUS:
state = CH_DEVICE_MODE_FIRMWARE_PLUS;
break;
diff --git a/rules/69-cd-sensors.rules.in b/rules/69-cd-sensors.rules.in
index 42ba37f..f4b503b 100644
--- a/rules/69-cd-sensors.rules.in
+++ b/rules/69-cd-sensors.rules.in
@@ -78,7 +78,9 @@ ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f8da", ENV{COLORD_SENSOR_KIND}="colo
# ColorHug
ATTRS{idVendor}=="273f", ATTRS{idProduct}=="1000", ENV{COLORD_SENSOR_KIND}="colorhug", ENV{COLORD_IGNORE}="1"
+ATTRS{idVendor}=="273f", ATTRS{idProduct}=="1005", ENV{COLORD_SENSOR_KIND}="colorhug2", ENV{COLORD_IGNORE}="1"
ATTRS{idVendor}=="273f", ATTRS{idProduct}=="1001", ENV{COLORD_SENSOR_KIND}="colorhug", ENV{COLORD_SENSOR_CAPS}="lcd"
+ATTRS{idVendor}=="273f", ATTRS{idProduct}=="1004", ENV{COLORD_SENSOR_KIND}="colorhug2", ENV{COLORD_SENSOR_CAPS}="lcd"
# ColorHug Spectro
ATTRS{idVendor}=="273f", ATTRS{idProduct}=="1003", ENV{COLORD_SENSOR_KIND}="colorhug-spectro", ENV{COLORD_IGNORE}="1"
diff --git a/src/cd-sensor.c b/src/cd-sensor.c
index 5435918..d3a52dd 100644
--- a/src/cd-sensor.c
+++ b/src/cd-sensor.c
@@ -307,6 +307,7 @@ cd_sensor_load (CdSensor *sensor, GError **error)
gchar *path = NULL;
gchar *path_fallback = NULL;
GModule *handle;
+ const gchar *module_name;
/* no module */
if (sensor->priv->kind == CD_SENSOR_KIND_UNKNOWN) {
@@ -314,9 +315,20 @@ cd_sensor_load (CdSensor *sensor, GError **error)
goto out;
}
+ /* some modules are shared */
+ switch (sensor->priv->kind) {
+ case CD_SENSOR_KIND_COLORHUG:
+ case CD_SENSOR_KIND_COLORHUG2:
+ module_name = "colorhug";
+ break;
+ default:
+ module_name = cd_sensor_kind_to_string (sensor->priv->kind);
+ break;
+ }
+
/* can we load a module? */
backend_name = g_strdup_printf ("libcolord_sensor_%s." G_MODULE_SUFFIX,
- cd_sensor_kind_to_string (sensor->priv->kind));
+ module_name);
path = g_build_filename (LIBDIR, "colord-sensors", backend_name, NULL);
g_debug ("Trying to load sensor driver: %s", path);
handle = g_module_open (path, G_MODULE_BIND_LOCAL);
diff --git a/src/sensors/cd-sensor-argyll.c b/src/sensors/cd-sensor-argyll.c
index e83c110..f8fc6e0 100644
--- a/src/sensors/cd-sensor-argyll.c
+++ b/src/sensors/cd-sensor-argyll.c
@@ -371,6 +371,8 @@ cd_sensor_to_argyll_name (CdSensor *sensor)
return "GretagMacbeth Huey";
case CD_SENSOR_KIND_COLORHUG:
return "Hughski ColorHug";
+ case CD_SENSOR_KIND_COLORHUG2:
+ return "Hughski ColorHug2";
case CD_SENSOR_KIND_COLORHUG_PLUS:
return "Hughski ColorHug+";
default:
diff --git a/src/sensors/cd-sensor-colorhug.c b/src/sensors/cd-sensor-colorhug.c
index 5f47fb8..e934c43 100644
--- a/src/sensors/cd-sensor-colorhug.c
+++ b/src/sensors/cd-sensor-colorhug.c
@@ -365,12 +365,14 @@ cd_sensor_lock_async (CdSensor *sensor,
ch_device_queue_get_serial_number (priv->device_queue,
priv->device,
&state->serial_number);
- ch_device_queue_set_integral_time (priv->device_queue,
- priv->device,
- CH_INTEGRAL_TIME_VALUE_MAX);
- ch_device_queue_set_multiplier (priv->device_queue,
- priv->device,
- CH_FREQ_SCALE_100);
+ if (cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_COLORHUG) {
+ ch_device_queue_set_integral_time (priv->device_queue,
+ priv->device,
+ CH_INTEGRAL_TIME_VALUE_MAX);
+ ch_device_queue_set_multiplier (priv->device_queue,
+ priv->device,
+ CH_FREQ_SCALE_100);
+ }
ch_device_queue_process_async (priv->device_queue,
CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
state->cancellable,