Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
colorhug: Do not require libcolorhug to build
Requiring colord to be built before fwupd makes it hard to build packages. The HID-based flashing protocol is stable and documented, so there's no need to use an external library for this now.
- Loading branch information
Showing
19 changed files
with
508 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
### ColorHug1 ################################################################## | ||
[FuColorhugDevice] | ||
USB\VID_273F&PID_1000=bootloader | ||
USB\VID_273F&PID_1001=none | ||
|
||
[FuUsbDevice:summary] | ||
USB\VID_273F&PID_1001=An open source display colorimeter | ||
|
||
[FuUsbDevice:icon] | ||
USB\VID_273F&PID_1001=colorimeter-colorhug | ||
|
||
[FuUsbDevice:guid] | ||
USB\VID_273F&PID_1000=40338ceb-b966-4eae-adae-9c32edfcc484 | ||
USB\VID_273F&PID_1001=40338ceb-b966-4eae-adae-9c32edfcc484 | ||
|
||
### ColorHug2 ################################################################## | ||
[FuColorhugDevice] | ||
USB\VID_273F&PID_1004=none | ||
USB\VID_273F&PID_1005=bootloader | ||
|
||
[FuUsbDevice:summary] | ||
USB\VID_273F&PID_1004=An open source display colorimeter | ||
|
||
[FuUsbDevice:icon] | ||
USB\VID_273F&PID_1004=colorimeter-colorhug | ||
|
||
[FuUsbDevice:guid] | ||
USB\VID_273F&PID_1004=2082b5e0-7a64-478a-b1b2-e3404fab6dad | ||
USB\VID_273F&PID_1005=2082b5e0-7a64-478a-b1b2-e3404fab6dad | ||
|
||
### ColorHugALS ################################################################ | ||
[FuColorhugDevice] | ||
USB\VID_273F&PID_1006=halfsize,bootloader | ||
USB\VID_273F&PID_1007=halfsize,none | ||
|
||
[FuUsbDevice:summary] | ||
USB\VID_273F&PID_1007=An open source ambient light sensor | ||
|
||
[FuUsbDevice:guid] | ||
USB\VID_273F&PID_1006=84f40464-9272-4ef7-9399-cd95f12da696 | ||
USB\VID_273F&PID_1007=84f40464-9272-4ef7-9399-cd95f12da696 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- | ||
* | ||
* Copyright (C) 2016-2018 Richard Hughes <richard@hughsie.com> | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1+ | ||
*/ | ||
|
||
#include "fu-colorhug-common.h" | ||
|
||
const gchar * | ||
ch_strerror (ChError error_enum) | ||
{ | ||
if (error_enum == CH_ERROR_NONE) | ||
return "Success"; | ||
if (error_enum == CH_ERROR_UNKNOWN_CMD) | ||
return "Unknown command"; | ||
if (error_enum == CH_ERROR_WRONG_UNLOCK_CODE) | ||
return "Wrong unlock code"; | ||
if (error_enum == CH_ERROR_NOT_IMPLEMENTED) | ||
return "Not implemented"; | ||
if (error_enum == CH_ERROR_UNDERFLOW_SENSOR) | ||
return "Underflow of sensor"; | ||
if (error_enum == CH_ERROR_NO_SERIAL) | ||
return "No serial"; | ||
if (error_enum == CH_ERROR_WATCHDOG) | ||
return "Watchdog"; | ||
if (error_enum == CH_ERROR_INVALID_ADDRESS) | ||
return "Invalid address"; | ||
if (error_enum == CH_ERROR_INVALID_LENGTH) | ||
return "Invalid length"; | ||
if (error_enum == CH_ERROR_INVALID_CHECKSUM) | ||
return "Invalid checksum"; | ||
if (error_enum == CH_ERROR_INVALID_VALUE) | ||
return "Invalid value"; | ||
if (error_enum == CH_ERROR_UNKNOWN_CMD_FOR_BOOTLOADER) | ||
return "Unknown command for bootloader"; | ||
if (error_enum == CH_ERROR_OVERFLOW_MULTIPLY) | ||
return "Overflow of multiply"; | ||
if (error_enum == CH_ERROR_OVERFLOW_ADDITION) | ||
return "Overflow of addition"; | ||
if (error_enum == CH_ERROR_OVERFLOW_SENSOR) | ||
return "Overflow of sensor"; | ||
if (error_enum == CH_ERROR_OVERFLOW_STACK) | ||
return "Overflow of stack"; | ||
if (error_enum == CH_ERROR_NO_CALIBRATION) | ||
return "No calibration"; | ||
if (error_enum == CH_ERROR_DEVICE_DEACTIVATED) | ||
return "Device deactivated"; | ||
if (error_enum == CH_ERROR_INCOMPLETE_REQUEST) | ||
return "Incomplete previous request"; | ||
if (error_enum == CH_ERROR_SELF_TEST_SENSOR) | ||
return "Self test failed: Sensor"; | ||
if (error_enum == CH_ERROR_SELF_TEST_RED) | ||
return "Self test failed: Red"; | ||
if (error_enum == CH_ERROR_SELF_TEST_GREEN) | ||
return "Self test failed: Green"; | ||
if (error_enum == CH_ERROR_SELF_TEST_BLUE) | ||
return "Self test failed: Blue"; | ||
if (error_enum == CH_ERROR_SELF_TEST_MULTIPLIER) | ||
return "Self test failed: Multiplier"; | ||
if (error_enum == CH_ERROR_SELF_TEST_COLOR_SELECT) | ||
return "Self test failed: Color Select"; | ||
if (error_enum == CH_ERROR_SELF_TEST_TEMPERATURE) | ||
return "Self test failed: Temperature"; | ||
if (error_enum == CH_ERROR_INVALID_CALIBRATION) | ||
return "Invalid calibration"; | ||
if (error_enum == CH_ERROR_SRAM_FAILED) | ||
return "SRAM failed"; | ||
if (error_enum == CH_ERROR_OUT_OF_MEMORY) | ||
return "Out of memory"; | ||
if (error_enum == CH_ERROR_SELF_TEST_I2C) | ||
return "Self test failed: I2C"; | ||
if (error_enum == CH_ERROR_SELF_TEST_ADC_VDD) | ||
return "Self test failed: ADC Vdd"; | ||
if (error_enum == CH_ERROR_SELF_TEST_ADC_VSS) | ||
return "Self test failed: ADC Vss"; | ||
if (error_enum == CH_ERROR_SELF_TEST_ADC_VREF) | ||
return "Self test failed: ADC Vref"; | ||
if (error_enum == CH_ERROR_I2C_SLAVE_ADDRESS) | ||
return "I2C set slave address failed"; | ||
if (error_enum == CH_ERROR_I2C_SLAVE_CONFIG) | ||
return "I2C set slave config failed"; | ||
if (error_enum == CH_ERROR_SELF_TEST_EEPROM) | ||
return "Self test failed: EEPROM"; | ||
return NULL; | ||
} | ||
|
||
void | ||
ch_buffer_dump (const gchar *title, const guint8 *buf, gsize sz) | ||
{ | ||
if (g_getenv ("FWUPD_COLORHUG_VERBOSE") == NULL) | ||
return; | ||
g_print ("%s (%" G_GSIZE_FORMAT "):\n", title, sz); | ||
for (gsize i = 0; i < sz; i++) { | ||
g_print ("%02x ", buf[i]); | ||
if (i > 0 && (i + 1) % 256 == 0) | ||
g_print ("\n"); | ||
} | ||
g_print ("\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- | ||
* | ||
* Copyright (C) 2016-2018 Richard Hughes <richard@hughsie.com> | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1+ | ||
*/ | ||
|
||
#ifndef __FU_COLORHUG_COMMON_H | ||
#define __FU_COLORHUG_COMMON_H | ||
|
||
#include <glib-object.h> | ||
#include <gusb.h> | ||
|
||
G_BEGIN_DECLS | ||
|
||
typedef enum { | ||
CH_ERROR_NONE, | ||
CH_ERROR_UNKNOWN_CMD, | ||
CH_ERROR_WRONG_UNLOCK_CODE, | ||
CH_ERROR_NOT_IMPLEMENTED, | ||
CH_ERROR_UNDERFLOW_SENSOR, | ||
CH_ERROR_NO_SERIAL, | ||
CH_ERROR_WATCHDOG, | ||
CH_ERROR_INVALID_ADDRESS, | ||
CH_ERROR_INVALID_LENGTH, | ||
CH_ERROR_INVALID_CHECKSUM, | ||
CH_ERROR_INVALID_VALUE, | ||
CH_ERROR_UNKNOWN_CMD_FOR_BOOTLOADER, | ||
CH_ERROR_NO_CALIBRATION, | ||
CH_ERROR_OVERFLOW_MULTIPLY, | ||
CH_ERROR_OVERFLOW_ADDITION, | ||
CH_ERROR_OVERFLOW_SENSOR, | ||
CH_ERROR_OVERFLOW_STACK, | ||
CH_ERROR_DEVICE_DEACTIVATED, | ||
CH_ERROR_INCOMPLETE_REQUEST, | ||
CH_ERROR_SELF_TEST_SENSOR, | ||
CH_ERROR_SELF_TEST_RED, | ||
CH_ERROR_SELF_TEST_GREEN, | ||
CH_ERROR_SELF_TEST_BLUE, | ||
CH_ERROR_SELF_TEST_COLOR_SELECT, | ||
CH_ERROR_SELF_TEST_MULTIPLIER, | ||
CH_ERROR_INVALID_CALIBRATION, | ||
CH_ERROR_SRAM_FAILED, | ||
CH_ERROR_OUT_OF_MEMORY, | ||
CH_ERROR_SELF_TEST_TEMPERATURE, | ||
CH_ERROR_SELF_TEST_I2C, | ||
CH_ERROR_SELF_TEST_ADC_VDD, | ||
CH_ERROR_SELF_TEST_ADC_VSS, | ||
CH_ERROR_SELF_TEST_ADC_VREF, | ||
CH_ERROR_I2C_SLAVE_ADDRESS, | ||
CH_ERROR_I2C_SLAVE_CONFIG, | ||
CH_ERROR_SELF_TEST_EEPROM, | ||
CH_ERROR_LAST | ||
} ChError; | ||
|
||
const gchar *ch_strerror (ChError error_enum); | ||
void ch_buffer_dump (const gchar *title, | ||
const guint8 *buf, | ||
gsize sz); | ||
|
||
G_END_DECLS | ||
|
||
#endif /* __FU_COLORHUG_COMMON_H */ |
Oops, something went wrong.