Skip to content

Commit

Permalink
colorhug: Do not require libcolorhug to build
Browse files Browse the repository at this point in the history
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
hughsie committed Jun 2, 2018
1 parent 5171a64 commit 0b522ae
Show file tree
Hide file tree
Showing 19 changed files with 508 additions and 297 deletions.
2 changes: 1 addition & 1 deletion contrib/PKGBUILD
Expand Up @@ -8,7 +8,7 @@ pkgdesc='A simple daemon to allow session software to update firmware'
arch=('i686' 'x86_64')
url='https://github.com/hughsie/fwupd'
license=('GPL2')
depends=('appstream-glib' 'fwupdate' 'colord')
depends=('appstream-glib' 'fwupdate')
makedepends=('meson' 'valgrind' 'gobject-introspection' 'gtk-doc' 'python-pillow' 'git'
'python-cairo' 'ttf-dejavu' 'adobe-source-han-sans-cn-fonts' 'python-gobject' 'vala')

Expand Down
2 changes: 1 addition & 1 deletion contrib/ci/README.md
Expand Up @@ -68,7 +68,7 @@ Arch Linux (x86_64)

Flatpak
----------
* A flatpak bundle with all but colorhug plugins enabled
* A flatpak bundle with all plugins enabled
* Compiled under gcc with the org.gnome.Sdk/x86_64/3.28 runtime
* Builds without the daemon, so only fwupdtool is available
* No GPG, PKCS-7, GObjectIntrospection, systemd or ConsoleKit support
Expand Down
37 changes: 0 additions & 37 deletions contrib/ci/dependencies.xml
Expand Up @@ -119,31 +119,6 @@
<package variant="x86_64" />
</distro>
</dependency>
<dependency type="build" id="libcolord-dev">
<distro id="arch">
<package>colord</package>
</distro>
<distro id="centos">
<package>colord-devel</package>
</distro>
<distro id="fedora">
<package>colord-devel</package>
</distro>
<distro id="debian">
<control>
<version>(>= 1.0.0)</version>
</control>
<package variant="x86_64" />
<package variant="s390x">libcolord-dev:s390x</package>
<package variant="i386" />
</distro>
<distro id="ubuntu">
<control>
<version>(>= 1.0.0)</version>
</control>
<package variant="x86_64" />
</distro>
</dependency>
<dependency type="build" id="fonts-dejavu">
<distro id="arch">
<package>ttf-dejavu</package>
Expand Down Expand Up @@ -591,18 +566,6 @@
<package variant="x86_64" />
</distro>
</dependency>
<dependency type="build" id="libcolorhug-dev">
<distro id="debian">
<control />
<package variant="x86_64" />
<package variant="s390x">libcolorhug-dev:s390x</package>
<package variant="i386" />
</distro>
<distro id="ubuntu">
<control />
<package variant="x86_64" />
</distro>
</dependency>
<dependency type="build" id="libefivar-dev">
<distro id="debian">
<control>
Expand Down
3 changes: 1 addition & 2 deletions contrib/ci/fedora.sh
Expand Up @@ -14,8 +14,7 @@ meson .. \
-Dplugin_thunderbolt=true \
-Dplugin_uefi=true \
-Dplugin_dell=true \
-Dplugin_synaptics=true \
-Dplugin_colorhug=true $@
-Dplugin_synaptics=true $@
ninja-build dist
popd
VERSION=`meson introspect build --projectinfo | jq -r .version`
Expand Down
5 changes: 1 addition & 4 deletions contrib/fwupd.spec.in
Expand Up @@ -2,7 +2,6 @@
%global libappstream_version 0.7.4
%global libgusb_version 0.2.11
%global libsoup_version 2.51.92
%global colord_version 1.2.12
%global systemd_version 231
%global json_glib_version 1.1.1

Expand Down Expand Up @@ -36,7 +35,6 @@ BuildRequires: libappstream-glib-devel >= %{libappstream_version}
BuildRequires: libgudev1-devel
BuildRequires: libgusb-devel >= %{libgusb_version}
BuildRequires: libsoup-devel >= %{libsoup_version}
BuildRequires: colord-devel >= %{colord_version}
BuildRequires: polkit-devel >= 0.103
BuildRequires: sqlite-devel
BuildRequires: gpgme-devel
Expand Down Expand Up @@ -130,7 +128,6 @@ Data files for installed tests.
--werror \
%endif
-Dgtkdoc=true \
-Dman=true \
%if 0%{?enable_tests}
-Dtests=true \
%else
Expand All @@ -156,7 +153,7 @@ Data files for installed tests.
-Dplugin_dell=false \
-Dplugin_synaptics=false \
%endif
-Dplugin_colorhug=true
-Dman=true

%meson_build

Expand Down
1 change: 0 additions & 1 deletion contrib/org.freedesktop.fwupd.json
Expand Up @@ -153,7 +153,6 @@
"-Dintrospection=false",
"-Dman=false",
"-Dpkcs7=false",
"-Dplugin_colorhug=false",
"-Dplugin_uefi_labels=false",
"-Dsystemd=false",
"-Dtests=false",
Expand Down
1 change: 0 additions & 1 deletion contrib/snap/snapcraft.yaml
Expand Up @@ -167,7 +167,6 @@ parts:
-Dtests=false,
-Ddaemon=false,
-Dgtkdoc=false,
-Dplugin_colorhug=false,
-Dplugin_uefi_labels=false,
-Dintrospection=false,
-Dsystemd=false,
Expand Down
6 changes: 0 additions & 6 deletions data/installed-tests/hardware.py
Expand Up @@ -116,12 +116,6 @@ def add_file(self, fn, ver):
test.add_file('0a29848de74d26348bc5a6e24fc9f03778eddf0e-hughski-colorhug2-2.0.7.cab', '2.0.7')
tests.append(test)

# Hughski ColorHugALS using 'colorhug'
test = Test('ColorHugALS', '84f40464-9272-4ef7-9399-cd95f12da696')
test.add_file('73ac1aa98130e532c727308cc6560783b10ca3a9-hughski-colorhug-als-4.0.2.cab', '4.0.2')
test.add_file('8dbdd54c712b33f72d866ce3b23b3ceed3ad494d-hughski-colorhug-als-4.0.3.cab', '4.0.3')
tests.append(test)

# Logitech Unifying Receiver (RQR12) using 'unifying'
test = Test('UnifyingRQR12', '9d131a0c-a606-580f-8eda-80587250b8d6')
test.add_file('6e5ab5961ec4c577bff198ebb465106e979cf686-Logitech-Unifying-RQR12.05_B0028.cab', 'RQR12.05_B0028')
Expand Down
5 changes: 0 additions & 5 deletions meson.build
Expand Up @@ -190,11 +190,6 @@ if valgrind.found()
conf.set('HAVE_VALGRIND', '1')
endif

if get_option('plugin_colorhug')
colorhug = dependency('colorhug', version : '>= 1.2.12')
conf.set('HAVE_COLORHUG', '1')
endif

if get_option('plugin_altos')
libelf = dependency('libelf')
endif
Expand Down
1 change: 0 additions & 1 deletion meson_options.txt
Expand Up @@ -9,7 +9,6 @@ option('man', type : 'boolean', value : true, description : 'enable man pages')
option('pkcs7', type : 'boolean', value : true, description : 'enable the PKCS7 verification support')
option('plugin_altos', type : 'boolean', value : true, description : 'enable altos support')
option('plugin_amt', type : 'boolean', value : true, description : 'enable Intel AMT support')
option('plugin_colorhug', type : 'boolean', value : true, description : 'enable ColorHug support')
option('plugin_dell', type : 'boolean', value : true, description : 'enable Dell-specific support')
option('plugin_dummy', type : 'boolean', value : false, description : 'enable the dummy device')
option('plugin_synaptics', type: 'boolean', value: true, description : 'enable Synaptics MST hub support')
Expand Down
12 changes: 0 additions & 12 deletions plugins/colorhug/README.md
Expand Up @@ -10,15 +10,3 @@ accurate color matching.

ColorHug versions 1 and 2 support a custom HID-based flashing protocol, but
version 3 (ColorHug+) has now switched to DFU.

Build Requirements
------------------

For colorhug support you need to install colord 1.2.12 or later.
* source: https://github.com/hughsie/colord
* rpms: http://people.freedesktop.org/~hughsient/fedora/
* debs (Debian): https://tracker.debian.org/pkg/fwupd
* debs (Ubuntu): https://launchpad.net/ubuntu/+source/fwupd

If you don't want or need this functionality you can use the
`--disable-colorhug` option.
41 changes: 41 additions & 0 deletions plugins/colorhug/colorhug.quirk
@@ -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
100 changes: 100 additions & 0 deletions plugins/colorhug/fu-colorhug-common.c
@@ -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");
}
63 changes: 63 additions & 0 deletions plugins/colorhug/fu-colorhug-common.h
@@ -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 */

0 comments on commit 0b522ae

Please sign in to comment.