diff -Nru fwupd-1.0.6/.circleci/config.yml fwupd-1.2.10/.circleci/config.yml
--- fwupd-1.0.6/.circleci/config.yml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/.circleci/config.yml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,84 @@
+version: 2
+jobs:
+ build-s390x:
+ machine:
+ image: circleci/classic:latest
+ steps:
+ - checkout
+ - run:
+ name: "Build container"
+ command: OS=debian-s390x ./contrib/ci/generate_docker.py
+ - run:
+ name: "Run build script"
+ command: docker run --privileged -e CI=true -t -v `pwd`/dist:/build/dist fwupd-debian-s390x
+
+ build-snap:
+ docker:
+ - image: superm1/snapcraft-edge:latest
+ steps:
+ - checkout
+ - run:
+ name: "Update apt"
+ command: apt update
+ - run:
+ name: "Build Snap"
+ command: snapcraft
+ - persist_to_workspace:
+ root: .
+ paths:
+ - "*.snap"
+
+ publish-edge:
+ docker:
+ - image: cibuilds/snapcraft:stable
+ steps:
+ - attach_workspace:
+ at: .
+ - run:
+ name: "Publish to Store"
+ command: |
+ mkdir .snapcraft
+ echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
+ snapcraft push *.snap --release edge
+
+ publish-stable:
+ docker:
+ - image: cibuilds/snapcraft:stable
+ steps:
+ - attach_workspace:
+ at: .
+ - run:
+ name: "Publish to Store"
+ command: |
+ mkdir .snapcraft
+ echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
+ snapcraft push *.snap --release stable
+
+workflows:
+ version: 2
+ main:
+ jobs:
+ - build-s390x
+ - build-snap
+ - publish-edge:
+ requires:
+ - build-snap
+ filters:
+ branches:
+ only: master
+ deploy:
+ jobs:
+ - build-snap:
+ filters:
+ branches:
+ ignore: /.*/
+ tags:
+ only: /^\d+\.\d+\.\d+$/
+ - publish-stable:
+ requires:
+ - build-snap
+ filters:
+ branches:
+ ignore: /.*/
+ tags:
+ only: /^\d+\.\d+\.\d+$/
diff -Nru fwupd-1.0.6/COMMITMENT fwupd-1.2.10/COMMITMENT
--- fwupd-1.0.6/COMMITMENT 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/COMMITMENT 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,45 @@
+Common Cure Rights Commitment, version 1.0
+
+Before filing or continuing to prosecute any legal proceeding or claim
+(other than a Defensive Action) arising from termination of a Covered
+License, we commit to extend to the person or entity ('you') accused
+of violating the Covered License the following provisions regarding
+cure and reinstatement, taken from GPL version 3. As used here, the
+term 'this License' refers to the specific Covered License being
+enforced.
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly
+ and finally terminates your license, and (b) permanently, if the
+ copyright holder fails to notify you of the violation by some
+ reasonable means prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you
+ have received notice of violation of this License (for any work)
+ from that copyright holder, and you cure the violation prior to 30
+ days after your receipt of the notice.
+
+We intend this Commitment to be irrevocable, and binding and
+enforceable against us and assignees of or successors to our
+copyrights.
+
+Definitions
+
+'Covered License' means the GNU General Public License, version 2
+(GPLv2), the GNU Lesser General Public License, version 2.1
+(LGPLv2.1), or the GNU Library General Public License, version 2
+(LGPLv2), all as published by the Free Software Foundation.
+
+'Defensive Action' means a legal proceeding or claim that We bring
+against you in response to a prior proceeding or claim initiated by
+you or your affiliate.
+
+'We' means each contributor to this repository as of the date of
+inclusion of this file, including subsidiaries of a corporate
+contributor.
+
+This work is available under a Creative Commons Attribution-ShareAlike
+4.0 International license.
diff -Nru fwupd-1.0.6/contrib/add-capsule-header.py fwupd-1.2.10/contrib/add-capsule-header.py
--- fwupd-1.0.6/contrib/add-capsule-header.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/add-capsule-header.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,71 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2019 Richard Hughes
+#
+# SPDX-License-Identifier: LGPL-2.1+
+
+import sys
+import uuid
+import argparse
+import struct
+
+CAPSULE_FLAGS_PERSIST_ACROSS_RESET = 0x00010000
+CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE = 0x00020000
+CAPSULE_FLAGS_INITIATE_RESET = 0x00040000
+
+def main(args):
+
+ # parse GUID from command line
+ try:
+ guid = uuid.UUID(args.guid)
+ except ValueError as e:
+ print(e)
+ return 1
+ try:
+ with open(args.bin, 'rb') as f:
+ bin_data = f.read()
+ except FileNotFoundError as e:
+ print(e)
+ return 1
+
+ # check if already has header
+ hdrsz = struct.calcsize('<16sIII')
+ if len(bin_data) >= hdrsz:
+ hdr = struct.unpack('<16sIII', bin_data[:hdrsz])
+ imgsz = hdr[3]
+ if imgsz == len(bin_data):
+ print('Replacing existing CAPSULE_HEADER of:')
+ guid_mixed = uuid.UUID(bytes_le=hdr[0])
+ hdrsz_old = hdr[1]
+ flags = hdr[2]
+ print('GUID: %s' % guid_mixed)
+ print('HdrSz: 0x%04x' % hdrsz_old)
+ print('Flags: 0x%04x' % flags)
+ print('PayloadSz: 0x%04x' % imgsz)
+ bin_data = bin_data[hdrsz_old:]
+
+ # set header flags
+ flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET
+ if args.flags:
+ flags = int(args.flags, 16)
+
+ # build update capsule header
+ imgsz = hdrsz + len(bin_data)
+ hdr = struct.pack('<16sIII', guid.bytes_le, hdrsz, flags, imgsz)
+ with open(args.cap, 'wb') as f:
+ f.write(hdr + bin_data)
+ print('Wrote capsule %s' % args.cap)
+ print('GUID: %s' % guid)
+ print('HdrSz: 0x%04x' % hdrsz)
+ print('Flags: 0x%04x' % flags)
+ print('PayloadSz: 0x%04x' % imgsz)
+ return 0
+
+parser = argparse.ArgumentParser(description='Add capsule header on firmware')
+parser.add_argument('--guid', help='GUID of the device', required=True)
+parser.add_argument('--bin', help='Path to the .bin file', required=True)
+parser.add_argument('--cap', help='Output capsule file path', required=True)
+parser.add_argument('--flags', help='Flags, e.g. 0x40000', default=None)
+args = parser.parse_args()
+
+sys.exit(main(args))
diff -Nru fwupd-1.0.6/contrib/ci/arch.sh fwupd-1.2.10/contrib/ci/arch.sh
--- fwupd-1.0.6/contrib/ci/arch.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/arch.sh 2019-07-15 18:25:54.000000000 +0000
@@ -1,6 +1,7 @@
#!/bin/bash
set -e
set -x
+shopt -s extglob
VERSION=`git describe | sed 's/-/.r/;s/-/./'`
[ -z $VERSION ] && VERSION=`head meson.build | grep ' version :' | cut -d \' -f2`
@@ -11,7 +12,7 @@
cp ../contrib/PKGBUILD .
sed -i "s,#VERSION#,$VERSION," PKGBUILD
mkdir -p src/fwupd && pushd src/fwupd
-ln -s ../../../* .
+cp -R ../../../!(build|dist) .
popd
chown nobody . -R
diff -Nru fwupd-1.0.6/contrib/ci/centos.sh fwupd-1.2.10/contrib/ci/centos.sh
--- fwupd-1.0.6/contrib/ci/centos.sh 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/centos.sh 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+set -x
+
+rm -rf build
+mkdir -p build
+cd build
+meson .. \
+ --werror \
+ -Dplugin_uefi=false \
+ -Dplugin_dell=false \
+ -Dplugin_modem_manager=false \
+ -Dplugin_synaptics=true \
+ -Dplugin_flashrom=true \
+ -Dintrospection=true \
+ -Dgtkdoc=true \
+ -Dpkcs7=false \
+ -Dman=true
+ninja-build -v
+ninja-build test -v
+cd ..
diff -Nru fwupd-1.0.6/contrib/ci/check_missing_translations.sh fwupd-1.2.10/contrib/ci/check_missing_translations.sh
--- fwupd-1.0.6/contrib/ci/check_missing_translations.sh 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/check_missing_translations.sh 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+cd po
+intltool-update -m
+if [ -f missing ]; then
+ exit 1
+fi
diff -Nru fwupd-1.0.6/contrib/ci/debian_s390x.sh fwupd-1.2.10/contrib/ci/debian_s390x.sh
--- fwupd-1.0.6/contrib/ci/debian_s390x.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/debian_s390x.sh 2019-07-15 18:25:54.000000000 +0000
@@ -3,6 +3,12 @@
set -x
export LC_ALL=C.UTF-8
+
+#evaluate using Debian's build flags
+eval "$(dpkg-buildflags --export=sh)"
+#filter out -Bsymbolic-functions
+export LDFLAGS=$(dpkg-buildflags --get LDFLAGS | sed "s/-Wl,-Bsymbolic-functions\s//")
+
rm -rf build
mkdir -p build
cp contrib/ci/s390x_cross.txt build/
@@ -10,13 +16,20 @@
meson .. \
--cross-file s390x_cross.txt \
--werror \
+ -Dplugin_flashrom=false \
-Dplugin_uefi=false \
- -Dplugin_uefi_labels=false \
-Dplugin_dell=false \
- -Dplugin_synaptics=false \
+ -Dplugin_modem_manager=false \
+ -Dplugin_redfish=false \
-Dintrospection=false \
-Dgtkdoc=false \
+ -Dlibxmlb:introspection=false \
+ -Dlibxmlb:gtkdoc=false \
-Dman=false
ninja -v
ninja test -v
cd ..
+
+
+#test for missing translation files
+./contrib/ci/check_missing_translations.sh
diff -Nru fwupd-1.0.6/contrib/ci/debian.sh fwupd-1.2.10/contrib/ci/debian.sh
--- fwupd-1.0.6/contrib/ci/debian.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/debian.sh 2019-07-15 18:25:54.000000000 +0000
@@ -21,7 +21,12 @@
mv contrib/debian .
sed s/quilt/native/ debian/source/format -i
#generate control file
-./contrib/ci/generate_debian_control.py debian/control.in debian/control
+./contrib/ci/generate_debian.py
+
+#disable unit tests if fwupd is already installed (may cause problems)
+if [ -x /usr/lib/fwupd/fwupd ]; then
+ export DEB_BUILD_OPTIONS=nocheck
+fi
#build the package
EDITOR=/bin/true dch --create --package fwupd -v $VERSION "CI Build"
debuild --no-lintian --preserve-envvar CI --preserve-envvar CC
diff -Nru fwupd-1.0.6/contrib/ci/dependencies.xml fwupd-1.2.10/contrib/ci/dependencies.xml
--- fwupd-1.0.6/contrib/ci/dependencies.xml 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/dependencies.xml 2019-07-15 18:25:54.000000000 +0000
@@ -1,14 +1,47 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -19,6 +52,9 @@
+
+
+
@@ -30,7 +66,12 @@
-
+
+
+
+
+
+
@@ -41,6 +82,9 @@
+
+ cairo-devel
+ cairo-devel
@@ -56,6 +100,9 @@
+
+ cairo-gobject-devel
+ cairo-gobject-devel
@@ -74,6 +121,9 @@
json-glib
+
+ json-glib-devel
+ json-glib-devel
@@ -92,34 +142,51 @@
-
+
- colord
+ libftdi
+
+
+ libftdi-devel
- colord-devel
+ libftdi-devel
+
+
+
+
+
+
+
+
+
+
+
+ pciutils
+
+
+ pciutils-devel
+
+
+ pciutils-devel
-
- (>= 1.0.0)
-
- libcolord-dev:s390x
-
- (>= 1.0.0)
-
-
+
- ttf-dejavu
+ noto-fonts
+
+
+ google-noto-sans-cjk-ttc-fonts
- dejavu-sans-fonts
+ google-noto-sans-cjk-ttc-fonts
@@ -143,19 +210,22 @@
- (>= 10.3)
+ (>= 11)
- (>= 10.3)
+ (>= 11)
+
+
+
@@ -168,6 +238,9 @@
+
+
+
@@ -183,7 +256,15 @@
+
+
+
+
+
+
+ elfutils-libelf-devel
+ elfutils-libelf-devel
@@ -208,6 +289,9 @@
+
+ freetype
+ freetype
@@ -223,6 +307,9 @@
+
+
+
@@ -236,35 +323,10 @@
-
-
- fwupdate
-
-
- fwupdate-devel
-
-
-
- (>= 10-3)
- amd64
- arm64
- armhf
- i386
-
-
-
-
-
-
- amd64
- arm64
- armhf
- i386
-
-
-
-
+
+
+
@@ -280,6 +342,9 @@
+
+
+
@@ -299,23 +364,51 @@
+
+
+
-
+
+
+ gnu-efi-libs
+
+
+
+
+
+
+
-
-
+
+ amd64
+ arm64
+ armhf
+ i386
+
+ gnu-efi
+ gnu-efi
-
+
+ amd64
+ arm64
+ armhf
+ i386
+
+ gnu-efi
+ gnu-efi
+
+
+
@@ -329,6 +422,9 @@
+
+ glib2-devel
+ glib2-devel
@@ -351,6 +447,9 @@
+
+ gobject-introspection-devel
+ gobject-introspection-devel
@@ -365,6 +464,9 @@
+
+ gpgme-devel
+ gpgme-devel
@@ -392,6 +494,9 @@
+
+ gnutls-devel
+ gnutls-devel
@@ -407,6 +512,9 @@
+
+ gnutls-utils
+ gnutls-utils
@@ -425,6 +533,9 @@
gtk-doc
+
+ gtk-doc
+ gtk-doc
@@ -442,6 +553,9 @@
+
+
+
@@ -457,33 +571,46 @@
+
+
+
-
+
- appstream-glib
+ libxmlb
+
+
- libappstream-glib-devel
+ libxmlb-devel
- (>= 0.7.4)
+ (>= 0.1.5)
- libappstream-glib-dev:s390x
+ libxmlb-dev:s390x
+
+
+ libarchive-devel
+ libarchive-devel
@@ -498,25 +625,42 @@
-
+
+
+ efivar
+
+
+ efivar-devel
+
+
+ efivar-devel
+
-
+
+ amd64
+ arm64
+ armhf
+ i386
+
- libcolorhug-dev:s390x
-
+
+ amd64
+ arm64
+ armhf
+ i386
+
-
+ amd64arm64armhf
- armeli386
@@ -527,13 +671,21 @@
amd64arm64armhf
- armeli386
+
+ gcab
+
+
+ libgcab1-devel
+
+
+ libgcab1-devel
+
@@ -558,6 +710,9 @@
+
+ libgudev1-devel
+ libgudev1-devel
@@ -573,6 +728,12 @@
+
+ libgusb
+
+
+ libgusb-devel
+ libgusb-devel
@@ -604,6 +765,12 @@
+
+ libsmbios
+
+
+ libsmbios-devel
+ libsmbios-devel
@@ -616,11 +783,20 @@
-
+
+ i386
+ amd64
+
+
+ libsoup
+
+
+ libsoup-devel
+ libsoup-devel
@@ -646,6 +822,11 @@
+
+
+
+
+
@@ -685,6 +866,9 @@
+
+
+
@@ -700,6 +884,9 @@
+
+ pango-devel
+ pango-devel
@@ -725,6 +912,12 @@
+
+ polkit
+
+
+ polkit
+ polkit
@@ -743,7 +936,52 @@
+
+
+ ModemManager-glib-devel
+
+
+ ModemManager-glib-devel
+
+
+ modemmanager
+
+
+
+
+ libmm-glib-dev:s390x
+
+
+
+
+
+
+
+
+
+ libqmi-devel
+
+
+ libqmi-devel
+
+
+ libqmi
+
+
+
+
+ libqmi-glib-dev:s390x
+
+
+
+
+
+
+
+
+ polkit-devel
+ polkit-devel
@@ -758,7 +996,15 @@
+
+
+
+
+
+
+ python34-devel
+
@@ -827,16 +1073,25 @@
+
+
+
+
+
+
+
+ sqlite-devel
+ sqlite-devel
@@ -852,6 +1107,9 @@
+
+
+
@@ -870,6 +1128,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -895,6 +1174,9 @@
+
+ umockdev-devel
+ umockdev-devel
@@ -912,6 +1194,9 @@
vala
+
+ vala
+ vala
@@ -930,11 +1215,17 @@
+
+ valgrind-devel
+ valgrind-devel
+ ia64
+ riscv64
+ x32mipssparc64sh4
@@ -953,6 +1244,9 @@
+ ia64
+ riscv64
+ x32mipssparc64sh4
@@ -969,9 +1263,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-centos.in fwupd-1.2.10/contrib/ci/Dockerfile-centos.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-centos.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-centos.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,16 @@
+FROM centos:7
+%%%OS%%%
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+RUN echo fubar > /etc/machine-id
+RUN yum install epel-release -y
+RUN echo fubar > /etc/machine-id
+%%%INSTALL_DEPENDENCIES_COMMAND%%%
+RUN pip3 install pillow pygobject
+RUN wget https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo
+RUN yum --enablerepo=epel-testing -y update
+RUN mkdir /build
+WORKDIR /build
+COPY . .
+CMD ["./contrib/ci/centos.sh"]
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-debian.in fwupd-1.2.10/contrib/ci/Dockerfile-debian.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-debian.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-debian.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,5 +1,19 @@
FROM %%%ARCH_PREFIX%%%debian:testing
%%%OS%%%
+RUN echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
+RUN echo 'Package: *\n\
+Pin: release a=testing\n\
+Pin-Priority: 900\n\
+\n\
+Package: *\n\
+Pin: release a=unstable\n\
+Pin-Priority: 800\n\
+\n\
+Package: libxmlb-dev\n\
+Pin: release a=unstable\n\
+Pin-Priority: 901\n'\
+ > /etc/apt/preferences
+RUN cat /etc/apt/preferences
RUN echo fubar > /etc/machine-id
%%%ARCH_SPECIFIC_COMMAND%%%
%%%INSTALL_DEPENDENCIES_COMMAND%%%
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-fedora.in fwupd-1.2.10/contrib/ci/Dockerfile-fedora.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-fedora.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-fedora.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,10 +1,10 @@
-FROM fedora:26
+FROM fedora:29
%%%OS%%%
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN echo fubar > /etc/machine-id
-RUN dnf --enablerepo=updates-testing -y update
+RUN dnf -y update
RUN echo fubar > /etc/machine-id
%%%INSTALL_DEPENDENCIES_COMMAND%%%
RUN mkdir /build
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-flatpak.in fwupd-1.2.10/contrib/ci/Dockerfile-flatpak.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-flatpak.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-flatpak.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,12 @@
+FROM fedora:29
+%%%OS%%%
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+RUN echo fubar > /etc/machine-id
+%%%INSTALL_DEPENDENCIES_COMMAND%%%
+RUN dnf --enablerepo=updates-testing -y update
+RUN mkdir /build
+WORKDIR /build
+COPY . .
+CMD ["./contrib/ci/flatpak.py"]
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-snap.in fwupd-1.2.10/contrib/ci/Dockerfile-snap.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-snap.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-snap.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,25 @@
+FROM ubuntu:xenial
+
+RUN apt-get update && \
+ apt-get dist-upgrade --yes && \
+ apt-get install --yes \
+ curl sudo jq squashfs-tools && \
+ curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core' | jq '.download_url' -r) --output core.snap && \
+ mkdir -p /snap/core && unsquashfs -d /snap/core/current core.snap && rm core.snap && \
+ curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/snapcraft?channel=edge' | jq '.download_url' -r) --output snapcraft.snap && \
+ mkdir -p /snap/snapcraft && unsquashfs -d /snap/snapcraft/current snapcraft.snap && rm snapcraft.snap && \
+ apt remove --yes --purge curl jq squashfs-tools && \
+ apt-get autoclean --yes && \
+ apt-get clean --yes
+
+COPY contrib/ci/snapcraft-wrapper /snap/bin/snapcraft
+ENV PATH=/snap/bin:$PATH
+
+LABEL maintainer="Mario Limonciello "
+RUN apt-get update && apt-get install -y \
+ curl \
+ git \
+ jq \
+ openssh-client \
+ wget
+WORKDIR /root/project
diff -Nru fwupd-1.0.6/contrib/ci/Dockerfile-ubuntu.in fwupd-1.2.10/contrib/ci/Dockerfile-ubuntu.in
--- fwupd-1.0.6/contrib/ci/Dockerfile-ubuntu.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/Dockerfile-ubuntu.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,5 +1,6 @@
FROM ubuntu:devel
%%%OS%%%
+ENV CC clang-6.0
RUN echo fubar > /etc/machine-id
%%%ARCH_SPECIFIC_COMMAND%%%
%%%INSTALL_DEPENDENCIES_COMMAND%%%
diff -Nru fwupd-1.0.6/contrib/ci/fedora.sh fwupd-1.2.10/contrib/ci/fedora.sh
--- fwupd-1.0.6/contrib/ci/fedora.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/fedora.sh 2019-07-15 18:25:54.000000000 +0000
@@ -7,15 +7,17 @@
mkdir -p build && pushd build
rm -rf *
meson .. \
+ -Db_sanitize=address \
-Dgtkdoc=true \
-Dman=true \
-Dtests=true \
-Dplugin_dummy=true \
+ -Dplugin_flashrom=true \
+ -Dplugin_modem_manager=false \
-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`
@@ -47,14 +49,25 @@
#install RPM packages
dnf install -y $HOME/rpmbuild/RPMS/*/*.rpm
+mkdir -p dist
cp $HOME/rpmbuild/RPMS/*/*.rpm dist
-# run the installed tests
if [ "$CI" = "true" ]; then
sed "s,^BlacklistPlugins=test,BlacklistPlugins=," -i /etc/fwupd/daemon.conf
+
+ # set up enough PolicyKit and D-Bus to run the daemon
mkdir -p /run/dbus
mkdir -p /var
ln -s /var/run /run
dbus-daemon --system --fork
+ /usr/lib/polkit-1/polkitd &
+ sleep 5
+
+ # run the daemon startup to check it can start
+ /usr/libexec/fwupd/fwupd --immediate-exit --verbose
+
+ # run the installed tests whilst the daemon debugging
+ /usr/libexec/fwupd/fwupd --verbose &
+ sleep 10
gnome-desktop-testing-runner fwupd
fi
diff -Nru fwupd-1.0.6/contrib/ci/flatpak.py fwupd-1.2.10/contrib/ci/flatpak.py
--- fwupd-1.0.6/contrib/ci/flatpak.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/flatpak.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,81 @@
+#!/usr/bin/python3
+import subprocess
+import os
+import json
+import shutil
+
+def prepare (target):
+ #clone the flatpak json
+ cmd = ['git', 'submodule', 'update', '--remote', 'contrib/flatpak']
+ subprocess.run (cmd, check=True)
+
+ #clone the submodules for that
+ cmd = ['git', 'submodule', 'update', '--init', '--remote', 'shared-modules/']
+ subprocess.run (cmd, cwd='contrib/flatpak', check=True)
+
+ #parse json
+ if os.path.isdir ('build'):
+ shutil.rmtree ('build')
+ data = {}
+ with open ('contrib/flatpak/org.freedesktop.fwupd.json', 'r') as rfd:
+ data = json.load (rfd, strict=False)
+ platform = 'runtime/%s/x86_64/%s' % (data['runtime'], data['runtime-version'])
+ sdk = 'runtime/%s/x86_64/%s' % (data['sdk'], data['runtime-version'])
+ num_modules = len (data['modules'])
+
+ #update to build from master
+ data["branch"] = "master"
+ for index in range(0, num_modules):
+ module = data['modules'][index]
+ if type (module) != dict or not 'name' in module:
+ continue
+ name = module['name']
+ if not 'fwupd' in name:
+ continue
+ data['modules'][index]['sources'][0].pop ('url')
+ data['modules'][index]['sources'][0].pop ('sha256')
+ data['modules'][index]['sources'][0]['type'] = 'dir'
+ data['modules'][index]['sources'][0]['skip'] = [".git"]
+ data['modules'][index]['sources'][0]['path'] = ".."
+
+ #write json
+ os.mkdir('build')
+ with open (target, 'w') as wfd:
+ json.dump(data, wfd, indent=4)
+ os.symlink ('../contrib/flatpak/shared-modules','build/shared-modules')
+
+ # install the runtimes (parsed from json!)
+ repo = 'flathub'
+ repo_url = 'https://dl.flathub.org/repo/flathub.flatpakrepo'
+ print ("Installing dependencies")
+ cmd = ['flatpak', 'remote-add', '--if-not-exists', repo, repo_url]
+ subprocess.run (cmd, check=True)
+ cmd = ['flatpak', 'install', '--assumeyes', repo, sdk]
+ subprocess.run (cmd, check=True)
+ cmd = ['flatpak', 'install', '--assumeyes', repo, platform]
+ subprocess.run (cmd, check=True)
+
+
+def build (target):
+ cmd = ['flatpak-builder', '--repo=repo', '--force-clean', '--disable-rofiles-fuse', 'build-dir', target]
+ subprocess.run (cmd, check=True)
+ cmd = ['flatpak', 'build-bundle', 'repo', 'fwupd.flatpak', 'org.freedesktop.fwupd']
+ subprocess.run (cmd, check=True)
+
+if __name__ == '__main__':
+ t = os.path.join ('build', 'org.freedesktop.fwupd.json')
+ prepare (t)
+ build (t)
+
+# to run from the builddir:
+# sudo flatpak-builder --run build-dir org.freedesktop.fwupd.json /app/libexec/fwupd/fwupdtool get-devices
+
+# install the single file bundle
+# flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+# flatpak install fwupd.flatpak
+
+# to run a shell in the same environment that flatpak sees:
+# flatpak run --command=sh --devel org.freedesktop.fwupd
+
+# to run fwupdtool as root:
+# sudo flatpak run org.freedesktop.fwupd --verbose get-devices
diff -Nru fwupd-1.0.6/contrib/ci/generate_debian_control.py fwupd-1.2.10/contrib/ci/generate_debian_control.py
--- fwupd-1.0.6/contrib/ci/generate_debian_control.py 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/generate_debian_control.py 1970-01-01 00:00:00.000000000 +0000
@@ -1,121 +0,0 @@
-#!/usr/bin/python3
-#
-# Copyright (C) 2017 Dell Inc.
-#
-# Licensed under the GNU General Public License Version 2
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-import os
-import sys
-import xml.etree.ElementTree as etree
-
-def parse_control_dependencies(requested_type):
- TARGET=os.getenv('OS')
- deps = []
- dep = ''
-
- if TARGET == '':
- print("Missing OS environment variable")
- sys.exit(1)
- OS = TARGET
- SUBOS = ''
- if TARGET:
- split = TARGET.split('-')
- if len(split) >= 2:
- OS = split[0]
- SUBOS = split[1]
- else:
- import lsb_release
- OS = lsb_release.get_distro_information()['ID'].lower()
- import platform
- SUBOS = platform.machine()
-
- tree = etree.parse(os.path.join(directory, "dependencies.xml"))
- root = tree.getroot()
- for child in root:
- if not "type" in child.attrib or not "id" in child.attrib:
- continue
- for distro in child:
- if not "id" in distro.attrib:
- continue
- if distro.attrib["id"] != OS:
- continue
- control = distro.find("control")
- if control is None:
- continue
- packages = distro.findall("package")
- for package in packages:
- if SUBOS:
- if not 'variant' in package.attrib:
- continue
- if package.attrib['variant'] != SUBOS:
- continue
- if package.text:
- dep = package.text
- else:
- dep = child.attrib["id"]
- if child.attrib["type"] == requested_type and dep:
- version = control.find('version')
- if version is not None:
- dep = "%s %s" % (dep, version.text)
- inclusions = control.findall('inclusive')
- if inclusions:
- for i in range(0, len(inclusions)):
- prefix = ''
- suffix = ' '
- if i == 0:
- prefix = " ["
- if i == len(inclusions) - 1:
- suffix = "]"
- dep = "%s%s%s%s" % (dep, prefix, inclusions[i].text, suffix)
- exclusions = control.findall('exclusive')
- if exclusions:
- for i in range(0, len(exclusions)):
- prefix = '!'
- suffix = ' '
- if i == 0:
- prefix = " [!"
- if i == len(exclusions) - 1:
- suffix = "]"
- dep = "%s%s%s%s" % (dep, prefix, exclusions[i].text, suffix)
- deps.append(dep)
- return deps
-
-directory = os.path.dirname(sys.argv[0])
-if (len(sys.argv) < 3):
- print("Missing input and output file")
- sys.exit(1)
-
-deps = parse_control_dependencies("build")
-
-input = sys.argv[1]
-if not os.path.exists(input):
- print("Missing input file %s" % input)
- sys.exit(1)
-
-with open(input, 'r') as rfd:
- lines = rfd.readlines()
-
-deps.sort()
-output = sys.argv[2]
-with open(output, 'w') as wfd:
- for line in lines:
- if line.startswith("Build-Depends: %%%DYNAMIC%%%"):
- wfd.write("Build-Depends:\n")
- for i in range(0, len(deps)):
- wfd.write("\t%s,\n" % deps[i])
- else:
- wfd.write(line)
diff -Nru fwupd-1.0.6/contrib/ci/generate_debian.py fwupd-1.2.10/contrib/ci/generate_debian.py
--- fwupd-1.0.6/contrib/ci/generate_debian.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/generate_debian.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,148 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2017 Dell, Inc.
+#
+# SPDX-License-Identifier: LGPL-2.1+
+#
+import os
+import sys
+import xml.etree.ElementTree as etree
+
+def parse_control_dependencies(requested_type):
+ TARGET=os.getenv('OS')
+ deps = []
+ dep = ''
+
+ if TARGET == '':
+ print("Missing OS environment variable")
+ sys.exit(1)
+ OS = TARGET
+ SUBOS = ''
+ if TARGET:
+ split = TARGET.split('-')
+ if len(split) >= 2:
+ OS = split[0]
+ SUBOS = split[1]
+ else:
+ import lsb_release
+ OS = lsb_release.get_distro_information()['ID'].lower()
+ import platform
+ SUBOS = platform.machine()
+
+ tree = etree.parse(os.path.join(os.path.dirname (sys.argv[0]), "dependencies.xml"))
+ root = tree.getroot()
+ for child in root:
+ if not "type" in child.attrib or not "id" in child.attrib:
+ continue
+ for distro in child:
+ if not "id" in distro.attrib:
+ continue
+ if distro.attrib["id"] != OS:
+ continue
+ control = distro.find("control")
+ if control is None:
+ continue
+ packages = distro.findall("package")
+ for package in packages:
+ if SUBOS:
+ if not 'variant' in package.attrib:
+ continue
+ if package.attrib['variant'] != SUBOS:
+ continue
+ if package.text:
+ dep = package.text
+ else:
+ dep = child.attrib["id"]
+ if child.attrib["type"] == requested_type and dep:
+ version = control.find('version')
+ if version is not None:
+ dep = "%s %s" % (dep, version.text)
+ inclusions = control.findall('inclusive')
+ if inclusions:
+ for i in range(0, len(inclusions)):
+ prefix = ''
+ suffix = ' '
+ if i == 0:
+ prefix = " ["
+ if i == len(inclusions) - 1:
+ suffix = "]"
+ dep = "%s%s%s%s" % (dep, prefix, inclusions[i].text, suffix)
+ exclusions = control.findall('exclusive')
+ if exclusions:
+ for i in range(0, len(exclusions)):
+ prefix = '!'
+ suffix = ' '
+ if i == 0:
+ prefix = " [!"
+ if i == len(exclusions) - 1:
+ suffix = "]"
+ dep = "%s%s%s%s" % (dep, prefix, exclusions[i].text, suffix)
+ deps.append(dep)
+ return deps
+
+def update_debian_control(target):
+ control_in = os.path.join(target, 'control.in')
+ control_out = os.path.join(target, 'control')
+
+ if not os.path.exists(control_in):
+ print("Missing file %s" % control_in)
+ sys.exit(1)
+
+ with open(control_in, 'r') as rfd:
+ lines = rfd.readlines()
+
+ deps = parse_control_dependencies("build")
+ deps.sort()
+ with open(control_out, 'w') as wfd:
+ for line in lines:
+ if line.startswith("Build-Depends: %%%DYNAMIC%%%"):
+ wfd.write("Build-Depends:\n")
+ for i in range(0, len(deps)):
+ wfd.write("\t%s,\n" % deps[i])
+ else:
+ wfd.write(line)
+
+def update_debian_copyright (directory):
+ copyright_in = os.path.join(directory, 'copyright.in')
+ copyright_out = os.path.join(directory, 'copyright')
+
+ if not os.path.exists(copyright_in):
+ print("Missing file %s" % copyright_in)
+ sys.exit(1)
+
+ # Assume all files are remaining LGPL-2.1+
+ copyrights = []
+ for root, dirs, files in os.walk('.'):
+ for file in files:
+ target = os.path.join (root, file)
+ #skip translations and license file
+ if target.startswith('./po/') or file == "COPYING":
+ continue
+ try:
+ with open(target, 'r') as rfd:
+ #read about the first few lines of the file only
+ lines = rfd.readlines(220)
+ except UnicodeDecodeError:
+ continue
+ for line in lines:
+ if 'Copyright (C) ' in line:
+ parts = line.split ('Copyright (C)')[1].strip() #split out the copyright header
+ partition = parts.partition(' ')[2] # remove the year string
+ copyrights += ["%s" % partition]
+ copyrights = "\n\t ".join(sorted(set(copyrights)))
+ with open(copyright_in, 'r') as rfd:
+ lines = rfd.readlines()
+
+ with open(copyright_out, 'w') as wfd:
+ for line in lines:
+ if line.startswith("%%%DYNAMIC%%%"):
+ wfd.write("Files: *\n")
+ wfd.write("Copyright: %s\n" % copyrights)
+ wfd.write("License: LGPL-2.1+\n")
+ wfd.write("\n")
+ else:
+ wfd.write(line)
+
+directory = os.path.join (os.getcwd(), 'debian')
+update_debian_control(directory)
+update_debian_copyright(directory)
diff -Nru fwupd-1.0.6/contrib/ci/generate_docker.py fwupd-1.2.10/contrib/ci/generate_docker.py
--- fwupd-1.0.6/contrib/ci/generate_docker.py 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/generate_docker.py 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,8 @@
#!/usr/bin/python3
#
-# Copyright (C) 2017-2018 Dell Inc.
+# Copyright (C) 2017-2018 Dell, Inc.
#
-# Licensed under the GNU General Public License Version 2
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# SPDX-License-Identifier: LGPL-2.1+
#
import os
import subprocess
@@ -79,14 +65,16 @@
with open(out.name, 'w') as wfd:
for line in lines:
if line.startswith("FROM %%%ARCH_PREFIX%%%"):
- if OS == "debian" and SUBOS == "i386":
+ if (OS == "debian" or OS == "ubuntu") and SUBOS == "i386":
replace = SUBOS + "/"
else:
replace = ''
wfd.write(line.replace("%%%ARCH_PREFIX%%%", replace))
elif line == "%%%INSTALL_DEPENDENCIES_COMMAND%%%\n":
- if OS == "fedora":
+ if OS == "fedora" or OS == 'flatpak':
wfd.write("RUN dnf --enablerepo=updates-testing -y install \\\n")
+ elif OS == "centos":
+ wfd.write("RUN yum -y install \\\n")
elif OS == "debian" or OS == "ubuntu":
wfd.write("RUN apt update -qq && \\\n")
wfd.write("\tapt install -yq --no-install-recommends\\\n")
@@ -108,4 +96,10 @@
else:
wfd.write(line)
wfd.flush()
- subprocess.check_call(["docker", "build", "-t", "fwupd-%s" % TARGET, "-f", "./%s" % os.path.basename(out.name), "."])
+ args = ["docker", "build", "-t", "fwupd-%s" % TARGET]
+ if 'http_proxy' in os.environ:
+ args += ['--build-arg=http_proxy=%s' % os.environ['http_proxy']]
+ if 'https_proxy' in os.environ:
+ args += ['--build-arg=https_proxy=%s' % os.environ['https_proxy']]
+ args += [ "-f", "./%s" % os.path.basename(out.name), "."]
+ subprocess.check_call(args)
diff -Nru fwupd-1.0.6/contrib/ci/README.md fwupd-1.2.10/contrib/ci/README.md
--- fwupd-1.0.6/contrib/ci/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -9,11 +9,12 @@
------
* A fully packaged RPM build with all plugins enabled
-* Compiled under gcc
+* Compiled under gcc with AddressSanitizer
* Tests with -Werror enabled
* Tests with the built in local test suite for all plugins.
* All packages are installed
* An installed testing run with the "test" plugin and pulling from LVFS.
+* With modem manager disabled
Debian testing (x86_64)
------
@@ -52,9 +53,12 @@
------
* Not packaged
+* Tests for missing translation files
+* No redfish support
* Compiled under gcc
* Tests with -Werror enabled
* Runs local test suite using qemu-user
+* Modem manager disabled
Arch Linux (x86_64)
----------
@@ -66,6 +70,14 @@
* Tests with the built in local test suite for all plugins.
* All packages are installed
+Flatpak
+----------
+* 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
+* No tests
+
Adding a new target
===================
Dockerfiles are generated dynamically by the python script ```generate_dockerfile.py```.
@@ -78,7 +90,7 @@
The child elements represent individual dependencies for all distributions.
* This element has an attribute ***id*** that represents the most common package name used by distributions
-* This element has an attribute ***type*** that reprsents if the package is needed at build time or runtime.
+* This element has an attribute ***type*** that represents if the package is needed at build time or runtime.
Each dependency then has a mapping to individual distributions (___distro___).
* This element has an attribute ***id*** that represents the distribution.
diff -Nru fwupd-1.0.6/contrib/ci/snapcraft-wrapper fwupd-1.2.10/contrib/ci/snapcraft-wrapper
--- fwupd-1.0.6/contrib/ci/snapcraft-wrapper 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/snapcraft-wrapper 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,12 @@
+#!/bin/sh
+SNAP="/snap/snapcraft/current"
+SNAP_NAME="$(awk '/^name:/{print $2}' $SNAP/meta/snap.yaml)"
+SNAP_VERSION="$(awk '/^version:/{print $2}' $SNAP/meta/snap.yaml)"
+SNAP_ARCH="amd64"
+
+export SNAP
+export SNAP_NAME
+export SNAP_VERSION
+export SNAP_ARCH
+
+exec "$SNAP/usr/bin/python3" "$SNAP/bin/snapcraft" "$@"
diff -Nru fwupd-1.0.6/contrib/ci/snap.sh fwupd-1.2.10/contrib/ci/snap.sh
--- fwupd-1.0.6/contrib/ci/snap.sh 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/snap.sh 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd /build
+snapcraft
diff -Nru fwupd-1.0.6/contrib/ci/ubuntu.sh fwupd-1.2.10/contrib/ci/ubuntu.sh
--- fwupd-1.0.6/contrib/ci/ubuntu.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/ci/ubuntu.sh 2019-07-15 18:25:54.000000000 +0000
@@ -1,69 +1,15 @@
-#!/bin/bash
+#!/bin/sh
set -e
set -x
-#although it's debian, we don't build packages
-if [ "$OS" = "debian-s390x" ]; then
- ./contrib/ci/debian_s390x.sh
- exit 0
-fi
-
-#prepare
-export DEBFULLNAME="CI Builder"
-export DEBEMAIL="ci@travis-ci.org"
-VERSION=`git describe | sed 's/-/+r/;s/-/+/'`
-[ -z $VERSION ] && VERSION=`head meson.build | grep ' version :' | cut -d \' -f2`
-rm -rf build/
-mkdir -p build
-shopt -s extglob
-cp -lR !(build|dist) build/
-pushd build
-mv contrib/debian .
-sed s/quilt/native/ debian/source/format -i
-#generate control file
-./contrib/ci/generate_debian_control.py debian/control.in debian/control
-#build the package
-EDITOR=/bin/true dch --create --package fwupd -v $VERSION "CI Build"
-debuild --no-lintian --preserve-envvar CI --preserve-envvar CC
-
-#check lintian output
-#suppress tags that are side effects of building in docker this way
-lintian ../*changes \
- -IE \
- --pedantic \
- --no-tag-display-limit \
- --suppress-tags bad-distribution-in-changes-file \
- --suppress-tags source-contains-unsafe-symlink \
- --suppress-tags changelog-should-mention-nmu \
- --suppress-tags debian-watch-file-in-native-package \
- --suppress-tags source-nmu-has-incorrect-version-number \
- --suppress-tags no-symbols-control-file \
- --allow-root
-
-#if invoked outside of CI
-if [ ! -f /.dockerenv ]; then
- echo "Not running in a container, please manually install packages"
- exit 0
-fi
-
-#test the packages install
-PACKAGES=$(ls ../*.deb | grep -v 'fwupd-tests\|dbgsym')
-dpkg -i $PACKAGES
-
-# run the installed tests
-if [ "$CI" = "true" ]; then
- dpkg -i ../fwupd-tests*.deb
- service dbus restart
- gnome-desktop-testing-runner fwupd
- apt purge -y fwupd-tests
-fi
-
-#test the packages remove
-apt purge -y fwupd \
- fwupd-doc \
- libfwupd2 \
- libfwupd-dev
-
-#place built packages in dist outside docker
-mkdir -p ../dist
-cp $PACKAGES ../dist
+#evaluate using Ubuntu's buildflags
+eval "$(dpkg-buildflags --export=sh)"
+#filter out -Bsymbolic-functions
+export LDFLAGS=$(dpkg-buildflags --get LDFLAGS | sed "s/-Wl,-Bsymbolic-functions\s//")
+
+rm -rf build
+meson build --werror
+#build with clang and -Werror
+ninja -C build test -v
+#run static analysis (these mostly won't be critical)
+ninja -C build scan-build -v
diff -Nru fwupd-1.0.6/contrib/debian/compat fwupd-1.2.10/contrib/debian/compat
--- fwupd-1.0.6/contrib/debian/compat 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/compat 2019-07-15 18:25:54.000000000 +0000
@@ -1 +1 @@
-9
+11
diff -Nru fwupd-1.0.6/contrib/debian/control.in fwupd-1.2.10/contrib/debian/control.in
--- fwupd-1.0.6/contrib/debian/control.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/control.in 2019-07-15 18:25:54.000000000 +0000
@@ -6,7 +6,7 @@
Matthias Klumpp ,
Mario Limonciello
Build-Depends: %%%DYNAMIC%%%
-Standards-Version: 4.1.3
+Standards-Version: 4.3.0
Section: admin
Homepage: https://github.com/hughsie/fwupd
Vcs-Git: https://salsa.debian.org/efi-team/fwupd.git
@@ -22,8 +22,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the library used by the daemon.
@@ -31,9 +30,13 @@
Package: fwupd
Architecture: linux-any
Depends: ${misc:Depends},
- ${shlibs:Depends}
-Recommends: fwupdate,
- python3
+ ${shlibs:Depends},
+ shared-mime-info
+Recommends: python3,
+ bolt,
+ tpm2-tools,
+ tpm2-abrmd,
+ fwupd-signed
Breaks: gir1.2-dfu-1.0 (<< 0.9.7-1),
libdfu1 (<< 0.9.7-1),
libdfu-dev (<< 0.9.7-1)
@@ -45,8 +48,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
Package: fwupd-tests
@@ -68,8 +70,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides a set of installed tests that can be run to validate
@@ -84,8 +85,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides development documentation for creating a package that
@@ -104,8 +104,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the development files for libfwupd
@@ -121,3 +120,31 @@
.
It can be used by packages using the GIRepository format to generate
dynamic bindings.
+
+Package: fwupd-amd64-signed-template
+Architecture: amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-i386-signed-template
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-armhf-signed-template
+Architecture: armhf
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-arm64-signed-template
+Architecture: arm64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
diff -Nru fwupd-1.0.6/contrib/debian/copyright fwupd-1.2.10/contrib/debian/copyright
--- fwupd-1.0.6/contrib/debian/copyright 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/copyright 1970-01-01 00:00:00.000000000 +0000
@@ -1,164 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: fwupd
-Source: https://github.com/hughsie/fwupd
-
-Files: *
-Copyright: 2015 Richard Hughes
-License: GPL-2.0+
-
-Files: libfwupd/*
-Copyright: 2015 Richard Hughes
-License: LGPL-2.1+
-
-Files: data/tests/colorhug/firmware.metainfo.xml
-Copyright: 2015 Richard Hughes
-License: CC0-1.0
-
-Files: debian/*
-Copyright: 2015 Daniel Jared Dominguez
- 2015 Mario Limonciello
-License: GPL-2.0+
-
-License: GPL-2.0+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program. If not, see
- .
- On Debian systems, the complete text of the GNU General
- Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
-
-License: LGPL-2.1+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see
- .
- On Debian systems, the complete text of the GNU Lesser General
- Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1".
-
-
-License: CC0-1.0
- Creative Commons CC0 1.0 Universal
- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
- SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT
- RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS.
- CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE
- INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
- RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
- HEREUNDER.
- .
- Statement of Purpose
- .
- The laws of most jurisdictions throughout the world automatically confer
- exclusive Copyright and Related Rights (defined below) upon the creator and
- subsequent owner(s) (each and all, an "owner") of an original work of
- authorship and/or a database (each, a "Work"). Certain owners wish to
- permanently relinquish those rights to a Work for the purpose of contributing
- to a commons of creative, cultural and scientific works ("Commons") that the
- public can reliably and without fear of later claims of infringement build
- upon, modify, incorporate in other works, reuse and redistribute as freely as
- possible in any form whatsoever and for any purposes, including without
- limitation commercial purposes. These owners may contribute to the Commons to
- promote the ideal of a free culture and the further production of creative,
- cultural and scientific works, or to gain reputation or greater distribution
- for their Work in part through the use and efforts of others. For these and/or
- other purposes and motivations, and without any expectation of additional
- consideration or compensation, the person associating CC0 with a Work (the
- "Affirmer"), to the extent that he or she is an owner of Copyright and Related
- Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly
- distribute the Work under its terms, with knowledge of his or her Copyright and
- Related Rights in the Work and the meaning and intended legal effect of CC0 on
- those rights.
- .
- 1. Copyright and Related Rights. A Work made available under CC0 may be
- protected by copyright and related or neighboring rights ("Copyright and
- Related Rights"). Copyright and Related Rights include, but are not limited to,
- the following:
- i. the right to reproduce, adapt, distribute, perform, display, communicate,
- and translate a Work;
- ii. moral rights retained by the original author(s) and/or performer(s);
- iii. publicity and privacy rights pertaining to a person's image or likeness
- depicted in a Work;
- iv. rights protecting against unfair competition in regards to a Work, subject
- to the limitations in paragraph 4(a), below;
- v. rights protecting the extraction, dissemination, use and reuse of data in a
- Work;
- vi. database rights (such as those arising under Directive 96/9/EC of the
- European Parliament and of the Council of 11 March 1996 on the legal protection
- of databases, and under any national implementation thereof, including any
- amended or successor version of such directive); and
- vii. other similar, equivalent or corresponding rights throughout the world
- based on applicable law or treaty, and any national implementations thereof.
- .
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
- unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
- and Related Rights and associated claims and causes of action, whether now
- known or unknown (including existing as well as future claims and causes of
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
- duration provided by applicable law or treaty (including future time
- extensions), (iii) in any current or future medium and for any number of
- copies, and (iv) for any purpose whatsoever, including without limitation
- commercial, advertising or promotional purposes (the "Waiver").
- Affirmer makes the Waiver for the benefit of each member of the public at large
- and to the detriment of Affirmer's heirs and successors, fully intending that
- such Waiver shall not be subject to revocation, rescission, cancellation,
- termination, or any other legal or equitable action to disrupt the quiet
- enjoyment of the Work by the public as contemplated by Affirmer's express
- Statement of Purpose.
- .
- 3. Public License Fallback. Should any part of the Waiver for any reason be
- judged legally invalid or ineffective under applicable law, then the Waiver
- shall be preserved to the maximum extent permitted taking into account
- Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
- is so judged Affirmer hereby grants to each affected person a royalty-free, non
- transferable, non sublicensable, non exclusive, irrevocable and unconditional
- license to exercise Affirmer's Copyright and Related Rights in the Work (i) in
- all territories worldwide, (ii) for the maximum duration provided by
- applicable law or treaty (including future time extensions), (iii) in any
- current or future medium and for any number of copies, and (iv) for any
- purpose whatsoever, including without limitation commercial, advertising or
- promotional purposes (the "License"). The License shall be deemed effective
- as of the date CC0 was applied by Affirmer to the Work. Should any part of
- the License for any reason be judged legally invalid or ineffective under
- applicable law, such partial invalidity or ineffectiveness shall not
- invalidate the remainder of the License, and in such case Affirmer hereby
- affirms that he or she will not (i) exercise any of his or her remaining
- Copyright and Related Rights in the Work or (ii) assert any associated claims
- and causes of action with respect to the Work, in either case contrary to
- Affirmer's express Statement of Purpose.
- .
- 4. Limitations and Disclaimers.
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
- surrendered, licensed or otherwise affected by this document.
- b. Affirmer offers the Work as-is and makes no representations or warranties of
- any kind concerning the Work, express, implied, statutory or otherwise,
- including without limitation warranties of title, merchantability, fitness for
- a particular purpose, non infringement, or the absence of latent or other
- defects, accuracy, or the present or absence of errors, whether or not
- discoverable, all to the greatest extent permissible under applicable law.
- c. Affirmer disclaims responsibility for clearing rights of other persons that
- may apply to the Work or any use thereof, including without limitation any
- person's Copyright and Related Rights in the Work. Further, Affirmer disclaims
- responsibility for obtaining any necessary consents, permissions or other
- rights required for any use of the Work.
- d. Affirmer understands and acknowledges that Creative Commons is not a party
- to this document and has no duty or obligation with respect to this CC0 or use
- of the Work.
diff -Nru fwupd-1.0.6/contrib/debian/copyright.in fwupd-1.2.10/contrib/debian/copyright.in
--- fwupd-1.0.6/contrib/debian/copyright.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/copyright.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,140 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fwupd
+Source: https://github.com/hughsie/fwupd
+
+%%%DYNAMIC%%%
+Files: *.metainfo.xml
+Copyright: Richard Hughes
+License: CC0-1.0
+
+Files: debian/*
+Copyright: 2015 Daniel Jared Dominguez
+ 2015-2018 Mario Limonciello
+License: LGPL-2.1+
+
+License: LGPL-2.1+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see
+ .
+ On Debian systems, the complete text of the GNU Lesser General
+ Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1".
+
+
+License: CC0-1.0
+ Creative Commons CC0 1.0 Universal
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
+ SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT
+ RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS.
+ CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE
+ INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
+ RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+ .
+ Statement of Purpose
+ .
+ The laws of most jurisdictions throughout the world automatically confer
+ exclusive Copyright and Related Rights (defined below) upon the creator and
+ subsequent owner(s) (each and all, an "owner") of an original work of
+ authorship and/or a database (each, a "Work"). Certain owners wish to
+ permanently relinquish those rights to a Work for the purpose of contributing
+ to a commons of creative, cultural and scientific works ("Commons") that the
+ public can reliably and without fear of later claims of infringement build
+ upon, modify, incorporate in other works, reuse and redistribute as freely as
+ possible in any form whatsoever and for any purposes, including without
+ limitation commercial purposes. These owners may contribute to the Commons to
+ promote the ideal of a free culture and the further production of creative,
+ cultural and scientific works, or to gain reputation or greater distribution
+ for their Work in part through the use and efforts of others. For these and/or
+ other purposes and motivations, and without any expectation of additional
+ consideration or compensation, the person associating CC0 with a Work (the
+ "Affirmer"), to the extent that he or she is an owner of Copyright and Related
+ Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly
+ distribute the Work under its terms, with knowledge of his or her Copyright and
+ Related Rights in the Work and the meaning and intended legal effect of CC0 on
+ those rights.
+ .
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
+ protected by copyright and related or neighboring rights ("Copyright and
+ Related Rights"). Copyright and Related Rights include, but are not limited to,
+ the following:
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work, subject
+ to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data in a
+ Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal protection
+ of databases, and under any national implementation thereof, including any
+ amended or successor version of such directive); and
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+ .
+ 2. Waiver. To the greatest extent permitted by, but not in contravention of,
+ applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+ unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+ and Related Rights and associated claims and causes of action, whether now
+ known or unknown (including existing as well as future claims and causes of
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum
+ duration provided by applicable law or treaty (including future time
+ extensions), (iii) in any current or future medium and for any number of
+ copies, and (iv) for any purpose whatsoever, including without limitation
+ commercial, advertising or promotional purposes (the "Waiver").
+ Affirmer makes the Waiver for the benefit of each member of the public at large
+ and to the detriment of Affirmer's heirs and successors, fully intending that
+ such Waiver shall not be subject to revocation, rescission, cancellation,
+ termination, or any other legal or equitable action to disrupt the quiet
+ enjoyment of the Work by the public as contemplated by Affirmer's express
+ Statement of Purpose.
+ .
+ 3. Public License Fallback. Should any part of the Waiver for any reason be
+ judged legally invalid or ineffective under applicable law, then the Waiver
+ shall be preserved to the maximum extent permitted taking into account
+ Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+ is so judged Affirmer hereby grants to each affected person a royalty-free, non
+ transferable, non sublicensable, non exclusive, irrevocable and unconditional
+ license to exercise Affirmer's Copyright and Related Rights in the Work (i) in
+ all territories worldwide, (ii) for the maximum duration provided by
+ applicable law or treaty (including future time extensions), (iii) in any
+ current or future medium and for any number of copies, and (iv) for any
+ purpose whatsoever, including without limitation commercial, advertising or
+ promotional purposes (the "License"). The License shall be deemed effective
+ as of the date CC0 was applied by Affirmer to the Work. Should any part of
+ the License for any reason be judged legally invalid or ineffective under
+ applicable law, such partial invalidity or ineffectiveness shall not
+ invalidate the remainder of the License, and in such case Affirmer hereby
+ affirms that he or she will not (i) exercise any of his or her remaining
+ Copyright and Related Rights in the Work or (ii) assert any associated claims
+ and causes of action with respect to the Work, in either case contrary to
+ Affirmer's express Statement of Purpose.
+ .
+ 4. Limitations and Disclaimers.
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or warranties of
+ any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness for
+ a particular purpose, non infringement, or the absence of latent or other
+ defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons that
+ may apply to the Work or any use thereof, including without limitation any
+ person's Copyright and Related Rights in the Work. Further, Affirmer disclaims
+ responsibility for obtaining any necessary consents, permissions or other
+ rights required for any use of the Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a party
+ to this document and has no duty or obligation with respect to this CC0 or use
+ of the Work.
diff -Nru fwupd-1.0.6/contrib/debian/docs fwupd-1.2.10/contrib/debian/docs
--- fwupd-1.0.6/contrib/debian/docs 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/docs 2019-07-15 18:25:54.000000000 +0000
@@ -1 +1 @@
-NEWS
+
diff -Nru fwupd-1.0.6/contrib/debian/fwupd.install fwupd-1.2.10/contrib/debian/fwupd.install
--- fwupd-1.0.6/contrib/debian/fwupd.install 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/fwupd.install 2019-07-15 18:25:54.000000000 +0000
@@ -4,12 +4,17 @@
usr/share/bash-completion
usr/share/fwupd/*
usr/share/dbus-1/*
+usr/share/icons/*
usr/share/polkit-1/*
usr/share/locale
usr/share/metainfo/*
usr/lib/*/fwupd
+usr/lib/*/fwupdagent
+usr/lib/*/fwupdoffline
+usr/lib/*/fwupdtool
usr/share/man/man1/*
lib/systemd/system/*
+lib/systemd/system-shutdown/*
var/lib/fwupd
lib/udev/rules.d/*
data/daemon.conf etc/fwupd
diff -Nru fwupd-1.0.6/contrib/debian/fwupd.postinst fwupd-1.2.10/contrib/debian/fwupd.postinst
--- fwupd-1.0.6/contrib/debian/fwupd.postinst 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/fwupd.postinst 2019-07-15 18:25:54.000000000 +0000
@@ -6,4 +6,6 @@
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
dpkg-maintscript-helper rm_conffile \
/etc/fwupd.conf 1.0.0~ -- "$@"
+ dpkg-maintscript-helper rm_conffile \
+ /etc/fwupd/remotes.d/fwupd.conf 1.2.7~ -- "$@"
fi
diff -Nru fwupd-1.0.6/contrib/debian/fwupd-tests.install fwupd-1.2.10/contrib/debian/fwupd-tests.install
--- fwupd-1.0.6/contrib/debian/fwupd-tests.install 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/fwupd-tests.install 2019-07-15 18:25:54.000000000 +0000
@@ -4,3 +4,5 @@
#https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872458
usr/share/installed-tests/*
usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
+debian/lintian/fwupd-tests usr/share/lintian/overrides
+etc/fwupd/remotes.d/fwupd-tests.conf
diff -Nru fwupd-1.0.6/contrib/debian/fwupd-tests.postinst fwupd-1.2.10/contrib/debian/fwupd-tests.postinst
--- fwupd-1.0.6/contrib/debian/fwupd-tests.postinst 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/fwupd-tests.postinst 2019-07-15 18:25:54.000000000 +0000
@@ -12,4 +12,12 @@
echo "To enable test suite, modify /etc/fwupd/daemon.conf"
fi
fi
+ if [ -f /etc/fwupd/remotes.d/fwupd-tests.conf ]; then
+ if [ "$CI" = "true" ]; then
+ sed "s,^Enabled=false,Enabled=true," -i /etc/fwupd/remotes.d/fwupd-tests.conf
+ else
+ echo "To enable test suite, enable fwupd-tests remote"
+ fi
+
+ fi
fi
diff -Nru fwupd-1.0.6/contrib/debian/gen_signing_changelog fwupd-1.2.10/contrib/debian/gen_signing_changelog
--- fwupd-1.0.6/contrib/debian/gen_signing_changelog 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/gen_signing_changelog 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Generate a changelog file for the signed fwupdate package, based on
+# a changelog.in file and other state
+
+DIR=$1
+SOURCE=$2
+ARCH=$3
+IN="${DIR}/changelog.in"
+OUT="${DIR}/changelog"
+
+# Parse out fields from our changelg entry - want the signing-template
+# one to match all the important details where we can
+DISTRIBUTION="$(dpkg-parsechangelog | sed -ne 's/^Distribution: \(.*\)/\1/p')"
+URGENCY="$(dpkg-parsechangelog | sed -ne 's/^Urgency: \(.*\)/\1/p')"
+MAINT="$(dpkg-parsechangelog | sed -ne 's/^Maintainer: \(.*\)/\1/p')"
+DATE="$(dpkg-parsechangelog | sed -ne 's/^Date: \(.*\)/\1/p')"
+
+# If the version ends in "+bXXX", this is a binNMU. We don't want a new
+# source package to look like that, so change it to ".bXXX" instead
+VERSION="$(dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')"
+MANGLED_VERSION="$(echo $VERSION | sed -r 's/-/\+/;s/\+(b[[:digit:]]+)$/.\1/')"
+
+printf "%s-%s-signed (%s) %s; urgency=%s\n" "${SOURCE}" "${ARCH}" "${MANGLED_VERSION}" "${DISTRIBUTION}" "${URGENCY}" > $OUT
+printf "\n" >> $OUT
+printf " * Update to %s version %s\n" "${SOURCE}" "${VERSION}" >> $OUT
+printf "\n" >> $OUT
+printf " -- %s %s\n" "${MAINT}" "${DATE}" >> $OUT
+printf "\n" >> $OUT
+
+cat $IN >> $OUT
+rm -f $IN
diff -Nru fwupd-1.0.6/contrib/debian/gen_signing_json fwupd-1.2.10/contrib/debian/gen_signing_json
--- fwupd-1.0.6/contrib/debian/gen_signing_json 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/gen_signing_json 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Generate a json file to go in the the fwupd-signed template
+# package. Describes exactly what needs to be signed, and how.
+
+DIR=$1
+SOURCE=$2
+ARCH=$3
+OUT="$DIR/files.json"
+
+# What file are we looking to sign?
+BINARY=$(find debian/tmp -name '*.efi' | xargs basename)
+
+# Actually needs full path within the binary deb
+BINARY="usr/lib/${SOURCE}/efi/${BINARY}"
+
+rm -f $OUT
+
+printf '{\n' >> $OUT
+printf ' "packages": {\n' >> $OUT
+printf ' "%s": {\n' "${SOURCE}" >> $OUT
+printf ' "trusted_certs": [],\n' >> $OUT
+printf ' "files": [ \n' >> $OUT
+printf ' {"sig_type": "efi", "file": "%s"}\n' "${BINARY}" >> $OUT
+printf ' ]\n' >> $OUT
+printf ' }\n' >> $OUT
+printf ' }\n' >> $OUT
+printf '}\n' >> $OUT
+
diff -Nru fwupd-1.0.6/contrib/debian/gir1.2-fwupd-2.0.install fwupd-1.2.10/contrib/debian/gir1.2-fwupd-2.0.install
--- fwupd-1.0.6/contrib/debian/gir1.2-fwupd-2.0.install 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/gir1.2-fwupd-2.0.install 2019-07-15 18:25:54.000000000 +0000
@@ -1 +1 @@
-usr/lib/*/girepository-1.0/Fwupd-2.0.typelib
+usr/lib/*/girepository-1.0/*.typelib
diff -Nru fwupd-1.0.6/contrib/debian/libfwupd2.install fwupd-1.2.10/contrib/debian/libfwupd2.install
--- fwupd-1.0.6/contrib/debian/libfwupd2.install 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/libfwupd2.install 2019-07-15 18:25:54.000000000 +0000
@@ -1 +1 @@
-usr/lib/*/libfwup*.so.*
+usr/lib/*/*.so.*
diff -Nru fwupd-1.0.6/contrib/debian/libfwupd-dev.install fwupd-1.2.10/contrib/debian/libfwupd-dev.install
--- fwupd-1.0.6/contrib/debian/libfwupd-dev.install 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/libfwupd-dev.install 2019-07-15 18:25:54.000000000 +0000
@@ -1,6 +1,5 @@
-usr/include/fwupd-1/fwupd.h
-usr/include/fwupd-1/libfwupd
-usr/lib/*/libfwupd*.so
-usr/lib/*/pkgconfig/fwupd.pc
-usr/share/gir-1.0/Fwupd*.gir
+usr/include/*
+usr/lib/*/*.so
+usr/lib/*/pkgconfig/*.pc
+usr/share/gir-1.0/*.gir
usr/share/vala/vapi
diff -Nru fwupd-1.0.6/contrib/debian/lintian/fwupd fwupd-1.2.10/contrib/debian/lintian/fwupd
--- fwupd-1.0.6/contrib/debian/lintian/fwupd 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/lintian/fwupd 2019-07-15 18:25:54.000000000 +0000
@@ -2,5 +2,9 @@
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/fwupd-offline-update.service
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/fwupd.service
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/system-update.target.wants/fwupd-offline-update.service
-#CAs is the right word, not Case
-fwupd binary: spelling-error-in-binary usr/lib/fwupd/fwupd CAs Case
+#see debian bug 896012
+fwupd: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_upower.so
+#EFI applications are PE executables
+fwupd: executable-not-elf-or-script usr/lib/fwupd/efi/*.efi
+fwupd: portable-executable-missing-security-features usr/lib/fwupd/efi/*.efi ASLR DEP/NX
+fwupd: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_modem_manager.so
diff -Nru fwupd-1.0.6/contrib/debian/lintian/fwupd-tests fwupd-1.2.10/contrib/debian/lintian/fwupd-tests
--- fwupd-1.0.6/contrib/debian/lintian/fwupd-tests 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/lintian/fwupd-tests 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+#see debian bug 896012
+fwupd-tests: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
diff -Nru fwupd-1.0.6/contrib/debian/README.Debian fwupd-1.2.10/contrib/debian/README.Debian
--- fwupd-1.0.6/contrib/debian/README.Debian 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/README.Debian 2019-07-15 18:25:54.000000000 +0000
@@ -1,7 +1,18 @@
-fwupd for Debian
-----------------
+signed vs unsigned fwupd programs
+------------------------------------
-fwupd is still heavily in development. As of this date, the functionality
-it provides is not yet available on most systems.
+fwupd 1.1.0 is configured to understand when to use a signed version
+of the EFI binary. If the signed version isn't installed but secure
+boot is turned on, it will avoid copying to the EFI system partition.
+
+This allows supporting secure boot even if not turned on at install, or
+changed later after install.
+
+In Ubuntu, both fwupd-signed and fwupd are seeded in the default
+installation. Nothing is installed to the ESP until it's needed.
+
+In Debian, the package name for the signed version is slightly
+different due to different infrastructure. fwupd-signed-$ARCH and
+fwupd should both be installed and then things will work similarly
+to what's described above.
- -- Daniel Jared Dominguez Wed, 20 May 2015 17:16:02 -0500
diff -Nru fwupd-1.0.6/contrib/debian/rules fwupd-1.2.10/contrib/debian/rules
--- fwupd-1.0.6/contrib/debian/rules 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/rules 2019-07-15 18:25:54.000000000 +0000
@@ -3,6 +3,7 @@
export LC_ALL := C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions
#GPGME needs this for proper building on 32 bit archs
ifeq "$(DEB_HOST_ARCH_BITS)" "32"
@@ -10,36 +11,80 @@
endif
ifneq ($(CI),)
- export CI=--werror
+ export CI=--werror --wrap-mode=default
+endif
+
+SB_STYLE := debian
+deb_version := $(shell dpkg-parsechangelog --show-field Version)
+ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
+ SB_STYLE := ubuntu
+ tar_name := fwupd_$(deb_version)_$(DEB_HOST_ARCH).tar.gz
+else
+ TMPLDIR := debian/fwupd-$(DEB_HOST_ARCH)-signed-template/usr/share/code-signing/fwupd-$(DEB_HOST_ARCH)-signed-template
endif
%:
- dh $@ --with gir,systemd
+ dh $@ --with gir
override_dh_auto_clean:
rm -fr debian/build
+ifeq (ubuntu,$(SB_STYLE))
+ rm -rf debian/fwupd-images
+endif
override_dh_auto_configure:
- if pkg-config --exists fwup; then \
- export UEFI="-Dplugin_uefi=true"; \
+ if pkg-config --exists libsmbios_c; then \
+ export DELL="-Dplugin_dell=true"; \
else \
- export UEFI="-Dplugin_uefi=false"; \
+ export DELL="-Dplugin_dell=false"; \
fi; \
- if pkg-config --exists libsmbios_c; then \
- export DELL="-Dplugin_dell=true -Dplugin_synaptics=true"; \
+ if pkg-config --exists efivar; then \
+ export UEFI="-Dplugin_uefi=true -Dplugin_redfish=true -Dplugin_nvme=true"; \
+ else \
+ export UEFI="-Dplugin_uefi=false -Dplugin_redfish=false -Dplugin_nvme=false"; \
+ fi; \
+ if [ ! -z "$$CI" ]; then \
+ export FLASHROM="-Dplugin_flashrom=true"; \
else \
- export DELL="-Dplugin_dell=false -Dplugin_synaptics=false"; \
+ export FLASHROM="-Dplugin_flashrom=false"; \
fi; \
- dh_auto_configure -- $$UEFI $$DELL $$CI -Dplugin_dummy=true --libexecdir=/usr/lib
+ dh_auto_configure -- $$UEFI $$DELL $$FLASHROM $$CI -Dplugin_dummy=true --libexecdir=/usr/lib
override_dh_install:
find debian/tmp/usr -type f -name "*a" -print | xargs rm -f
sed -i 's,wheel,sudo,' ./debian/tmp/usr/share/polkit-1/rules.d/org.freedesktop.fwupd.rules
dh_install
- dh_missing --fail-missing
+ #install the EFI binaries if needed
+ if [ -d debian/tmp/usr/lib/fwupd/efi/ ]; then \
+ dh_install -pfwupd usr/lib/fwupd/efi ;\
+ dh_install -pfwupd usr/lib/fwupd/fwupdate; \
+ fi
+ #if build with meson subproject in CI need to install this too
+ if [ ! -z "$$CI" ] && [ -f debian/tmp/usr/lib/xb-tool ]; then \
+ dh_install -pfwupd usr/lib/xb-tool ;\
+ fi
+ if [ ! -z "$$CI" ] && [ -f debian/tmp/usr/sbin/flashrom ]; then \
+ dh_install -pfwupd usr/sbin/flashrom ;\
+ fi
+ dh_missing -a --fail-missing
#this is placed in fwupd-tests
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
+ rm -f debian/fwupd/etc/fwupd/remotes.d/fwupd-tests.conf
+
+ifeq (debian,$(SB_STYLE))
+ # Generate the template source for the Debian signing service to use
+ mkdir -p $(TMPLDIR)/source-template/debian
+ cp -a debian/signing-template/* $(TMPLDIR)/source-template/debian
+ cp debian/README.Debian $(TMPLDIR)/source-template/debian
+ find $(TMPLDIR)/source-template/debian -type f | xargs sed -i "s,SIGNARCH,$(DEB_HOST_ARCH),"
+ find $(TMPLDIR)/source-template/debian -type f | xargs sed -i "s,SIGNVERSION,$(deb_version),"
+ for file in $$(find $(TMPLDIR)/source-template/debian -type f -name *SIGNARCH*); do file1=$$(echo $$file | sed "s,SIGNARCH,$(DEB_HOST_ARCH),"); mv -v $$file $$file1; done
+ install -m 0755 debian/fwupd.postinst $(TMPLDIR)/source-template/debian/fwupd-$(DEB_HOST_ARCH)-signed.postinst
+ install -m 0755 debian/fwupd.postrm $(TMPLDIR)/source-template/debian/fwupd-$(DEB_HOST_ARCH)-signed.postrm
+ ./debian/gen_signing_changelog $(TMPLDIR)/source-template/debian fwupd $(DEB_HOST_ARCH)
+ ./debian/gen_signing_json $(TMPLDIR) fwupd ${DEB_HOST_ARCH}
+endif
override_dh_strip_nondeterminism:
dh_strip_nondeterminism -Xfirmware-example.xml.gz
@@ -48,3 +93,18 @@
if [ -x /usr/bin/valgrind ] ; then \
dh_auto_test; \
fi
+
+override_dh_builddeb:
+ dh_builddeb
+ifeq (ubuntu,$(SB_STYLE))
+ if [ -d debian/tmp/usr/lib/fwupd/efi/ ]; then \
+ mkdir -p debian/fwupd-images/$(deb_version) ;\
+ cp debian/tmp/usr/lib/fwupd/efi/fwupd*.efi debian/fwupd-images/$(deb_version) ;\
+ echo $(deb_version) > debian/fwupd-images/$(deb_version)/version ;\
+ tar -C debian/fwupd-images -czvf ../$(tar_name) . ;\
+ dpkg-distaddfile $(tar_name) raw-uefi - ;\
+ fi
+endif
+
+override_dh_shlibdeps:
+ dh_shlibdeps $$DHSLIBS
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/changelog.in fwupd-1.2.10/contrib/debian/signing-template/changelog.in
--- fwupd-1.0.6/contrib/debian/signing-template/changelog.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/changelog.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,5 @@
+fwupd-SIGNARCH-signed (1) unstable; urgency=medium
+
+ * Add template source package for signing
+
+ -- Steve McIntyre <93sam@debian.org> Sat, 07 Apr 2018 12:44:55 +0100
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/compat fwupd-1.2.10/contrib/debian/signing-template/compat
--- fwupd-1.0.6/contrib/debian/signing-template/compat 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/compat 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+9
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/control fwupd-1.2.10/contrib/debian/signing-template/control
--- fwupd-1.0.6/contrib/debian/signing-template/control 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/control 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,24 @@
+Source: fwupd-SIGNARCH-signed
+Priority: optional
+Maintainer: Debian EFI
+Uploaders: Daniel Jared Dominguez , Steve McIntyre <93sam@debian.org>, Mario Limonciello
+Build-Depends: debhelper (>= 9.0.0), sbsigntool [amd64 arm64 armhf i386], fwupd (= SIGNVERSION) [SIGNARCH]
+Standards-Version: 4.1.3
+Section: libs
+Homepage: https://github.com/hughsie/fwupd
+Vcs-Git: https://salsa.debian.org/efi-team/fwupd.git
+Vcs-Browser: https://salsa.debian.org/efi-team/fwupd
+
+Package: fwupd-SIGNARCH-signed
+Section: admin
+Architecture: SIGNARCH
+Provides: fwupd-signed
+Depends: ${shlibs:Depends}, ${misc:Depends}, fwupd (= SIGNVERSION)
+Description: Tools to manage UEFI firmware updates (signed)
+ fwupd provides functionality to update system firmware. It has been
+ initially designed to update firmware using UEFI capsule updates, but
+ it is designed to be extensible to other firmware update standards.
+ .
+ This package contains just the signed version of the fwupd binary,
+ needed if your system has UEFI Secure Boot enabled. It depends on the
+ normal fwupd package for everything else.
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/copyright fwupd-1.2.10/contrib/debian/signing-template/copyright
--- fwupd-1.0.6/contrib/debian/signing-template/copyright 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/copyright 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,33 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fwupd
+Source: https://github.com/hughsie/fwupd
+
+Files: *
+Copyright: 2015 Richard Hughes
+License: LGPL-2.1+
+
+Files: data/tests/colorhug/firmware.metainfo.xml
+Copyright: 2015 Richard Hughes
+License: CC0-1.0
+
+Files: debian/*
+Copyright: 2015 Daniel Jared Dominguez
+ 2015 Mario Limonciello
+License: LGPL-2.1+
+
+License: LGPL-2.1+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see
+ .
+ On Debian systems, the complete text of the GNU Lesser General
+ Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1".
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/fwupd-SIGNARCH-signed.install fwupd-1.2.10/contrib/debian/signing-template/fwupd-SIGNARCH-signed.install
--- fwupd-1.0.6/contrib/debian/signing-template/fwupd-SIGNARCH-signed.install 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/fwupd-SIGNARCH-signed.install 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+*.efi.signed /usr/lib/fwupd/efi
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/README.source fwupd-1.2.10/contrib/debian/signing-template/README.source
--- fwupd-1.0.6/contrib/debian/signing-template/README.source 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/README.source 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,4 @@
+This source package is generated by the Debian signing service from a
+template built by the fwupd package. It should never be updated directly.
+
+ -- Steve McIntyre <93sam@debian.org> Sat, 07 Apr 2018 12:44:55 +0100
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/rules fwupd-1.2.10/contrib/debian/signing-template/rules
--- fwupd-1.0.6/contrib/debian/signing-template/rules 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/rules 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+PACKAGE_NAME := fwupd
+SIG_PKG_NAME := fwupd-SIGNARCH-signed
+SIGNATURE_DIR := debian/signatures/$(PACKAGE_NAME)
+BINARY := $(shell find /usr/lib/fwupd/efi -name '*.efi' | xargs basename)
+
+%:
+ dh $@
+
+override_dh_auto_build:
+ cp /usr/lib/fwupd/efi/$(BINARY) .
+ sbattach --attach $(SIGNATURE_DIR)/usr/lib/fwupd/efi/$(BINARY).sig $(BINARY)
+ mv $(BINARY) $(BINARY).signed
diff -Nru fwupd-1.0.6/contrib/debian/signing-template/source/format fwupd-1.2.10/contrib/debian/signing-template/source/format
--- fwupd-1.0.6/contrib/debian/signing-template/source/format 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/signing-template/source/format 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+3.0 (native)
diff -Nru fwupd-1.0.6/contrib/debian/source/lintian-overrides fwupd-1.2.10/contrib/debian/source/lintian-overrides
--- fwupd-1.0.6/contrib/debian/source/lintian-overrides 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/debian/source/lintian-overrides 2019-07-15 18:25:54.000000000 +0000
@@ -1,2 +1,4 @@
#github doesn't have these
-fwupd source: debian-watch-may-check-gpg-signature
+fwupd source: debian-watch-does-not-check-gpg-signature
+#to make CI happy until libxmlb lands
+fwupd source: source-is-missing
diff -Nru fwupd-1.0.6/contrib/firmware-packager/firmware-packager fwupd-1.2.10/contrib/firmware-packager/firmware-packager
--- fwupd-1.0.6/contrib/firmware-packager/firmware-packager 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/firmware-packager/firmware-packager 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,8 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
#
# Copyright (C) 2017 Max Ehrlich max.ehr@gmail.com
#
-# Licensed under the GNU General Public License Version 2
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# SPDX-License-Identifier: LGPL-2.1+
#
import argparse
@@ -38,14 +24,14 @@
firmware_metainfo_template = """
- {firmware_id}
+ org.{developer_name}.guid{firmware_id}{firmware_name}{firmware_summary}
{firmware_description}
- {device_unique_id}
+ {device_guid}{firmware_homepage}CC0-1.0
@@ -64,7 +50,9 @@
def make_firmware_metainfo(firmware_info, dst):
- firmware_metainfo = firmware_metainfo_template.format(**vars(firmware_info), timestamp=time.time())
+ local_info = vars(firmware_info)
+ local_info["firmware_id"] = local_info["device_guid"][0:8]
+ firmware_metainfo = firmware_metainfo_template.format(**local_info, timestamp=time.time())
with open(os.path.join(dst, 'firmware.metainfo.xml'), 'w') as f:
f.write(firmware_metainfo)
@@ -82,7 +70,17 @@
def create_firmware_cab(exe, folder):
with cd(folder):
- command = ['gcab', '--create', 'firmware.cab', 'firmware.bin', 'firmware.metainfo.xml']
+ if os.name == "nt":
+ directive = os.path.join (folder, "directive")
+ with open (directive, 'w') as wfd:
+ wfd.write('.OPTION EXPLICIT\r\n')
+ wfd.write('.Set CabinetNameTemplate=firmware.cab\r\n')
+ wfd.write('.Set DiskDirectory1=.\r\n')
+ wfd.write('firmware.bin\r\n')
+ wfd.write('firmware.metainfo.xml\r\n')
+ command = ['makecab.exe', '/f', directive]
+ else:
+ command = ['gcab', '--create', 'firmware.cab', 'firmware.bin', 'firmware.metainfo.xml']
subprocess.check_call(command)
@@ -107,18 +105,17 @@
shutil.copy(os.path.join(dir, 'firmware.cab'), args.out)
parser = argparse.ArgumentParser(description='Create fwupd packaged from windows executables')
-parser.add_argument('--firmware-id', help='ID for the firmware package, can be a customized (e.g. net.queuecumber.DellTBT.firmware)', required=True)
parser.add_argument('--firmware-name', help='Name of the firmware package can be customized (e.g. DellTBT)', required=True)
parser.add_argument('--firmware-summary', help='One line description of the firmware package')
parser.add_argument('--firmware-description', help='Longer description of the firmware package')
-parser.add_argument('--device-unique-id', help='Unique ID of the device this firmware will run on, this *must* match the output from `fwupdmgr get-devices`', required=True)
+parser.add_argument('--device-guid', help='GUID of the device this firmware will run on, this *must* match the output of one of the GUIDs in `fwupdmgr get-devices`', required=True)
parser.add_argument('--firmware-homepage', help='Website for the firmware provider')
parser.add_argument('--contact-info', help='Email address of the firmware developer')
-parser.add_argument('--developer-name', help='Name of the firmware developer')
+parser.add_argument('--developer-name', help='Name of the firmware developer', required=True)
parser.add_argument('--release-version', help='Version number of the firmware package', required=True)
parser.add_argument('--release-description', help='Description of the firmware release')
-parser.add_argument('--exe', help='Executable file to extract firmware from')
-parser.add_argument('--bin', help='Path to the .bin file inside the executable to use as the firmware image', required=True)
+parser.add_argument('--exe', help='(optional) Executable file to extract firmware from')
+parser.add_argument('--bin', help='Path to the .bin file (Relative if inside the executable; Absolute if outside) to use as the firmware image', required=True)
parser.add_argument('--out', help='Output cab file path', required=True)
args = parser.parse_args()
diff -Nru fwupd-1.0.6/contrib/firmware-packager/meson.build fwupd-1.2.10/contrib/firmware-packager/meson.build
--- fwupd-1.0.6/contrib/firmware-packager/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/firmware-packager/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,2 +1,4 @@
-install_data('firmware-packager',
- install_dir : 'share/fwupd')
+if get_option('firmware-packager')
+ install_data('firmware-packager',
+ install_dir : 'share/fwupd')
+endif
diff -Nru fwupd-1.0.6/contrib/firmware-packager/README.md fwupd-1.2.10/contrib/firmware-packager/README.md
--- fwupd-1.0.6/contrib/firmware-packager/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/firmware-packager/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -26,24 +26,22 @@
## Documentation
-`--firmware-id` ID for the firmware package, can be a customized [fwupd.org](http://fwupd.org/vendors.html) recommends using "a reverse-DNS prefix similar to java" and to "always use a .firmware suffix" (e.g. net.queuecumber.DellTBT.firmware) **REQUIRED**
-
`--firmware-name` Short name of the firmware package can be customized (e.g. DellTBT) **REQUIRED**
`--firmware-summary` One line description of the firmware package (e.g. Dell thunderbolt firmware)
`--firmware-description` Longer description of the firmware package. Theoretically this can include HTML but I haven't tried it
-`--device-unique-id` Unique ID of the device this firmware will run on, this *must* match the output from `fwupdmgr get-devices` (e.g. 72533768-6a6c-5c06-994a-367374336810) **REQUIRED**
+`--device-guid` GUID ID of the device this firmware will run on, this *must* match the output from `fwupdmgr get-devices` (e.g. 72533768-6a6c-5c06-994a-367374336810) **REQUIRED**
`--firmware-homepage` Website for the firmware provider (e.g. http://www.dell.com)
`-contact-info` Email address of the firmware developer (e.g. someone@something.net)
-`--developer-name` Name of the firmware developer (e.g. John Smith)
+`--developer-name` Name of the firmware developer (e.g. Dell) **REQUIRED**
`--release-version` Version number of the firmware package (e.g. 4.21.01.002) **REQUIRED**
-`--release-description` Description of the firmware release, again this can theoretically include HTML but I didnt try it.
+`--release-description` Description of the firmware release, again this can theoretically include HTML but I didn't try it.
`--exe` Executable file to extract firmware from (e.g. `dell-thunderbolt-firmware.exe`) **REQUIRED**
diff -Nru fwupd-1.0.6/contrib/fix_translations.py fwupd-1.2.10/contrib/fix_translations.py
--- fwupd-1.0.6/contrib/fix_translations.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/fix_translations.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1+
+
+import sys
+import os
+import subprocess
+
+def _do_msgattrib(fn):
+ argv = ['msgattrib',
+ '--no-location',
+ '--translated',
+ '--no-wrap',
+ '--sort-output',
+ fn,
+ '--output-file=' + fn]
+ ret = subprocess.run(argv)
+ if ret.returncode != 0:
+ return
+
+def _do_nukeheader(fn):
+ clean_lines = []
+ with open(fn) as f:
+ lines = f.readlines()
+ for line in lines:
+ if line.startswith('"POT-Creation-Date:'):
+ continue
+ if line.startswith('"PO-Revision-Date:'):
+ continue
+ if line.startswith('"Last-Translator:'):
+ continue
+ clean_lines.append(line)
+ with open(fn, 'w') as f:
+ f.writelines(clean_lines)
+
+def _process_file(fn):
+ _do_msgattrib(fn)
+ _do_nukeheader(fn)
+
+if __name__ == '__main__':
+ if len(sys.argv) == 1:
+ print('path required')
+ sys.exit(1)
+ try:
+ dirname = sys.argv[1]
+ for fn in os.listdir(dirname):
+ if fn.endswith('.po'):
+ _process_file(os.path.join(dirname, fn))
+ except NotADirectoryError as _:
+ print('path required')
+ sys.exit(2)
diff -Nru fwupd-1.0.6/contrib/fwupd.spec.in fwupd-1.2.10/contrib/fwupd.spec.in
--- fwupd-1.0.6/contrib/fwupd.spec.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/fwupd.spec.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,8 +1,7 @@
%global glib2_version 2.45.8
-%global libappstream_version 0.6.13
+%global libxmlb_version 0.1.3
%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
@@ -11,32 +10,43 @@
%global enable_ci 0
%global enable_tests 1
%global enable_dummy 1
+%global __meson_wrap_mode default
-# fwupdate is only available on these arches
+# fwupd.efi is only available on these arches
%ifarch x86_64 aarch64
%global have_uefi 1
%endif
-# libsmbios is only available on x86, and fwupdate is available on just x86_64
+# redfish is only available on this arch
+%ifarch x86_64
+%global have_redfish 1
+%endif
+
+# libsmbios is only available on x86
%ifarch x86_64
%global have_dell 1
%endif
+# only available recently
+%if 0%{?fedora} >= 30
+%global have_modem_manager 1
+%endif
+
Summary: Firmware update daemon
Name: fwupd
Version: #VERSION#
Release: 0.#BUILD#%{?alphatag}%{?dist}
-License: GPLv2+
+License: LGPLv2+
URL: https://github.com/hughsie/fwupd
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
-BuildRequires: libappstream-glib-devel >= %{libappstream_version}
+BuildRequires: libxmlb-devel >= %{libxmlb_version}
+BuildRequires: libgcab1-devel
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
@@ -44,53 +54,64 @@
BuildRequires: libarchive-devel
BuildRequires: gobject-introspection-devel
BuildRequires: gcab
+%ifarch %{valgrind_arches}
BuildRequires: valgrind
BuildRequires: valgrind-devel
+%endif
BuildRequires: elfutils-libelf-devel
BuildRequires: gtk-doc
-BuildRequires: libuuid-devel
BuildRequires: gnutls-devel
BuildRequires: gnutls-utils
BuildRequires: meson
BuildRequires: help2man
BuildRequires: json-glib-devel >= %{json_glib_version}
BuildRequires: vala
+BuildRequires: bash-completion
+
+%if 0%{?have_modem_manager}
+BuildRequires: ModemManager-glib-devel >= 1.10.0
+BuildRequires: libqmi-devel >= 1.22.0
+%endif
+
+%if 0%{?have_redfish}
+BuildRequires: efivar-devel >= 33
+%endif
%if 0%{?have_uefi}
+BuildRequires: efivar-devel >= 33
BuildRequires: python3 python3-cairo python3-gobject python3-pillow
BuildRequires: pango-devel
BuildRequires: cairo-devel cairo-gobject-devel
BuildRequires: freetype
BuildRequires: fontconfig
-BuildRequires: dejavu-sans-fonts
-BuildRequires: adobe-source-han-sans-cn-fonts
+BuildRequires: google-noto-sans-cjk-ttc-fonts
+BuildRequires: gnu-efi-devel
+BuildRequires: pesign
%endif
%if 0%{?have_dell}
-BuildRequires: efivar-devel
+BuildRequires: efivar-devel >= 33
BuildRequires: libsmbios-devel >= 2.3.0
%endif
-%if 0%{?have_uefi}
-BuildRequires: fwupdate-devel >= 7
-%endif
-
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: glib2%{?_isa} >= %{glib2_version}
-Requires: libappstream-glib%{?_isa} >= %{libappstream_version}
+Requires: libxmlb%{?_isa} >= %{libxmlb_version}
Requires: libgusb%{?_isa} >= %{libgusb_version}
Requires: libsoup%{?_isa} >= %{libsoup_version}
-Requires: fwupd-labels = %{version}-%{release}
Requires: bubblewrap
+Requires: shared-mime-info
Recommends: python3
+Recommends: tpm2-tools tpm2-abrmd
Obsoletes: fwupd-sign < 0.1.6
Obsoletes: libebitdo < 0.7.5-3
-Obsoletes: libdfu < 0.9.8-1
+Obsoletes: libdfu < 1.0.0
+Obsoletes: fwupd-labels < 1.1.0-1
%description
fwupd is a daemon to allow session software to update device firmware.
@@ -99,20 +120,11 @@
Summary: Development package for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Obsoletes: libebitdo-devel < 0.7.5-3
-Obsoletes: libdfu-devel < 0.9.8-1
+Obsoletes: libdfu-devel < 1.0.0
%description devel
Files for development with %{name}.
-%package labels
-Summary: Rendered labels for display during system firmware updates.
-# BuildArch: noarch is disabled as we can get "different" .BMP files even when
-# running the build on the same architecture due to the randomness introduced
-# by the TTF files.
-
-%description labels
-Rendered labels for display during system firmware updates.
-
%package tests
Summary: Data files for installed tests
BuildArch: noarch
@@ -121,7 +133,7 @@
Data files for installed tests.
%prep
-%setup -q
+%autosetup -p1
%build
@@ -130,7 +142,6 @@
--werror \
%endif
-Dgtkdoc=true \
- -Dman=true \
%if 0%{?enable_tests}
-Dtests=true \
%else
@@ -141,13 +152,19 @@
%else
-Dplugin_dummy=false \
%endif
+ -Dplugin_flashrom=true \
-Dplugin_thunderbolt=true \
+%if 0%{?have_redfish}
+ -Dplugin_redfish=true \
+%else
+ -Dplugin_redfish=false \
+%endif
%if 0%{?have_uefi}
-Dplugin_uefi=true \
- -Dplugin_uefi_labels=true \
+ -Dplugin_nvme=true \
%else
-Dplugin_uefi=false \
- -Dplugin_uefi_labels=false \
+ -Dplugin_nvme=false \
%endif
%if 0%{?have_dell}
-Dplugin_dell=true \
@@ -156,7 +173,12 @@
-Dplugin_dell=false \
-Dplugin_synaptics=false \
%endif
- -Dplugin_colorhug=true
+%if 0%{?have_modem_manager}
+ -Dplugin_modem_manager=true \
+%else
+ -Dplugin_modem_manager=false \
+%endif
+ -Dman=true
%meson_build
@@ -168,41 +190,79 @@
%install
%meson_install
+# sign fwupd.efi loader
+%if 0%{?have_uefi}
+%ifarch x86_64
+%global efiarch x64
+%endif
+%ifarch aarch64
+%global efiarch aa64
+%endif
+%global fwup_efi_fn $RPM_BUILD_ROOT%{_libexecdir}/fwupd/efi/fwupd%{efiarch}.efi
+%pesign -s -i %{fwup_efi_fn} -o %{fwup_efi_fn}.signed
+%endif
+
mkdir -p --mode=0700 $RPM_BUILD_ROOT%{_localstatedir}/lib/fwupd/gnupg
+# delete most files from the subproject
+rm ${RPM_BUILD_ROOT}%{_includedir}/libflashrom.h
+rm ${RPM_BUILD_ROOT}%{_libdir}/libflashrom.so
+rm ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig/libflashrom.pc
+rm ${RPM_BUILD_ROOT}%{_sbindir}/flashrom
+
%find_lang %{name}
%post
-/sbin/ldconfig
%systemd_post fwupd.service
%preun
%systemd_preun fwupd.service
%postun
-/sbin/ldconfig
%systemd_postun_with_restart fwupd.service
+%systemd_postun_with_restart pesign.service
%files -f %{name}.lang
-%doc README.md AUTHORS NEWS
+%doc README.md AUTHORS
%license COPYING
%config(noreplace)%{_sysconfdir}/fwupd/daemon.conf
+%if 0%{?have_uefi}
%config(noreplace)%{_sysconfdir}/fwupd/uefi.conf
+%endif
+%if 0%{?have_redfish}
+%config(noreplace)%{_sysconfdir}/fwupd/redfish.conf
+%endif
%dir %{_libexecdir}/fwupd
%{_libexecdir}/fwupd/fwupd
+%{_libexecdir}/fwupd/fwupdtool
+%{_libexecdir}/fwupd/fwupdagent
+%{_libexecdir}/fwupd/fwupdoffline
+%if 0%{?have_uefi}
+%{_libexecdir}/fwupd/efi/*.efi
+%{_libexecdir}/fwupd/efi/*.efi.signed
+%{_libexecdir}/fwupd/fwupdate
+%endif
%{_bindir}/dfu-tool
%{_bindir}/fwupdmgr
%dir %{_sysconfdir}/fwupd
%dir %{_sysconfdir}/fwupd/remotes.d
-%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/fwupd.conf
+%if 0%{?have_dell}
+%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/dell-esrt.conf
+%endif
%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/lvfs.conf
%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/lvfs-testing.conf
%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/vendor.conf
+%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/vendor-directory.conf
%config(noreplace)%{_sysconfdir}/pki/fwupd
%{_sysconfdir}/pki/fwupd-metadata
%{_sysconfdir}/dbus-1/system.d/org.freedesktop.fwupd.conf
%{_datadir}/bash-completion/completions/fwupdmgr
-%{_datadir}/fwupd/remotes.d/fwupd/metadata.xml
+%{_datadir}/bash-completion/completions/fwupdtool
+%{_datadir}/bash-completion/completions/fwupdagent
+%{_datadir}/fwupd/metainfo/org.freedesktop.fwupd*.metainfo.xml
+%if 0%{?have_dell}
+%{_datadir}/fwupd/remotes.d/dell-esrt/metadata.xml
+%endif
%{_datadir}/fwupd/remotes.d/vendor/firmware/README.md
%{_datadir}/dbus-1/interfaces/org.freedesktop.fwupd.xml
%{_datadir}/polkit-1/actions/org.freedesktop.fwupd.policy
@@ -211,6 +271,7 @@
%{_datadir}/man/man1/dfu-tool.1.gz
%{_datadir}/man/man1/fwupdmgr.1.gz
%{_datadir}/metainfo/org.freedesktop.fwupd.metainfo.xml
+%{_datadir}/icons/hicolor/scalable/apps/org.freedesktop.fwupd.svg
%{_datadir}/fwupd/firmware-packager
%{_unitdir}/fwupd-offline-update.service
%{_unitdir}/fwupd.service
@@ -222,21 +283,40 @@
%{_libdir}/libfwupd*.so.*
%{_libdir}/girepository-1.0/Fwupd-2.0.typelib
/usr/lib/udev/rules.d/*.rules
+/usr/lib/systemd/system-shutdown/fwupd.shutdown
%dir %{_libdir}/fwupd-plugins-3
%{_libdir}/fwupd-plugins-3/libfu_plugin_altos.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_amt.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_ata.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_colorhug.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_csr.so
%if 0%{?have_dell}
%{_libdir}/fwupd-plugins-3/libfu_plugin_dell.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_dell_esrt.so
%endif
+%{_libdir}/fwupd-plugins-3/libfu_plugin_dell_dock.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_dfu.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_ebitdo.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_fastboot.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_flashrom.so
+%if 0%{?have_modem_manager}
+%{_libdir}/fwupd-plugins-3/libfu_plugin_modem_manager.so
+%endif
%{_libdir}/fwupd-plugins-3/libfu_plugin_nitrokey.so
+%if 0%{?have_uefi}
+%{_libdir}/fwupd-plugins-3/libfu_plugin_nvme.so
+%endif
+%if 0%{?have_redfish}
+%{_libdir}/fwupd-plugins-3/libfu_plugin_redfish.so
+%endif
+%{_libdir}/fwupd-plugins-3/libfu_plugin_rts54hid.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_rts54hub.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_steelseries.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_superio.so
%if 0%{?have_dell}
%{_libdir}/fwupd-plugins-3/libfu_plugin_synapticsmst.so
%endif
+%{_libdir}/fwupd-plugins-3/libfu_plugin_synaptics_prometheus.so
%if 0%{?enable_dummy}
%{_libdir}/fwupd-plugins-3/libfu_plugin_test.so
%endif
@@ -248,7 +328,15 @@
%endif
%{_libdir}/fwupd-plugins-3/libfu_plugin_unifying.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_upower.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_wacom_raw.so
+%{_libdir}/fwupd-plugins-3/libfu_plugin_wacom_usb.so
%ghost %{_localstatedir}/lib/fwupd/gnupg
+%if 0%{?have_uefi}
+%{_datadir}/locale/*/LC_IMAGES/fwupd*
+%endif
+
+# eww, but just until the Fedora package ships these...
+%{_libdir}/libflashrom.so.1*
%files devel
%{_datadir}/gir-1.0/Fwupd-2.0.gir
@@ -258,19 +346,15 @@
%{_libdir}/libfwupd*.so
%{_libdir}/pkgconfig/fwupd.pc
-%files labels
-%if 0%{?have_uefi}
-%{_datadir}/locale/*/LC_IMAGES/fwupd*
-%endif
-
%files tests
%dir %{_datadir}/installed-tests/fwupd
-%{_datadir}/installed-tests/fwupd/firmware-example.xml.gz
-%{_datadir}/installed-tests/fwupd/firmware-example.xml.gz.asc
+%{_datadir}/installed-tests/fwupd/fwupd-tests.xml
%{_datadir}/installed-tests/fwupd/*.test
%{_datadir}/installed-tests/fwupd/*.cab
%{_datadir}/installed-tests/fwupd/*.sh
%{_datadir}/installed-tests/fwupd/*.py*
+%dir %{_sysconfdir}/fwupd/remotes.d
+%config(noreplace)%{_sysconfdir}/fwupd/remotes.d/fwupd-tests.conf
%changelog
* #LONGDATE# Richard Hughes #VERSION#-0.#BUILD##ALPHATAG#
diff -Nru fwupd-1.0.6/contrib/nvme-parse.py fwupd-1.2.10/contrib/nvme-parse.py
--- fwupd-1.0.6/contrib/nvme-parse.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/nvme-parse.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,128 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1+
+
+import csv
+import binascii
+import os
+import struct
+import glob
+from collections import namedtuple
+
+class Record(object):
+ def __init__(self, filename, cns):
+ self.filename = filename
+ self.cns = cns
+
+def load_pci_ids():
+ pci_vendors = {}
+ pci_vendors[0x1987] = 'Freescale'
+ for ln in open('/usr/share/hwdata/pci.ids').read().split('\n'):
+ if ln.startswith('#'):
+ continue
+ if ln.startswith('\t'):
+ continue
+ data = ln.split(' ')
+ if len(data) != 2:
+ continue
+ pci_vendors[int(data[0], 16)] = data[1].split(' ')[0]
+ if data[0] == 'ffff':
+ break
+ return pci_vendors
+
+def _data_to_utf8(s):
+ return s.decode('utf-8', 'replace').replace('\0', ' ')
+
+def main():
+
+ # open files
+ records = []
+ for fn in glob.glob('tests/nvme/*'):
+ blob = open(fn, 'rb').read()
+ if len(blob) != 4096:
+ print('WARNING: ignoring %s of size %i' % (fn, len(blob)))
+ continue
+ Cns = namedtuple('Cns',
+ 'vid ssvid sn mn fr rab ieee cmic mdts cntlid ver ' \
+ 'rtd3r rtd3e oaes ctratt rrls rsvd102 oacs acl aerl ' \
+ 'frmw lpa elpe npss avscc apsta wctemp cctemp mtfa ' \
+ 'hmpre hmmin tnvmcap unvmcap rpmbs edstt dsto fwug ' \
+ 'kas hctma mntmt mxtmt sanicap hmminds hmmaxd ' \
+ 'nsetidmax rsvd340 anatt anacap anagrpmax nanagrpid ' \
+ 'rsvd352 sqes cqes maxcmd nn oncs fuses fna vwc awun ' \
+ 'awupf nvscc nwpc acwu rsvd534 sgls mnan rsvd544 ' \
+ 'subnqn rsvd1024 ioccsz iorcsz icdoff ctrattr msdbd ' \
+ 'rsvd1804 psd vs')
+ try:
+ cns = Cns._make(struct.unpack(' 0:
+ s1ro_cnt += 1
+ if (r.cns.frmw & 0x10) >> 4:
+ fawr_cnt += 1
+ nfws = (r.cns.frmw & 0x0e) >> 1
+ if nfws in nfws_map:
+ nfws_map[nfws] += 1
+ continue
+ nfws_map[nfws] = 1
+ print('s1ro=%i/%i' % (s1ro_cnt, len(records)))
+ print('fawr=%i/%i' % (fawr_cnt, len(records)))
+ nfws = sorted(nfws_map.items(), key=lambda k: k[0], reverse=True)
+ for nfws, cnt in nfws:
+ print('nfws[%i]=%i' % (nfws, cnt))
+
+ # vendor popularity
+ vids = {}
+ for r in records:
+ if r.cns.vid not in vids:
+ vids[r.cns.vid] = 1
+ continue
+ vids[r.cns.vid] += 1
+ vids = sorted(vids.items(), key=lambda k: k[1], reverse=True)
+ pci_vendors = load_pci_ids()
+ for vid, cnt in vids:
+ name = '0x%04x' % vid
+ if vid in pci_vendors:
+ name = pci_vendors[vid]
+ print('%s,%i' % (name, cnt))
+
+ # vendor records
+ vs_records = []
+ for r in records:
+ if r.cns.vs:
+ vs_records.append(r)
+ print('nr_vs=%i' % len(vs_records))
+
+main()
diff -Nru fwupd-1.0.6/contrib/PKGBUILD fwupd-1.2.10/contrib/PKGBUILD
--- fwupd-1.0.6/contrib/PKGBUILD 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/PKGBUILD 2019-07-15 18:25:54.000000000 +0000
@@ -8,14 +8,16 @@
arch=('i686' 'x86_64')
url='https://github.com/hughsie/fwupd'
license=('GPL2')
-depends=('appstream-glib' 'fwupdate' 'colord')
+depends=('libgusb' 'modemmanager')
+optdepends=('tpm2-abrmd' 'tpm2-tools')
makedepends=('meson' 'valgrind' 'gobject-introspection' 'gtk-doc' 'python-pillow' 'git'
- 'python-cairo' 'ttf-dejavu' 'adobe-source-han-sans-cn-fonts' 'python-gobject' 'vala')
+ 'python-cairo' 'noto-fonts' 'noto-fonts-cjk' 'python-gobject' 'vala'
+ 'libsoup' 'polkit' 'gcab')
build() {
cd ${pkgname}
if [ -n "$CI" ]; then
- export CI="--werror"
+ export CI="--werror --wrap-mode=default"
fi
arch-meson -D b_lto=false $CI ../build
diff -Nru fwupd-1.0.6/contrib/README.md fwupd-1.2.10/contrib/README.md
--- fwupd-1.0.6/contrib/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/contrib/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -17,7 +17,7 @@
To build the RPMs run this command (from the root of your git checkout):
```
-docker run -t -v `pwd`:/build fwupd-fedora
+docker run --privileged -t -v `pwd`:/build fwupd-fedora
```
RPMs will be made available in your working directory when complete.
@@ -37,9 +37,9 @@
To build the DEBs run one of these commands (from the root of your git checkout):
```
-docker run -t -v `pwd`:/build fwupd-debian-x86_64
-docker run -t -v `pwd`:/build fwupd-debian-i386
-docker run -t -v `pwd`:/build fwupd-ubuntu-x86_64
+docker run --privileged -t -v `pwd`:/build fwupd-debian-x86_64
+docker run --privileged -t -v `pwd`:/build fwupd-debian-i386
+docker run --privileged -t -v `pwd`:/build fwupd-ubuntu-x86_64
```
DEBs will be made available in your working directory when complete.
diff -Nru fwupd-1.0.6/contrib/simple_client.py fwupd-1.2.10/contrib/simple_client.py
--- fwupd-1.0.6/contrib/simple_client.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/simple_client.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,126 @@
+#!/usr/bin/python3
+# SPDX-License-Identifier: LGPL-2.1+
+"""A simple fwupd frontend"""
+import sys
+import os
+import gi
+from gi.repository import GLib
+gi.require_version('Fwupd', '2.0')
+from gi.repository import Fwupd #pylint: disable=wrong-import-position
+
+class Progress():
+ """Class to track the signal changes of progress events"""
+ def __init__(self):
+ self.device = None
+ self.status = None
+ self.percent = 0
+ self.erase = 0
+
+ def device_changed(self, new_device):
+ """Indicate new device string to track"""
+ if self.device != new_device:
+ self.device = new_device
+ print("\nUpdating %s" % self.device)
+
+ def status_changed(self, percent, status):
+ """Indicate new status string or % complete to track"""
+ if self.status != status or self.percent != percent:
+ for i in range(0, self.erase):
+ sys.stdout.write("\b \b")
+ self.status = status
+ self.percent = percent
+ status_str = "["
+ for i in range(0, 50):
+ if i < percent/2:
+ status_str += '*'
+ else:
+ status_str += ' '
+ status_str += "] %d%% %s" %(percent, status)
+ status_str.erase = len(status_str)
+ sys.stdout.write(status_str)
+ sys.stdout.flush()
+ if 'idle' in status:
+ sys.stdout.write("\n")
+
+def parse_args():
+ """Parse arguments for this client"""
+ import argparse
+ parser = argparse.ArgumentParser(description="Interact with fwupd daemon")
+ parser.add_argument("--allow-older", action="store_true",
+ help="Install older payloads(default False)")
+ parser.add_argument("--allow-reinstall", action="store_true",
+ help="Reinstall payloads(default False)")
+ parser.add_argument("command", choices=["get-devices",
+ "get-details",
+ "install"], help="What to do")
+ parser.add_argument('cab', nargs='?', help='CAB file')
+ parser.add_argument('deviceid', nargs='?',
+ help='DeviceID to operate on(optional)')
+ args = parser.parse_args()
+ return args
+
+def get_devices(client):
+ """Use fwupd client to fetch devices"""
+ devices = client.get_devices()
+ for item in devices:
+ print(item.to_string())
+
+def get_details(client, cab):
+ """Use fwupd client to fetch details for a CAB file"""
+ devices = client.get_details(cab, None)
+ for device in devices:
+ print(device.to_string())
+
+def status_changed(client, spec, progress): #pylint: disable=unused-argument
+ """Signal emitted by fwupd daemon indicating status changed"""
+ progress.status_changed(client.get_percentage(),
+ Fwupd.status_to_string(client.get_status()))
+
+def device_changed(client, device, progress): #pylint: disable=unused-argument
+ """Signal emitted by fwupd daemon indicating active device changed"""
+ progress.device_changed(device.get_name())
+
+def install(client, cab, target, older, reinstall):
+ """Use fwupd client to install CAB file to applicable devices"""
+ # FWUPD_DEVICE_ID_ANY
+ if not target:
+ target = '*'
+ flags = Fwupd.InstallFlags.NONE
+ if older:
+ flags |= Fwupd.InstallFlags.ALLOW_OLDER
+ if reinstall:
+ flags |= Fwupd.InstallFlags.ALLOW_REINSTALL
+ progress = Progress()
+ parent = super(client.__class__, client)
+ parent.connect('device-changed', device_changed, progress)
+ parent.connect('notify::percentage', status_changed, progress)
+ parent.connect('notify::status', status_changed, progress)
+ try:
+ client.install(target, cab, flags, None)
+ except GLib.Error as glib_err: #pylint: disable=catching-non-exception
+ progress.status_changed(0, 'idle')
+ print("%s" % glib_err)
+ sys.exit(1)
+
+def check_cab(cab):
+ """Check that CAB file exists"""
+ if not cab:
+ print("Need to specify payload")
+ sys.exit(1)
+ if not os.path.isfile(cab):
+ print("%s doesn't exist or isn't a file" % cab)
+ sys.exit(1)
+
+if __name__ == '__main__':
+ ARGS = parse_args()
+ CLIENT = Fwupd.Client()
+ CLIENT.connect()
+
+ if ARGS.command == "get-devices":
+ get_devices(CLIENT)
+ elif ARGS.command == "get-details":
+ check_cab(ARGS.cab)
+ get_details(CLIENT, ARGS.cab)
+ elif ARGS.command == "install":
+ check_cab(ARGS.cab)
+ install(CLIENT, ARGS.cab, ARGS.deviceid, ARGS.allow_older, ARGS.allow_reinstall)
diff -Nru fwupd-1.0.6/contrib/snap/activate-shutdown/fwupd-activate.service fwupd-1.2.10/contrib/snap/activate-shutdown/fwupd-activate.service
--- fwupd-1.0.6/contrib/snap/activate-shutdown/fwupd-activate.service 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/activate-shutdown/fwupd-activate.service 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,12 @@
+[Unit]
+Description=Activate fwupd updates
+RequiresMountsFor=/snap/fwupd/current
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStop=/snap/bin/fwupd.fwupdtool activate
+SuccessExitStatus=0 2
+
+[Install]
+WantedBy=multi-user.target
diff -Nru fwupd-1.0.6/contrib/snap/activate-shutdown/Makefile fwupd-1.2.10/contrib/snap/activate-shutdown/Makefile
--- fwupd-1.0.6/contrib/snap/activate-shutdown/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/activate-shutdown/Makefile 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,9 @@
+build:
+ true
+install:
+ install -d ${DESTDIR}/etc/systemd/system/
+ install -m0644 fwupd-activate.service ${DESTDIR}/etc/systemd/system
+ # fixes up shutdown activation script for classic snap
+ sed -i "s,/libexec/fwupd/,/snap/bin/fwupd.," \
+ ${SNAPCRAFT_STAGE}/lib/systemd/system-shutdown/fwupd.shutdown
+
diff -Nru fwupd-1.0.6/contrib/snap/dfu-tool.wrapper fwupd-1.2.10/contrib/snap/dfu-tool.wrapper
--- fwupd-1.0.6/contrib/snap/dfu-tool.wrapper 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/dfu-tool.wrapper 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec "$SNAP/fwupd-command" $SNAP/bin/dfu-tool $@
diff -Nru fwupd-1.0.6/contrib/snap/fix-bash-completion/Makefile fwupd-1.2.10/contrib/snap/fix-bash-completion/Makefile
--- fwupd-1.0.6/contrib/snap/fix-bash-completion/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fix-bash-completion/Makefile 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,10 @@
+build:
+ true
+install:
+ #fixes up fwupdtool -> fwupd.fwupdtool
+ sed -i "s,\(complete -F _fwupd[a-z]*\) \(fwupd.*\),\1 fwupd.\2,; \
+ s,\(command.*\)\(fwupdtool\),\1fwupd.\2," \
+ ${SNAPCRAFT_STAGE}/share/bash-completion/completions/*
+ # fixes up dbus service for classic snap
+ sed -i 's!SystemdService=\(.*\)!SystemdService=snap.fwupd.fwupd.service!' \
+ ${SNAPCRAFT_STAGE}/share/dbus-1/system-services/org.freedesktop.fwupd.service
diff -Nru fwupd-1.0.6/contrib/snap/fwupd-command fwupd-1.2.10/contrib/snap/fwupd-command
--- fwupd-1.0.6/contrib/snap/fwupd-command 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwupd-command 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache
+mkdir -p $XDG_CACHE_HOME
+export GIO_MODULE_DIR=$XDG_CACHE_HOME/gio-modules
+export XDG_DATA_DIRS="$SNAP/usr/share"
+
+#determine architecture
+if [ "$SNAP_ARCH" = "amd64" ]; then
+ ARCH="x86_64-linux-gnu"
+elif [ "$SNAP_ARCH" = "armhf" ]; then
+ ARCH="arm-linux-gnueabihf"
+elif [ "$SNAP_ARCH" = "arm64" ]; then
+ ARCH="aarch64-linux-gnu"
+else
+ ARCH="$SNAP_ARCH-linux-gnu"
+fi
+
+# don't update between versions, we want to preserve previous data
+[ ! -d "$SNAP_USER_DATA/etc" ] && cp -R "$SNAP/etc" "$SNAP_USER_DATA"
+[ ! -d "$SNAP_USER_DATA/var" ] && cp -R "$SNAP/var" "$SNAP_USER_DATA"
+
+# re-generate gio modules in local cache
+needs_update=true
+if [ -f $SNAP_USER_DATA/.last_revision ]; then
+ . $SNAP_USER_DATA/.last_revision 2>/dev/null
+fi
+if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then
+ needs_update=false
+fi
+if [ $needs_update = true ]; then
+ if [ -f $SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules ]; then
+ rm -rf $GIO_MODULE_DIR
+ mkdir -p $GIO_MODULE_DIR
+ ln -s $SNAP/usr/lib/$ARCH/gio/modules/*.so $GIO_MODULE_DIR
+ $SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules $GIO_MODULE_DIR
+ fi
+ echo "SNAP_DESKTOP_LAST_REVISION=$SNAP_REVISION" > $SNAP_USER_DATA/.last_revision
+fi
+
+exec "$@"
diff -Nru fwupd-1.0.6/contrib/snap/fwupdmgr.wrapper fwupd-1.2.10/contrib/snap/fwupdmgr.wrapper
--- fwupd-1.0.6/contrib/snap/fwupdmgr.wrapper 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwupdmgr.wrapper 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec "$SNAP/fwupd-command" $SNAP/bin/fwupdmgr $@
diff -Nru fwupd-1.0.6/contrib/snap/fwupdtool.wrapper fwupd-1.2.10/contrib/snap/fwupdtool.wrapper
--- fwupd-1.0.6/contrib/snap/fwupdtool.wrapper 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwupdtool.wrapper 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec "$SNAP/fwupd-command" $SNAP/libexec/fwupd/fwupdtool $@
diff -Nru fwupd-1.0.6/contrib/snap/fwupd.wrapper fwupd-1.2.10/contrib/snap/fwupd.wrapper
--- fwupd-1.0.6/contrib/snap/fwupd.wrapper 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwupd.wrapper 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec "$SNAP/fwupd-command" $SNAP/libexec/fwupd/fwupd $@
diff -Nru fwupd-1.0.6/contrib/snap/fwup-efi-signed/download-fwupd fwupd-1.2.10/contrib/snap/fwup-efi-signed/download-fwupd
--- fwupd-1.0.6/contrib/snap/fwup-efi-signed/download-fwupd 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwup-efi-signed/download-fwupd 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,36 @@
+#! /usr/bin/python3
+
+import re
+import shutil
+from urllib.parse import urlparse, urlunparse
+from urllib.request import urlopen
+
+import apt
+import apt_pkg
+
+ARCH_TO_EFI_NAME = {
+ 'amd64': 'x64',
+ 'i386': 'ia32',
+ 'arm64': 'aa64',
+ 'armhf': 'arm',
+}
+arch = apt_pkg.config['Apt::Architecture']
+efi_name = ARCH_TO_EFI_NAME[arch]
+cache = apt.Cache()
+fwupd_efi = cache["fwupd"].candidate
+pool_parsed = urlparse(fwupd_efi.uri)
+dists_dir = "/dists/devel/main/uefi/fwupd-%s/current/" % (
+ fwupd_efi.architecture)
+
+DOWNLOAD_LIST = {
+ "fwupd%s.efi.signed" %efi_name: "fwupd%s.efi.signed" % efi_name,
+ "version": "fwupd%s.efi.signed.version" % efi_name
+}
+for base in DOWNLOAD_LIST:
+ dists_parsed = list(pool_parsed)
+ dists_parsed[2] = re.sub(r"/pool/.*", dists_dir + base, dists_parsed[2])
+ dists_uri = urlunparse(dists_parsed)
+ target = DOWNLOAD_LIST[base]
+ print("Downloading %s to %s..." % (dists_uri, target))
+ with urlopen(dists_uri) as dists, open(target, "wb") as out:
+ shutil.copyfileobj(dists, out)
diff -Nru fwupd-1.0.6/contrib/snap/fwup-efi-signed/Makefile fwupd-1.2.10/contrib/snap/fwup-efi-signed/Makefile
--- fwupd-1.0.6/contrib/snap/fwup-efi-signed/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/fwup-efi-signed/Makefile 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,34 @@
+DEB_HOST_ARCH=$(shell dpkg-architecture -q DEB_HOST_ARCH)
+EFI_NAME := UNKNOWN-EFI-NAME
+
+ifeq ($(DEB_HOST_ARCH),amd64)
+EFI_NAME := x64
+endif
+
+ifeq ($(DEB_HOST_ARCH),i386)
+EFI_NAME := ia32
+endif
+
+ifeq ($(DEB_HOST_ARCH),arm64)
+EFI_NAME := aa64
+endif
+
+ifeq ($(DEB_HOST_ARCH),armhf)
+EFI_NAME := arm
+endif
+
+SIGNED := \
+ fwupd$(EFI_NAME).efi.signed
+
+all: $(SIGNED)
+
+$(SIGNED):
+ ./download-fwupd
+
+install: $(SIGNED)
+ install -d $(DESTDIR)/libexec/fwupd/efi
+ install -m0644 $(SIGNED) $(SIGNED).version \
+ $(DESTDIR)/libexec/fwupd/efi
+
+clean:
+ rm -f $(SIGNED) $(SIGNED).version
diff -Nru fwupd-1.0.6/contrib/snap/libefivar-fixpkgconfig/Makefile fwupd-1.2.10/contrib/snap/libefivar-fixpkgconfig/Makefile
--- fwupd-1.0.6/contrib/snap/libefivar-fixpkgconfig/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/libefivar-fixpkgconfig/Makefile 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,10 @@
+build:
+ true
+
+install:
+ sed -i 's!libdir=\(.*\)!libdir=${SNAPCRAFT_STAGE}\1!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efiboot.pc
+ sed -i 's!includedir=\(.*\)!includedir=${SNAPCRAFT_STAGE}\1!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efiboot.pc
+ sed -i 's!Cflags:\(.*\)!Cflags:\1 -L$$\{libdir\}!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efiboot.pc
+ sed -i 's!libdir=\(.*\)!libdir=${SNAPCRAFT_STAGE}\1!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efivar.pc
+ sed -i 's!includedir=\(.*\)!includedir=${SNAPCRAFT_STAGE}\1!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efivar.pc
+ sed -i 's!Cflags:\(.*\)!Cflags:\1 -L$$\{libdir\}!' ${SNAPCRAFT_STAGE}/lib/pkgconfig/efivar.pc
diff -Nru fwupd-1.0.6/contrib/snap/README.md fwupd-1.2.10/contrib/snap/README.md
--- fwupd-1.0.6/contrib/snap/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,31 @@
+# Snap support
+
+Snaps are containerised software packages that are simple to create and install. They auto-update and are safe to run. And because they bundle their dependencies, they work on all major Linux systems without modification.
+
+## stable vs unstable
+Two yaml files are distributed:
+
+* snapcraft.yaml
+This uses tarball releases for all dependencies and what is currently in tree for fwupd.
+
+* snapcraft-master.yaml
+This uses git for most dependencies and may be considered unstable.
+
+# Building
+
+Builds can be performed using snapcraft:
+
+```
+# snapcraft cleanbuild
+```
+
+# Installing
+
+A "classic" snap is produced, and locally built snaps can be installed like this:
+
+```
+# snap install fwupd_daily_amd64.snap --dangerous --classic
+```
+
+The `--dangerous` flag is because snaps built locally are not signed.
+Snaps distributed by a store will not need this flag.
diff -Nru fwupd-1.0.6/contrib/snap/snapcraft-master.yaml fwupd-1.2.10/contrib/snap/snapcraft-master.yaml
--- fwupd-1.0.6/contrib/snap/snapcraft-master.yaml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/snapcraft-master.yaml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,344 @@
+name: fwupd
+version-script: cat $SNAPCRAFT_STAGE/version
+version: 'daily'
+summary: A standalone version of fwupd to install newer firmware updates
+description: |
+ This is a tool that can be used to install firmware updates on devices
+ not yet supported by the version of fwupd distributed with the OS.
+
+grade: devel
+confinement: classic
+
+architectures:
+ - amd64
+
+apps:
+ dfu-tool:
+ command: dfu-tool.wrapper
+ fwupdtool:
+ command: fwupdtool.wrapper
+ completer:
+ share/bash-completion/completions/fwupdtool
+ fwupd:
+ command: fwupd.wrapper
+ daemon: simple
+ fwupdmgr:
+ command: fwupdmgr.wrapper
+ completer:
+ share/bash-completion/completions/fwupdmgr
+
+parts:
+ libefivar-dev:
+ plugin: make
+ make-parameters:
+ - prefix=/
+ - libdir=/lib
+ source: https://github.com/rhboot/efivar.git
+ source-type: git
+ build-packages:
+ - libpopt-dev
+ prime:
+ - -include
+ - -bin
+ - -share/man
+ - -lib/pkgconfig
+ #adjust the paths from libefivar
+ libefivar-fixpkgconfig:
+ plugin: make
+ source: contrib/snap/libefivar-fixpkgconfig
+ make-parameters:
+ - SNAPCRAFT_STAGE=$SNAPCRAFT_STAGE
+ after: [libefivar-dev]
+ libsmbios:
+ plugin: autotools
+ source: https://github.com/dell/libsmbios
+ source-type: git
+ build-packages:
+ - libxml2-dev
+ - pkg-config
+ - autoconf
+ - automake
+ - libtool
+ - autopoint
+ prime:
+ - -include/
+ - -lib/pkgconfig
+ - -lib/python3.5
+ - -sbin/
+ - -share/
+ - -etc/
+ - -lib/*.a
+ meson:
+ plugin: python
+ source: https://github.com/mesonbuild/meson.git
+ source-tag: 0.47.2
+ build-packages:
+ - ninja-build
+ prime:
+ - -bin
+ - -etc
+ - -lib
+ - -share
+ - -usr
+ gudev:
+ plugin: autotools
+ source: https://gitlab.gnome.org/GNOME/libgudev.git
+ source-type: git
+ configflags:
+ - --disable-umockdev
+ build-packages:
+ - libglib2.0-dev
+ - pkg-config
+ - libudev-dev
+ - gtk-doc-tools
+ - gnome-common
+ prime:
+ - -include
+ - -lib/girepository-1.0
+ - -lib/pkgconfig
+ - -share/
+ # this is for the library only, we don't care about the daemon "in-snap"
+ modemmanager:
+ plugin: autotools
+ source: https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
+ #not yet tagged
+ #source-tag: 1.10.0
+ after: [gudev, gettext]
+ # build without these; system daemon needs them
+ configflags:
+ - --without-mbim
+ - --without-qmi
+ prime:
+ - -include
+ - -etc
+ - -sbin
+ - -bin
+ - -share
+ - -lib/*.*a
+ - -lib/pkgconfig
+ - -lib/ModemManager
+ - -lib/systemd
+ - -lib/udev
+ - -lib/girepository-1.0
+ libqmi:
+ plugin: autotools
+ source: https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
+ #not yet tagged
+ #source-tag: 1.10.0
+ after: [gudev, gettext, modemmanager]
+ # build without these; system daemon needs them
+ configflags:
+ - --without-udev
+ prime:
+ - -include
+ - -etc
+ - -sbin
+ - -bin
+ - -share
+ - -lib/*.*a
+ - -lib/pkgconfig
+ - -lib/ModemManager
+ - -lib/systemd
+ - -lib/udev
+ - -lib/girepository-1.0
+ libusb:
+ plugin: autotools
+ source: https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2
+ configflags:
+ - --disable-static
+ prime:
+ - -include/
+ - -lib/pkgconfig
+ gusb:
+ plugin: meson
+ source: https://github.com/hughsie/libgusb/archive/0.3.0.tar.gz
+ meson-parameters: [--prefix=/,
+ -Dtests=false,
+ -Dvapi=false,
+ -Ddocs=false]
+ build-packages:
+ - libgirepository1.0-dev
+ prime:
+ - -bin/
+ - -include
+ - -share
+ - -lib/*/pkgconfig
+ - -lib/*/girepository-1.0
+ after: [meson, libusb]
+ gnu-efi:
+ plugin: make
+ source: http://superb-dca2.dl.sourceforge.net/project/gnu-efi/gnu-efi-3.0.5.tar.bz2
+ make-parameters:
+ - PREFIX=/usr
+ make-install-var: INSTALLROOT
+ prime:
+ - -usr/include/
+ - -usr/lib
+ #fetch the latest version of the signed bootloader
+ #this might not match our fwupdx64.efi, but it's better than nothing
+ fwup-efi-signed:
+ build-packages:
+ - python3-apt
+ plugin: make
+ source: contrib/snap/fwup-efi-signed
+ #needed for UEFI plugin to build UX labels
+ build-introspection:
+ plugin: nil
+ stage-packages:
+ - python3-gi
+ - python3-gi-cairo
+ - python3-pil
+ prime:
+ - -etc
+ - -usr
+ - -lib
+ - -var
+ #0.19.8.1 adds support for GETTEXTDATADIRS which is needed by meson's msgfmthelper
+ gettext:
+ source: https://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.xz
+ plugin: autotools
+ build-packages:
+ - bison
+ - libunistring-dev
+ - libxml2-dev
+ configflags:
+ - --prefix=/usr
+ - --disable-static
+ - --disable-curses
+ - --disable-java
+ - --enable-relocatable
+ - --without-emacs
+ - --without-included-glib
+ - --without-included-libunistring
+ - --without-included-libxml
+ stage-packages:
+ - libunistring0
+ - libxml2
+ - libgomp1
+ prime:
+ - -**/*.a
+ - -**/*.la
+ - -usr/bin
+ - -usr/include
+ - -usr/lib/gettext
+ - -usr/share
+ fwupd:
+ plugin: meson
+ meson-parameters: [--prefix=/,
+ -Defi-includedir=$SNAPCRAFT_STAGE/usr/include/efi,
+ -Defi-ldsdir=$SNAPCRAFT_STAGE/usr/lib,
+ -Defi-libdir=$SNAPCRAFT_STAGE/usr/lib,
+ -Dtests=false,
+ -Ddaemon=true,
+ -Dgtkdoc=false,
+ -Dintrospection=false,
+ -Dman=false,
+ -Dplugin_modem_manager=true,
+ -Dudevdir=$SNAPCRAFT_STAGE/lib/udev,
+ -Dlibxmlb:gtkdoc=false,
+ -Dlibxmlb:introspection=false,
+ -Dpkcs7=false]
+ source: .
+ source-type: git
+ override-build: |
+ snapcraftctl build
+ echo $(git describe HEAD --always) > $SNAPCRAFT_STAGE/version
+ build-packages:
+ - bash-completion
+ - gcab
+ - gnutls-dev
+ - libarchive-dev
+ - libcairo-dev
+ - libelf-dev
+ - libgcab-dev
+ - libglib2.0-dev
+ - libgpgme11-dev
+ - libjson-glib-dev
+ - libpango1.0-dev
+ - libpolkit-gobject-1-dev
+ - libsoup2.4-dev
+ - libsqlite3-dev
+ - locales
+ - pkg-config
+ - uuid-dev
+ stage-packages:
+ - libgcab-1.0-0
+ - libarchive13
+ - libassuan0
+ - liblcms2-2
+ - libelf1
+ - libgpgme11
+ - libjson-glib-1.0-0
+ - libpolkit-gobject-1-0
+ - libsoup2.4-1
+ - glib-networking
+ - libglib2.0-bin
+ prime:
+ # we explicitly don't want /usr/bin/gpgconf
+ # this will cause gpgme to error finding it
+ # but that also avoids trying to use non-existent
+ # /usr/bin/gpg2
+ - -usr/bin
+ - -usr/sbin
+ - -usr/share/man
+ - -usr/share/GConf
+ - -etc/X11
+ - -etc/ldap
+ - -etc/logcheck
+ - -usr/lib/dconf
+ - -usr/lib/gcc
+ - -usr/lib/glib-networking
+ - -usr/lib/gnupg2
+ - -usr/lib/sasl2
+ - -usr/lib/systemd
+ - -usr/lib/*/audit
+ - -usr/share/glib-2.0/schemas
+ - -usr/share/X11
+ - -include
+ - -lib/udev
+ - -lib/*/pkgconfig
+ - -usr/share/lintian
+ - -usr/share/pkgconfig
+ - -usr/share/installed-tests
+ - -usr/share/polkit-1
+ - -usr/share/vala
+ - -usr/share/doc
+ - -usr/share/gnupg2
+ - -usr/share/info
+ - -usr/share/gir-1.0
+ - -usr/share/upstart
+ - -usr/lib/*/pkgconfig
+ after: [gudev, gusb, gnu-efi, libefivar-fixpkgconfig, libsmbios, build-introspection, gettext, modemmanager, libqmi]
+ fix-bash-completion:
+ plugin: make
+ source: contrib/snap/fix-bash-completion
+ after: [fwupd]
+ activate-shutdown:
+ plugin: make
+ source: contrib/snap/activate-shutdown
+ after: [fwupd]
+ update-mime:
+ plugin: make
+ source: contrib/snap/update-mime
+ stage-packages:
+ - shared-mime-info
+ - gsettings-desktop-schemas
+ - libxml2
+ prime:
+ - -usr/bin
+ - -usr/share/doc
+ - -usr/share/doc-base
+ - -usr/share/man
+ - -usr/share/lintian
+ - -usr/share/pkgconfig
+ - -usr/share/GConf
+ after: [fwupd]
+ fwupd-wrappers:
+ plugin: dump
+ source: contrib/snap
+ stage:
+ - dfu-tool.wrapper
+ - fwupd-command
+ - fwupdtool.wrapper
+ - fwupd.wrapper
+ - fwupdmgr.wrapper
diff -Nru fwupd-1.0.6/contrib/snap/update-mime/Makefile fwupd-1.2.10/contrib/snap/update-mime/Makefile
--- fwupd-1.0.6/contrib/snap/update-mime/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/snap/update-mime/Makefile 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,5 @@
+build:
+ true
+install:
+ update-mime-database ../install/usr/share/mime
+ glib-compile-schemas ../install/usr/share/glib-2.0/schemas
diff -Nru fwupd-1.0.6/contrib/standalone-installer/assets/header.py fwupd-1.2.10/contrib/standalone-installer/assets/header.py
--- fwupd-1.0.6/contrib/standalone-installer/assets/header.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/standalone-installer/assets/header.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,319 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2017 Dell, Inc.
+#
+# SPDX-License-Identifier: LGPL-2.1+
+#
+from base64 import b64decode
+import io
+import os
+import subprocess
+import sys
+import shutil
+import tempfile
+import zipfile
+TAG = b'#\x00'
+
+def parse_args():
+ import argparse
+ parser = argparse.ArgumentParser(description="Self extracting firmware updater")
+ parser.add_argument("--directory", help="Directory to extract to")
+ parser.add_argument("--cleanup", action='store_true', help="Remove tools when done with installation")
+ parser.add_argument("--verbose", action='store_true', help="Run the tool in verbose mode")
+ parser.add_argument("--allow-reinstall", action='store_true', help="Allow re-installing existing firmware versions")
+ parser.add_argument("--allow-older", action='store_true', help="Allow downgrading firmware versions")
+ parser.add_argument("command", choices=["install", "extract"], help="Command to run")
+ args = parser.parse_args()
+ return args
+
+def error (msg):
+ print(msg)
+ sys.exit(1)
+
+def bytes_slicer(length, source):
+ start = 0
+ stop = length
+ while start < len(source):
+ yield source[start:stop]
+ start = stop
+ stop += length
+
+def get_zip():
+ script = os.path.realpath (__file__)
+ bytes_out = io.BytesIO()
+ with open(script, 'rb') as source:
+ for line in source:
+ if not line.startswith(TAG):
+ continue
+ bytes_out.write(b64decode(line[len(TAG):-1]))
+ return bytes_out
+
+def unzip (destination):
+ zipf = get_zip ()
+ source = zipfile.ZipFile (zipf, 'r')
+ for item in source.namelist():
+ # extract handles the sanitization
+ source.extract (item, destination)
+
+def copy_cabs (source, target):
+ if not os.path.exists (target):
+ os.makedirs (target)
+ cabs = []
+ for root, dirs, files in os.walk (source):
+ for f in files:
+ if (f.endswith ('.cab')):
+ origf = os.path.join(root, f)
+ shutil.copy (origf, target)
+ cabs.append (os.path.join (target, f))
+ return cabs
+
+
+def install_snap (directory, verbose, allow_reinstall, allow_older, uninstall):
+ app = 'fwupd'
+ common = '/root/snap/%s/common' % app
+
+ #check if snap is installed
+ with open(os.devnull, 'w') as devnull:
+ subprocess.run (['snap'], check=True, stdout=devnull, stderr=devnull)
+
+ #check existing installed
+ cmd = ['snap', 'list', app]
+ with open(os.devnull, 'w') as devnull:
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd, stdout=devnull, stderr=devnull)
+ if ret.returncode == 0:
+ cmd = ['snap', 'remove', app]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, check=True)
+
+ # install the snap
+ cmd = ['snap', 'ack', os.path.join (directory, 'fwupd.assert')]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, check=True)
+ cmd = ['snap', 'install', '--classic', os.path.join (directory, 'fwupd.snap')]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, check=True)
+
+ # copy the CAB files
+ cabs = copy_cabs (directory, common)
+
+ # run the snap
+ for cab in cabs:
+ cmd = ["%s.fwupdmgr" % app, 'install', cab]
+ if allow_reinstall:
+ cmd += ["--allow-reinstall"]
+ if allow_older:
+ cmd += ["--allow-older"]
+ if verbose:
+ cmd += ["--verbose"]
+ print(cmd)
+ subprocess.run (cmd)
+
+ #remove copied cabs
+ for f in cabs:
+ os.remove(f)
+
+ #cleanup
+ if uninstall:
+ cmd = ['snap', 'remove', app]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd)
+
+def install_flatpak (directory, verbose, allow_reinstall, allow_older, uninstall):
+ app = 'org.freedesktop.fwupd'
+ common = '%s/.var/app/%s' % (os.getenv ('HOME'), app)
+
+ with open(os.devnull, 'w') as devnull:
+ if not verbose:
+ output = devnull
+ else:
+ output = None
+ #look for dependencies
+ dep = 'org.gnome.Platform/x86_64/3.30'
+ repo = 'flathub'
+ repo_url = 'https://flathub.org/repo/flathub.flatpakrepo'
+ cmd = ['flatpak', 'info', dep]
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd, stdout=output, stderr=output)
+ #not installed
+ if ret.returncode != 0:
+ #look for remotes
+ cmd = ['flatpak', 'remote-info', repo, dep]
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd, stdout=output, stderr=output)
+ #not enabled, enable it
+ if ret.returncode != 0:
+ cmd = ['flatpak', 'remote-add', repo, repo_url]
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd, stderr=output)
+ # install dep
+ cmd = ['flatpak', 'install', repo, dep]
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd)
+
+ #check existing installed
+ cmd = ['flatpak', 'info', app]
+ if verbose:
+ print(cmd)
+ ret = subprocess.run (cmd, stdout=output, stderr=output)
+ if ret.returncode == 0:
+ cmd = ['flatpak', 'remove', app]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, check=True)
+
+ #install the flatpak
+ cmd = ['flatpak', 'install', os.path.join (directory, 'fwupd.flatpak')]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, check=True)
+
+ # copy the CAB files
+ cabs = copy_cabs (directory, common)
+
+ #run command
+ for cab in cabs:
+ cmd = ['flatpak', 'run', app, 'install', cab]
+ if allow_reinstall:
+ cmd += ["--allow-reinstall"]
+ if allow_older:
+ cmd += ["--allow-older"]
+ if verbose:
+ cmd += ["--verbose"]
+ print(cmd)
+ subprocess.run (cmd)
+
+ #remove copied cabs
+ for f in cabs:
+ os.remove(f)
+
+ #cleanup
+ if uninstall:
+ cmd = ['flatpak', 'remove', app]
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd)
+
+# Check which package to use
+# - return False to use packaged version
+# - return True for snap/flatpak
+def use_included_version(minimum_version):
+ try:
+ import apt
+ except ModuleNotFoundError:
+ return True
+ cache = apt.Cache()
+ pkg = cache.get("fwupd")
+ version = pkg.installed
+ if not version:
+ return True
+ if minimum_version:
+ if minimum_version > version:
+ print("fwupd %s is already installed but this package requires %s" %
+ (version.version, minimum_version))
+ else:
+ print("New enough fwupd already installed")
+ return False
+ else:
+ print("fwupd %s is installed and must be removed" % version.version)
+ return remove_packaged_version(pkg, cache)
+
+def remove_packaged_version(pkg, cache):
+ res = False
+ while not res:
+ res = input("Remove now (Y/N)? ")
+ if res.lower() == 'n':
+ return False
+ if res.lower() == 'y':
+ break
+ res = False
+ pkg.mark_delete()
+ res = cache.commit()
+ if not res:
+ raise Exception("Need to remove packaged version")
+ return res
+
+def install_builtin(directory, verbose, allow_reinstall, allow_older):
+ cabs = []
+ for root, dirs, files in os.walk (directory):
+ for f in files:
+ if f.endswith('.cab'):
+ cabs.append(os.path.join(root, f))
+ #run command
+ for cab in cabs:
+ cmd = ['fwupdmgr', 'install', cab]
+ if allow_reinstall:
+ cmd += ["--allow-reinstall"]
+ if allow_older:
+ cmd += ["--allow-older"]
+ if verbose:
+ cmd += ["--verbose"]
+ print(cmd)
+ subprocess.run(cmd)
+
+def run_installation (directory, verbose, allow_reinstall, allow_older, uninstall):
+ try_snap = False
+ try_flatpak = False
+
+ #determine if a minimum version was specified
+ minimum_path = os.path.join(directory, "minimum")
+ minimum = None
+ if os.path.exists(minimum_path):
+ with open(minimum_path, "r") as rfd:
+ minimum = rfd.read()
+
+ if use_included_version(minimum):
+ install_builtin(directory, verbose, allow_reinstall, allow_older)
+ return
+
+ # determine what self extracting binary has
+ if os.path.exists (os.path.join (directory, 'fwupd.snap')) and \
+ os.path.exists (os.path.join (directory, 'fwupd.assert')):
+ try_snap = True
+ if os.path.exists (os.path.join (directory, 'fwupd.flatpak')):
+ try_flatpak = True
+
+ if try_snap:
+ try:
+ install_snap (directory, verbose, allow_reinstall, allow_older, uninstall)
+ return True
+ except Exception as _:
+ if verbose:
+ print ("Snap installation failed")
+ if not try_flatpak:
+ error ("Snap installation failed")
+ if try_flatpak:
+ install_flatpak (directory, verbose, allow_reinstall, allow_older, uninstall)
+
+if __name__ == '__main__':
+ args = parse_args()
+ if 'extract' in args.command:
+ if args.allow_reinstall:
+ error ("allow-reinstall argument doesn't make sense with command %s" % args.command)
+ if args.allow_older:
+ error ("allow-older argument doesn't make sense with command %s" % args.command)
+ if args.cleanup:
+ error ("Cleanup argument doesn't make sense with command %s" % args.command)
+ if args.directory is None:
+ error ("No directory specified")
+ if not os.path.exists (args.directory):
+ print ("Creating %s" % args.directory)
+ os.makedirs (args.directory)
+ unzip (args.directory)
+ else:
+ if args.directory:
+ error ("Directory argument %s doesn't make sense with command %s" % (args.directory, args.command))
+ if os.getuid() != 0:
+ error ("This tool must be run as root")
+ with tempfile.TemporaryDirectory (prefix='fwupd') as target:
+ unzip (target)
+ run_installation (target, args.verbose, args.allow_reinstall, args.allow_older, args.cleanup)
diff -Nru fwupd-1.0.6/contrib/standalone-installer/make.py fwupd-1.2.10/contrib/standalone-installer/make.py
--- fwupd-1.0.6/contrib/standalone-installer/make.py 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/standalone-installer/make.py 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,138 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2017 Dell, Inc.
+#
+# SPDX-License-Identifier: LGPL-2.1+
+#
+from base64 import b64encode
+import io
+import os
+import subprocess
+import shutil
+import sys
+import tempfile
+import zipfile
+from assets.header import TAG
+
+def error (msg):
+ print(msg)
+ sys.exit(1)
+
+def parse_args():
+ import argparse
+ parser = argparse.ArgumentParser(description="Generate a standalone firmware updater")
+ parser.add_argument("--disable-snap-download", action='store_true', help="Don't download support for snap")
+ parser.add_argument("--disable-flatpak-download", action='store_true', help="Don't download support for flatpak")
+ parser.add_argument("--snap-channel", help="Channel to download snap from (optional)")
+ parser.add_argument("--minimum", help="Use already installed fwupd version if at least this version")
+ parser.add_argument("cab", help="CAB file or directory containing CAB files to automatically install")
+ parser.add_argument('target', help='target file to create')
+ args = parser.parse_args()
+ return args
+
+def bytes_slicer(length, source):
+ start = 0
+ stop = length
+ while start < len(source):
+ yield source[start:stop]
+ start = stop
+ stop += length
+
+def generate_installer (directory, target):
+ asset_base = os.path.join (os.path.dirname(os.path.realpath(__file__)),
+ "assets")
+
+ #header
+ shutil.copy (os.path.join (asset_base, "header.py"), target)
+
+ #zip file
+ buffer = io.BytesIO()
+ archive = zipfile.ZipFile(buffer, "a")
+ for root, dirs, files in os.walk (directory):
+ for f in files:
+ source = os.path.join(root, f)
+ archive_fname = source.split (directory) [1]
+ archive.write(source, archive_fname)
+ if 'DEBUG' in os.environ:
+ print (archive.namelist())
+ archive.close()
+
+ with open (target, 'ab') as bytes_out:
+ encoded = b64encode(buffer.getvalue())
+ for section in bytes_slicer(64, encoded):
+ bytes_out.write(TAG)
+ bytes_out.write(section)
+ bytes_out.write(b'\n')
+
+def download_snap (directory, channel):
+ cmd = ['snap', 'download', 'fwupd']
+ if channel is not None:
+ cmd += ['--channel', channel]
+ if 'DEBUG' in os.environ:
+ print(cmd)
+ subprocess.run (cmd, cwd=directory, check=True)
+ for f in os.listdir (directory):
+ # the signatures associated with the snap
+ if f.endswith(".assert"):
+ shutil.move (os.path.join(directory, f), os.path.join(directory, 'fwupd.assert'))
+ # the snap binary itself
+ elif f.endswith(".snap"):
+ shutil.move (os.path.join(directory, f), os.path.join(directory, 'fwupd.snap'))
+
+def download_cab_file (directory, uri):
+ cmd = ['wget', uri]
+ if 'DEBUG' in os.environ:
+ print(cmd)
+ subprocess.run (cmd, cwd=directory, check=True)
+
+def download_flatpak (directory):
+ dep = 'org.freedesktop.fwupd'
+ flatpak_dir = os.path.join(os.getenv('HOME'),'.local', 'share', 'flatpak')
+ verbose = 'DEBUG' in os.environ
+
+ #check if we have installed locally already or not
+ if not os.path.exists (os.path.join (flatpak_dir, 'app', dep)):
+ # install into local user's repo
+ cmd = ['flatpak', 'install', '--user',
+ 'https://www.flathub.org/repo/appstream/org.freedesktop.fwupd.flatpakref', '--no-deps', '-y']
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, cwd=directory, check=True)
+
+ # generate a bundle
+ repo = os.path.join(flatpak_dir, 'repo')
+ cmd = ['flatpak', 'build-bundle', repo, 'fwupd.flatpak', dep, 'stable']
+ if verbose:
+ print(cmd)
+ subprocess.run (cmd, cwd=directory, check=True)
+
+if __name__ == '__main__':
+ args = parse_args()
+
+ if not args.cab.startswith("http"):
+ local = args.cab
+
+ with tempfile.TemporaryDirectory (prefix='fwupd') as directory:
+ if local:
+ if not os.path.exists (local):
+ error ("%s doesn't exist" % local)
+ if not os.path.isdir(local):
+ shutil.copy (local, directory)
+ else:
+ for root, dirs, files in os.walk(local):
+ for f in files:
+ shutil.copy (os.path.join(root, f), directory)
+ else:
+ download_cab_file (directory, args.cab)
+
+ if not args.disable_snap_download:
+ download_snap (directory, args.snap_channel)
+
+ if not args.disable_flatpak_download:
+ download_flatpak (directory)
+
+ if args.minimum:
+ with open(os.path.join(directory, "minimum"), "w") as wfd:
+ wfd.write(args.minimum)
+
+ generate_installer (directory, args.target)
diff -Nru fwupd-1.0.6/contrib/standalone-installer/README.md fwupd-1.2.10/contrib/standalone-installer/README.md
--- fwupd-1.0.6/contrib/standalone-installer/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/standalone-installer/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,9 @@
+# Standalone installer
+
+This is a script that will build a standalone installer around the fwupd snap or flatpak.
+This can be used for distributing updates that use fwupd on machines without networking and the needed tools.
+
+For usage instructions, view:
+```
+./make.py --help
+```
diff -Nru fwupd-1.0.6/contrib/vscode/build.sh fwupd-1.2.10/contrib/vscode/build.sh
--- fwupd-1.0.6/contrib/vscode/build.sh 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/vscode/build.sh 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright (C) 2018 Dell, Inc.
+
+SOURCE=$(dirname $0)
+ROOT=$1
+if [ -z "$ROOT" ]; then
+ ROOT=`pwd`
+fi
+
+# build in tree
+rm -rf build ${ROOT}/dist
+meson build --prefix=${ROOT}/dist -Dsystemd=false -Dudevdir=${ROOT}/dist
+ninja -C build install
+
+#create helper scripts
+TEMPLATE=${SOURCE}/launcher.sh
+sed "s,#ROOT#,${ROOT},; s,#EXECUTABLE#,libexec/fwupd/fwupd," \
+ ${TEMPLATE} > ${ROOT}/dist/fwupd.sh
+sed "s,#ROOT#,${ROOT},; s,#EXECUTABLE#,libexec/fwupd/fwupdtool," \
+ ${TEMPLATE} > ${ROOT}/dist/fwupdtool.sh
+sed "s,#ROOT#,${ROOT},; s,#EXECUTABLE#,bin/fwupdmgr," \
+ ${TEMPLATE} > ${ROOT}/dist/fwupdmgr.sh
+chmod +x ${ROOT}/dist/*.sh
+
+#create debugging targets
+TARGET=${ROOT}/.vscode
+mkdir -p ${TARGET}
+if [ -f ${TARGET}/launch.json ]; then
+ echo "${TARGET}/launch.json already exists, not overwriting"
+else
+ cp ${SOURCE}/launch.json ${TARGET}
+fi
diff -Nru fwupd-1.0.6/contrib/vscode/launcher.sh fwupd-1.2.10/contrib/vscode/launcher.sh
--- fwupd-1.0.6/contrib/vscode/launcher.sh 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/vscode/launcher.sh 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,8 @@
+#!/bin/sh
+export ROOT=#ROOT#
+export FWUPD_LOCALSTATEDIR=${ROOT}/dist
+export FWUPD_SYSCONFDIR=${ROOT}/dist/etc
+if [ -n "${DEBUG}" ]; then
+ DEBUG="gdbserver localhost:9091"
+fi
+${DEBUG} ${ROOT}/dist/#EXECUTABLE# "$@"
diff -Nru fwupd-1.0.6/contrib/vscode/launch.json fwupd-1.2.10/contrib/vscode/launch.json
--- fwupd-1.0.6/contrib/vscode/launch.json 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/vscode/launch.json 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,68 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "gdbserver (fwupdtool)",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/dist/libexec/fwupd/fwupdtool",
+ "args": [],
+ "stopAtEntry": false,
+ "cwd": "${workspaceFolder}",
+ "environment": [],
+ "miDebuggerServerAddress": "localhost:9091",
+ "externalConsole": false,
+ "MIMode": "gdb",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ }
+ ]
+ },
+ {
+ "name": "gdbserver (fwupd)",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/dist/libexec/fwupd/fwupd",
+ "args": [],
+ "stopAtEntry": false,
+ "cwd": "${workspaceFolder}",
+ "environment": [],
+ "miDebuggerServerAddress": "localhost:9091",
+ "externalConsole": false,
+ "MIMode": "gdb",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ }
+ ]
+ },
+ {
+ "name": "gdbserver (fwupdmgr)",
+ "type": "cppdbg",
+ "request": "launch",
+ "program": "${workspaceFolder}/dist/bin/fwupdmgr",
+ "args": [],
+ "stopAtEntry": false,
+ "cwd": "${workspaceFolder}",
+ "environment": [],
+ "miDebuggerServerAddress": "localhost:9091",
+ "externalConsole": false,
+ "MIMode": "gdb",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ }
+ ]
+ },
+ ]
+}
diff -Nru fwupd-1.0.6/contrib/vscode/README.md fwupd-1.2.10/contrib/vscode/README.md
--- fwupd-1.0.6/contrib/vscode/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/contrib/vscode/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,39 @@
+# Using Visual Studio Code to debug
+
+This directory contains a collection of scripts and assets to make debugging using Visual Studio Code easier.
+
+## Preparing
+First install the following applications locally:
+* GDB Server
+* GDB
+* Visual Studio Code
+
+In Visual Studio code, visit the extension store and install *C/C++* which is an extension provided by Microsoft.
+Configure Visual Studio code to open the folder representing the root of the fwupd checkout.
+
+## Building
+Run `./contrib/debugging/build.sh` to build fwupd with all default options and create helper scripts pre-configured for debugger use.
+The application will be placed into `./dist` and helper scripts will be created for `fwupdtool`, `fwupdmgr`, and `fwupd`.
+
+## Running
+To run any of the applications, execute the appropriate helper script in `./dist`.
+
+## Debugging
+To debug any of the applications, launch the helper script with the environment variable `DEBUG` set.
+For example to debug `fwupdtool get-devices` the command to launch would be:
+
+```
+sudo DEBUG=1 ./dist/fwupdtool.sh get-devices
+```
+
+This will configure `gdbserver` to listen on a local port waiting for a debugger to connect.
+
+## Using Visual Studio code
+During build time a set of launch targets will have been created for use with Visual Studio Code.
+
+Press the debugging button on the left and 3 targets will be listed at the top.
+* gdbserver (fwupdtool)
+* gdbserver (fwupd)
+* gdbserver (fwupdmgr)
+
+Select the appropriate target and press the green arrow to connect to `gdbserver` and start debugging.
diff -Nru fwupd-1.0.6/CONTRIBUTING.md fwupd-1.2.10/CONTRIBUTING.md
--- fwupd-1.0.6/CONTRIBUTING.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/CONTRIBUTING.md 2019-07-15 18:25:54.000000000 +0000
@@ -18,7 +18,7 @@
* Prefer descriptive names over abbreviations (unless well-known)
and shortening of names. e.g `device` not `dev`
- * Single statments inside if/else should not be enclosed by '{}'
+ * Single statements inside if/else should not be enclosed by '{}'
* Use comments to explain why something is being done, but also avoid
over-documenting the obvious. Here is an example of useless comment:
diff -Nru fwupd-1.0.6/COPYING fwupd-1.2.10/COPYING
--- fwupd-1.0.6/COPYING 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/COPYING 2019-07-15 18:25:54.000000000 +0000
@@ -1,221 +1,397 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
-Activities other than copying, distribution and modification are not
+ Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
- a) You must cause the modified files to carry prominent notices
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
+identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
+on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
+entire whole, and thus to each and every part regardless of who wrote
+it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
-collective works based on the Program.
+collective works based on the Library.
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
- 5. You are not required to accept this License, since you have not
+ 9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
+distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
+the Library or works based on it.
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
+
+ 11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
+refrain entirely from distribution of the Library.
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
+integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
@@ -226,114 +402,101 @@
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
- 8. If the distribution and/or use of the Program is restricted in
+ 12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
NO WARRANTY
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
-
+
Copyright (C)
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
+school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
- , 1 April 1989
+ , 1 April 1990
Ty Coon, President of Vice
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
+That's all there is to it!
diff -Nru fwupd-1.0.6/data/90-fwupd-devices.rules fwupd-1.2.10/data/90-fwupd-devices.rules
--- fwupd-1.0.6/data/90-fwupd-devices.rules 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/90-fwupd-devices.rules 2019-07-15 18:25:54.000000000 +0000
@@ -1,12 +1,8 @@
########################################################################
# Copyright (C) 2015 Richard Hughes
#
-# Licensed under the GNU General Public License Version 2
+# SPDX-License-Identifier: LGPL-2.1+
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
# VIA USB 3.0 VL811 Hub
SUBSYSTEM=="usb", DRIVER=="hub", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="0810", ENV{FWUPD_GUID}="adbb9034-b577-42c2-a661-1ee4f49ef64c", ENV{FWUPD_VENDOR}="VIA", ENV{FWUPD_MODEL}="USB 3.0 VL811 Hub"
@@ -25,3 +21,6 @@
# PCI cards with ROM
SUBSYSTEM=="pci", TEST=="/sys$devpath/rom", ENV{FWUPD_GUID}="$attr{vendor}:$attr{device}"
+
+# NVMe hardware
+SUBSYSTEM=="nvme", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{builtin}="hwdb --subsystem=pci"
diff -Nru fwupd-1.0.6/data/bash-completion/fwupdagent fwupd-1.2.10/data/bash-completion/fwupdagent
--- fwupd-1.0.6/data/bash-completion/fwupdagent 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/bash-completion/fwupdagent 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,37 @@
+_fwupdagent_cmd_list=(
+ 'get-devices'
+)
+
+_fwupdagent_opts=(
+ '--verbose'
+)
+
+_show_modifiers()
+{
+ COMPREPLY+=( $(compgen -W '${_fwupdagent_opts[@]}' -- "$cur") )
+}
+
+_fwupdagent()
+{
+ local cur prev command
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ command=${COMP_WORDS[1]}
+
+ case $command in
+ *)
+ #find first command
+ if [[ ${COMP_CWORD} = 1 ]]; then
+ COMPREPLY=( $(compgen -W '${_fwupdagent_cmd_list[@]}' -- "$cur") )
+ #modifiers for all commands
+ else
+ _show_modifiers
+ fi
+ ;;
+ esac
+
+ return 0
+}
+
+complete -F _fwupdagent fwupdagent
diff -Nru fwupd-1.0.6/data/bash-completion/fwupdmgr fwupd-1.2.10/data/bash-completion/fwupdmgr
--- fwupd-1.0.6/data/bash-completion/fwupdmgr 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/bash-completion/fwupdmgr 2019-07-15 18:25:54.000000000 +0000
@@ -1,24 +1,26 @@
_fwupdmgr_cmd_list=(
- 'build-firmware'
+ 'activate'
'clear-history'
'clear-offline'
'clear-results'
+ 'disable-remote'
'downgrade'
+ 'enable-remote'
+ 'get-approved-firmware'
'get-details'
'get-devices'
'get-history'
'get-releases'
'get-remotes'
'get-results'
+ 'get-topology'
'get-updates'
- 'hwids'
'install'
- 'install-prepared'
+ 'modify-config'
'modify-remote'
- 'monitor'
'refresh'
'report-history'
- 'smbios-dump'
+ 'set-approved-firmware'
'unlock'
'update'
'verify'
@@ -33,9 +35,12 @@
'--allow-older'
'--force'
'--assume-yes'
+ '--no-history'
'--no-unreported-check'
'--no-metadata-check'
'--no-reboot-check'
+ '--show-all-devices'
+ '--sign'
)
_show_modifiers()
@@ -69,14 +74,14 @@
command=${COMP_WORDS[1]}
case $command in
- clear-results|downgrade|get-releases|get-results|unlock|verify|verify-update)
+ activate|clear-results|downgrade|get-releases|get-results|unlock|verify|verify-update)
if [[ "$prev" = "$command" ]]; then
_show_device_ids
else
_show_modifiers
fi
;;
- get-details|smbios-dump)
+ get-details)
#browse for file
if [[ "$prev" = "$command" ]]; then
_filedir
@@ -107,35 +112,39 @@
local keys
keys="$(command fwupdmgr get-remotes | command awk -v pattern="Remote ID:.*${prev}$" '$0~pattern{show=1; next}/Remote/{show=0}{gsub(/:.*/,"")}show')"
COMPREPLY+=( $(compgen -W "${keys}" -- "$cur") )
+ #modifiers
+ else
+ _show_modifiers
fi
;;
- refresh)
- #find first file
+ enable-remote)
+ #find remotes
+ if [[ "$prev" = "$command" ]]; then
+ _show_remotes
+ #modifiers
+ else
+ _show_modifiers
+ fi
+ ;;
+ disable-remote)
+ #find remotes
if [[ "$prev" = "$command" ]]; then
- _filedir
- #find second file
- elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
- _filedir
- #find remote ID
- elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then
_show_remotes
+ #modifiers
else
_show_modifiers
fi
;;
- build-firmware)
- #file in
+ refresh)
+ #find first file
if [[ "$prev" = "$command" ]]; then
_filedir
- #file out
+ #find second file
elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
_filedir
- #script
+ #find remote ID
elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then
- _filedir
- #output
- elif [[ "$prev" = "${COMP_WORDS[4]}" ]]; then
- _filedir
+ _show_remotes
else
_show_modifiers
fi
diff -Nru fwupd-1.0.6/data/bash-completion/fwupdtool.in fwupd-1.2.10/data/bash-completion/fwupdtool.in
--- fwupd-1.0.6/data/bash-completion/fwupdtool.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/bash-completion/fwupdtool.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,111 @@
+_fwupdtool_cmd_list=(
+ 'activate'
+ 'build-firmware'
+ 'get-updates'
+ 'get-details'
+ 'get-devices'
+ 'get-history'
+ 'get-plugins'
+ 'get-topology'
+ 'hwids'
+ 'update'
+ 'install'
+ 'install-blob'
+ 'monitor'
+ 'self-sign'
+ 'smbios-dump'
+ 'attach'
+ 'detach'
+ 'verify-update'
+ 'watch'
+)
+
+_fwupdtool_opts=(
+ '--verbose'
+ '--enable-json-state'
+ '--allow-reinstall'
+ '--allow-older'
+ '--force'
+ '--show-all-devices'
+ '--plugin-whitelist'
+ '--prepare'
+ '--cleanup'
+)
+
+_show_plugins()
+{
+ local plugins
+ plugins="$(command @libexecdir@/fwupdtool get-plugins 2>/dev/null)"
+ COMPREPLY+=( $(compgen -W "${plugins}" -- "$cur") )
+}
+
+_show_modifiers()
+{
+ COMPREPLY+=( $(compgen -W '${_fwupdtool_opts[@]}' -- "$cur") )
+}
+
+_fwupdtool()
+{
+ local cur prev command
+ COMPREPLY=()
+ cur=`_get_cword`
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ command=${COMP_WORDS[1]}
+
+ case $prev in
+ --plugin-whitelist)
+ _show_plugins
+ return 0
+ ;;
+ esac
+
+ case $command in
+ get-details|install|install-blob)
+ #find files
+ if [[ "$prev" = "$command" ]]; then
+ _filedir
+ #modifiers
+ else
+ _show_modifiers
+ fi
+ ;;
+ attach|detach|activate|verify-update)
+ if [[ "$prev" = "$command" ]]; then
+ _show_device_ids
+ #modifiers
+ else
+ _show_modifiers
+ fi
+ ;;
+ build-firmware)
+ #file in
+ if [[ "$prev" = "$command" ]]; then
+ _filedir
+ #file out
+ elif [[ "$prev" = "${COMP_WORDS[2]}" ]]; then
+ _filedir
+ #script
+ elif [[ "$prev" = "${COMP_WORDS[3]}" ]]; then
+ _filedir
+ #output
+ elif [[ "$prev" = "${COMP_WORDS[4]}" ]]; then
+ _filedir
+ else
+ _show_modifiers
+ fi
+ ;;
+ *)
+ #find first command
+ if [[ ${COMP_CWORD} = 1 ]]; then
+ COMPREPLY=( $(compgen -W '${_fwupdtool_cmd_list[@]}' -- "$cur") )
+ #modifiers for all commands
+ else
+ _show_modifiers
+ fi
+ ;;
+ esac
+
+ return 0
+}
+
+complete -F _fwupdtool fwupdtool
diff -Nru fwupd-1.0.6/data/bash-completion/meson.build fwupd-1.2.10/data/bash-completion/meson.build
--- fwupd-1.0.6/data/bash-completion/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/bash-completion/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,5 +1,30 @@
-install_data([
- 'fwupdmgr',
- ],
- install_dir : 'share/bash-completion/completions/',
-)
+if bashcomp.found()
+ tgt = bashcomp.get_pkgconfig_variable('completionsdir',
+ define_variable: [ 'prefix', prefix ],
+ )
+
+
+if get_option('daemon')
+ install_data(['fwupdmgr'],
+ install_dir : tgt,
+ )
+endif
+
+if get_option('agent')
+ install_data(['fwupdagent'],
+ install_dir : tgt,
+ )
+endif
+
+# replace @libexecdir@
+fwupdtool_path = join_paths(libexecdir, 'fwupd')
+con2 = configuration_data()
+con2.set('libexecdir', fwupdtool_path)
+configure_file(
+ input : 'fwupdtool.in',
+ output : 'fwupdtool',
+ configuration : con2,
+ install: true,
+ install_dir: tgt)
+
+endif
diff -Nru fwupd-1.0.6/data/builder/README.md fwupd-1.2.10/data/builder/README.md
--- fwupd-1.0.6/data/builder/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/builder/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -37,7 +37,7 @@
then the plugin can write to this directory and the startup.sh script will be
able to access it as the chroot-ed `/boot`.
-Firmware `.cab` files using this funtionality should list the `.tar` file:
+Firmware `.cab` files using this functionality should list the `.tar` file:
diff -Nru fwupd-1.0.6/data/daemon.conf fwupd-1.2.10/data/daemon.conf
--- fwupd-1.0.6/data/daemon.conf 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/daemon.conf 2019-07-15 18:25:54.000000000 +0000
@@ -10,3 +10,15 @@
# Maximum archive size that can be loaded in Mb, with 0 for the default
ArchiveSizeMax=0
+
+# Idle time in seconds to shut down the daemon -- note some plugins might
+# inhibit the auto-shutdown, for instance thunderbolt.
+#
+# A value of 0 specifies 'never'
+IdleTimeout=7200
+
+# Comma separated list of domains to log in verbose mode
+# If unset, no domains
+# If set to FuValue, FuValue domain (same as --domain-verbose=FuValue)
+# If set to *, all domains (same as --verbose)
+VerboseDomains=
diff -Nru fwupd-1.0.6/data/fwupd-offline-update.service.in fwupd-1.2.10/data/fwupd-offline-update.service.in
--- fwupd-1.0.6/data/fwupd-offline-update.service.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/fwupd-offline-update.service.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,8 +1,13 @@
[Unit]
Description=Updates device firmware whilst offline
Documentation=man:fwupdmgr
-OnFailure=reboot.target
-ConditionPathExists=/var/lib/fwupd/pending.db
+ConditionPathExists=@localstatedir@/lib/fwupd/pending.db
+DefaultDependencies=false
+Requires=sysinit.target dbus.socket
+After=sysinit.target system-update-pre.target dbus.socket systemd-journald.socket
+Before=shutdown.target system-update.target
[Service]
-ExecStart=@bindir@/fwupdmgr install-prepared
+Type=oneshot
+ExecStart=@libexecdir@/fwupd/fwupdoffline
+FailureAction=reboot
diff -Nru fwupd-1.0.6/data/fwupd.service.in fwupd-1.2.10/data/fwupd.service.in
--- fwupd-1.0.6/data/fwupd.service.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/fwupd.service.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,20 +1,16 @@
[Unit]
Description=Firmware update daemon
-Documentation=http://www.fwupd.org/
+Documentation=https://fwupd.org/
After=dbus.service
-Before=gdm.service
+Before=display-manager.service
[Service]
Type=dbus
BusName=org.freedesktop.fwupd
ExecStart=@libexecdir@/fwupd/fwupd
-MemoryDenyWriteExecute=yes
PrivateTmp=yes
-ProtectControlGroups=yes
ProtectHome=yes
-ProtectKernelModules=yes
ProtectSystem=full
RestrictAddressFamilies=AF_NETLINK AF_UNIX
-RestrictRealtime=yes
-ReadWritePaths=@localstatedir@/lib/fwupd @sysconfdir@/fwupd/remotes.d -@bootdir@
SystemCallFilter=~@mount
+@dynamic_options@
diff -Nru fwupd-1.0.6/data/fwupd.shutdown.in fwupd-1.2.10/data/fwupd.shutdown.in
--- fwupd-1.0.6/data/fwupd.shutdown.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/fwupd.shutdown.in 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# no history database exists
+[ -f @localstatedir@/lib/fwupd/pending.db ] || exit 0
+
+# activate firmware when we have a read-only filesysten
+@libexecdir@/fwupd/fwupdtool activate
Binary files /tmp/tmpQQbJCR/7rYBbtNFzp/fwupd-1.0.6/data/installed-tests/firmware-example.xml.gz and /tmp/tmpQQbJCR/GMbZcPqOnn/fwupd-1.2.10/data/installed-tests/firmware-example.xml.gz differ
diff -Nru fwupd-1.0.6/data/installed-tests/firmware-example.xml.gz.asc fwupd-1.2.10/data/installed-tests/firmware-example.xml.gz.asc
--- fwupd-1.0.6/data/installed-tests/firmware-example.xml.gz.asc 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/installed-tests/firmware-example.xml.gz.asc 1970-01-01 00:00:00.000000000 +0000
@@ -1,11 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.14 (GNU/Linux)
-
-iQEcBAABAgAGBQJZQqy+AAoJEEim2A5FOLrCjuEH/1wIRvQ9FIUqQ2wV5pQRjF99
-wTd1+VtQCPHkBXvMnrF2cnhNhr13lN8BhuY3kgT9TGQCPNM+8akNvDLKWiR/39rP
-z+v6KpgaYA5kghFskvW4t/1lQ+Jj+PKExb1bAusexdVvRD1iEDZ0q8u/DRGwrjYn
-GFbHD3K91B4nIzYQVHa8+9gRRH2uKa2U9foH3++e/PAPQCoGHa6gxV3zM05AiEpA
-Am5G5u8v5WnL9W9H53unj9M47iAlzdxStzK4poshlJoNITLw9SLl6rmrgMYLHVfD
-QyZTM8jSjFc+V1swslLNMVCkCWfx3ClzkEff50HKua/BxMxxJscShX43On59cik=
-=XhuO
------END PGP SIGNATURE-----
diff -Nru fwupd-1.0.6/data/installed-tests/fwupdmgr.sh fwupd-1.2.10/data/installed-tests/fwupdmgr.sh
--- fwupd-1.0.6/data/installed-tests/fwupdmgr.sh 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/installed-tests/fwupdmgr.sh 2019-07-15 18:25:54.000000000 +0000
@@ -9,8 +9,8 @@
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
# ---
-echo "Refreshing with dummy metadata..."
-fwupdmgr refresh ${dirname}/firmware-example.xml.gz ${dirname}/firmware-example.xml.gz.asc lvfs
+echo "Enabling fwupd-tests remote..."
+fwupdmgr enable-remote fwupd-tests
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
# ---
@@ -20,7 +20,7 @@
# ---
echo "Getting devices (should be one)..."
-fwupdmgr get-devices
+fwupdmgr get-devices --no-unreported-check
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
# ---
diff -Nru fwupd-1.0.6/data/installed-tests/fwupd-tests.xml fwupd-1.2.10/data/installed-tests/fwupd-tests.xml
--- fwupd-1.0.6/data/installed-tests/fwupd-tests.xml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/installed-tests/fwupd-tests.xml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,77 @@
+
+
+
+ fakedevice.firmware
+ FakeDevice Firmware
+ Firmware for the ACME Corp Integrated Webcam
+ ACME Corp
+ GPL-2.0+
+
Updating the firmware on your webcam device improves performance and adds new features.
Prompt for reboot when unlocking on the command line if applicable
+
Show devices with an UpdateError in get-devices output
+
Support empty proxy server strings
+
Try harder to find duplicate UEFI boot entries
+
+
+
+
+
+
This release adds the following features:
+
+
Add support for Synaptics Prometheus fingerprint readers
+
Check if VersionFormat is ambiguous when adding devices
+
Check the daemon version is at least the client version
+
Export the version-format used by devices to clients
+
Set the version format for more device types
+
+
This release fixes the following bugs:
+
+
Allow using --force to trigger a duplicate offline update
+
Be smarter about existing installed fwupd when using standalone-installer
+
Correctly identify DFU firmware that starts at offset zero
+
Display the remote warning on the console in an easy-to-read way
+
Fix a libasan failure when reading a UEFI variable
+
Never guess the version format from the version string
+
Only use class-based instance IDs for quirk matching
+
Prompt the user to shutdown if requried when installing by ID
+
Reset the forced version during DFU attach and detach
+
+
+
+
+
+
This release adds the following features:
+
+
Allow the fwupdmgr tool to modify the daemon config
+
+
This release fixes the following bugs:
+
+
Correctly parse DFU interfaces with extra vendor-specific data
+
Do not report transient or invalid system failures
+
Fix problems with the version format checking for some updates
+
+
+
+
+
+
This release adds the following features:
+
+
Add a component categories to express the firmware type
+
Add support for 8BitDo M30
+
Add support for the not-child extension from Logitech
+
Shut down the daemon if the on-disk binary is replaced
+
+
This release fixes the following bugs:
+
+
Blacklist the synapticsmst plugin when using amdgpu
+
Correct ATA activation functionality to work for all vendors
+
Implement QMI PDC active config selection for modems
+
Make an error message clearer when there are no updates available
+
Match the old or new version number when setting NEEDS_REBOOT
+
More carefully check the output from tpm2_pcrlist
+
Recreate the history database if migration failed
+
Require AC power when updating Thunderbolt devices
+
Require --force to install a release with a different version format
+
Save history from firmware installed with fwupdtool
+
+
+
+
+
+
This release adds the following features:
+
+
Add a plugin to support modem hardware
+
Add support for delayed activation of docks and ATA devices
+
Add support for reading the SuperIO device checksum and writing to e-flash
+
Add the fwupdagent binary for use in shell scripts
+
Allow restricting firmware updates for enterprise use
+
Allow signing the fwupd report with a client certificate
+
Use Plymouth when updating offline firmware
+
+
This release fixes the following bugs:
+
+
Allow forcing an offline-only update on a live system using --force
+
Allow running offline updates when in system-update.target
+
Ask to reboot after scheduling an offline firmware update
+
Correctly check the new version for devices that replug
+
Do not fail to start the daemon if tpm2_pcrlist hangs
+
Do not fail when scheduling more than one update to be run offline
+
Do not let failing to find DBus prevent fwuptool from starting
+
Do not schedule an update on battery power if it requires AC power
+
Include all device checksums in the LVFS report
+
Rename the shimx64.efi binary for known broken firmware
+
Upload the UPDATE_INFO entry for the UEFI UX capsule
+
+
+
+
+
+
This release adds the following features:
+
+
Allow a device to be updated using more than one plugin
+
Report the DeviceInstanceIDs from fwupdmgr when run as root
+
+
This release fixes the following bugs:
+
+
Add an extra check for Dell NVMe drives to avoid false positives
+
Call composite prepare and cleanup using fwupdtool
+
Correct handling of CAB files with nested directories
+
Detect and special case Dell ATA hardware
+
Do not fail fwupdtool if dbus is unavailable
+
Do not unconditionally enable Werror for the EFI binary
+
Fill holes when reading SREC files
+
Filter the last supported payloads of certain Dell docks
+
Fix flashing failure with latest Intuos Pro tablet
+
Fix potential segfault when applying UEFI updates
+
Fix unifying regression when recovering from failed flash
+
+
+
+
+
+
This release adds the following features:
+
+
Add a directory remote that generates metadata
+
Add a new remote type "directory"
+
Add a plugin to update Wacom embedded EMR and AES panels
+
Add a plugin to upgrade firmware on ATA-ATAPI hardware
+
Add a quirk to use the legacy bootmgr description
+
Add flag to support manually aligning the NVMe firmware to the FWUG value
+
Add SuperIO IT89xx device support
+
Add support for Dell dock passive flow
+
Add 'update' and 'get-updates' commands to fwupdtool
+
Allow Dell dock flashing Thunderbolt over I2C
+
Check the battery percentage before flashing
+
Show a per-release source and details URL
+
Show a `UpdateMessage` and display it in tools
+
+
This release fixes the following bugs:
+
+
Add the needs-shutdown quirk to Phison NVMe drives
+
Correct Nitrokey Storage invalid firmware version read
+
Do not check the BGRT status before uploading a UX capsule
+
Do the UEFI UX checksum calculation in fwupd
+
Fix flashing various Jabra devices
+
Fix the parser to support extended segment addresses
+
Flash the fastboot partition after downloading the file
+
Show a console warning if loading an out-of-tree plugin
+
Support FGUID to get the SKU GUID for NVMe hardware
+
+
+
+
+
+
This release fixes the following bug:
+
+
Correctly migrate the history database
+
+
+
+
+
+
This release adds the following features:
+
+
Add support for devices that support fastboot
+
Add more standard USB identifier GUIDs
+
Add new API to get the release protocol from the metadata
+
Add the PCR0 value as the device checksum for system firmware
+
Include the device firmware checksum and update protocol in the report
+
+
This release fixes the following bugs:
+
+
Add Dell TB18DC to the supported devices list
+
Allow replacing the last byte in the image when using 'dfu-tool replace-data'
+
Append the UEFI capsule header in userspace rather than in the loader
+
Check the device checksum as well as the content checksum during verify
+
Correctly parse format the version numbers correctly using old metadata
+
Fix a crash if AMT returns an empty response
+
Fix a regression when doing GetReleases on unsupported hardware
+
Fix the 8bitdo version number if the daemon locale is not C.UTF-8
+
Remove the Wacom DTH generation hardware from the whitelist
+
Sanitize the version if the version format has been specified
+
+
+
+
+
+
This release adds the following features:
+
+
Add per-release install duration values
+
Shut down the daemon after 2h of inactivity when possible
+
+
This release fixes the following bugs:
+
+
Fix a use-after-free when using --immediate-exit
+
Fix flashing the 8bitdo SF30
+
Fix showing the custom remote agreements
+
Include the os-release information in the release metadata
+
Speed up startup by loading less thunderbolt firmware
+
Speed up startup by using a silo index for GUID queries
+
Use less memory and fragment the heap less when starting
+
+
+
+
+
+
This release adds the following features:
+
+
Add a plugin for an upcoming Dell USB-C dock
+
Add a standalone installer creation script
+
Add support for devices to show an estimated flash time
+
Add support for some new Realtek USB devices
+
Allow firmware files to depend on versions from other devices
+
Allow setting the version format from a quirk entry
+
Port from libappstream-glib to libxmlb for a large reduction in RSS
+
Stop any running daemon over dbus when using fu-tool
+
Support the Intel ME version format
+
+
This release fixes the following bugs:
+
+
Add version format quirks for several Lenovo machines
+
Adjust panamera ESM update routine for some reported issues
+
Adjust synapticsmst EVB board handling
+
Check the amount of free space on the ESP
+
Don't show devices pending a reboot in GetUpgrades
+
Ensure that parent ID is created before creating quirked children
+
Optionally wait for replug before updating a device
+
Set the full AMT device version including the BuildNum
+
Sort the firmware sack by component priority
+
Stop showing errors when no Dell dock plugged in
+
Stop showing the current release during updates in fwupdmgr
+
Update all sub-devices for a composite update
+
Use HTTPS_PROXY if set
+
+
+
+
+
+
This release adds the following features:
+
+
+ Add a new device flag 'ignore-validation' that will
+ override checks
+
+
Add a new plugin to enumerate EC firmware
+
Add a new plugin to update NVMe hardware
+
Add a plugin for updating using the flashrom command line tool
+
Allow the device list to take care of waiting for the device replug
+
Allow updating just one specific device from the command line
+
Allow upgrades using a self-signed fwupd.efi binary
+
Download firmware if the user specifies a URI
+
Include serial number in daemon device output when trusted
+
Notify all plugins of device removals through a new vfunc
+
Use boltd force power API if available
+
+
This release fixes the following bugs:
+
+
Add an install hook for classic snap
+
Allow forcing installation even if no AC power is applied
+
Allow using --force to ignore version_lowest
+
Always use the same HardwareIDs as Windows
+
Check the device state before assuming a fake DFU runtime
+
Copy over parent GUIDs from other plugin donors
+
Detect location of python3 interpreter
+
Do not add udev devices after a small delay
+
Don't fail to run if compiled without GPG/PKCS7
+
Fix a segfault in fwupdtool caused by cleanup of USB plugins
+
Implement the systemd recommendations for offline updates
+
Improve performance when reading keys from the quirk database
+
Remove children of devices when the parent is removed
+
Rewrite synapticsmst to use modern error handling
+
+ Rewrite the unifying plugin to use the new daemon-provided
+ functionality
+
+
Show a time estimate on the progressbar after an update has started
+
+
+
+
+
+
This release adds the following features:
+
+
Add support for the Synaptics Panamera hardware
+
Add validation for Alpine and Titan Ridge
+
Improve the Redfish plugin to actually work with real hardware
+
+
This release fixes the following bugs:
+
+
Allow different plugins to add the same device
+
Allow flashing unifying devices in recovery mode
+
Allow running synapticsmst on non-Dell hardware
+
Check the ESP for sanity at startup
+
Do not hold hidraw devices open forever
+
Don't override _FORTIFY_SOURCE when building the EFI binary
+
Don't show passwords in fwupdmgr
+
Fix a potential segfault in smbios data parsing
+
Fix encoding the GUID into the capsule EFI variable
+
Fix various bugs when reading the thunderbolt version number
+
Reboot synapticsmst devices at the end of flash cycle
+
Show status messages when the daemon is initializing
+
Show the correct title when updating devices
+
Show the reasons that plugins are not run on the CLI
+
Use localedir in po/make-images
+
+
+
+
+
+
This release adds the following features:
+
+
Add a initial Redfish support
+
Add a tool to mimic the original fwupdate CLI interface
+
Allow devices to assign a plugin from the quirk subsystem
+
Change the quirk file structure to be more efficient
+
Merge fwupdate functionality into fwupd
+
+ Run a plugin vfunc before and after all the composite devices are
+ updated
+
+
Support more Wacom tablets
+
+
This release fixes the following bugs:
+
+
Add release information for locked devices
+
Allow building with older meson
+
Detect the EFI system partition location at runtime
+
Do not use 8bitdo bootloader commands after a successful flash
+
Enable accessing downloaded files in flatpak and snap
+
Fix a potential buffer overflow when applying a DFU patch
+
Fix downgrading older releases to devices
+
Fix flashing devices that require a manual replug
+
Fix several small memory leaks in various places
+
Fix the retrieval of Redfish version
+
Fix unifying failure to detach when using a slow host controller
+
Set the Wacom device status when erasing and writing firmware
+
Show errors in the CLI if unable to access directory
+
Use the parent device name for Wacom sub-modules
+
+
+
+
+
+
This release adds the following features:
+
+
Add a plugin to update some future Wacom tablets
+
Add 'fwupdmgr get-topology' to show logical device tree
+
Add support for creating a flatpak
+
Add support for creating a snap
+
Add support for Motorola S-record files
+
Add the Linux Foundation public GPG keys for firmware and metadata
+
Show a translated warning when the server is limiting downloads
+
+
This release fixes the following bugs:
+
+
Add a firmware diagnostic tool called fwupdtool
+
Adjust all licensing to LGPL 2.1+
+
+ Allow installing more than one firmware using 'fwupdmgr
+ install'
+
+
Allow specifying hwids with OR relationships
+
Do not call fu_plugin_init() on blacklisted plugins
+
Do not require libcolorhug to build
+
Fix a crash in libfwupd where no device ID is set
+
Fix a potential DoS in libdfu by limiting holes to 1MiB
+
Fix a segfault that sometimes occurs during cleanup of USB plugins
+
Fix Hardware-ID{0,1,2,12} compatibility with Microsoft
+
Hide devices that aren't updatable by default in fwupdmgr
+
Search all UEFI GUIDs when matching hardware
+
Stop matching Nintendo Switch Pro in the 8bitdo plugin
+
+
+
+
+
+
This release adds the following features:
+
+
Add enable-remote and disable-remote commands to fwupdmgr
+
Add fu_plugin_add_compile_version() for libraries to use
+
Allow requiring specific versions of libraries for firmware updates
+
If no remotes are enabled try to enable the LVFS
+
Show a warning with interactive prompt when enabling a remote
+
+
This release fixes the following bugs:
+
+
Check that EFI system partition is mounted before update
+
Disable synapticsmst remote control on failure
+
Don't recoldplug thunderbolt to fix a flashing failure
+
Fix SQL error when running 'fwupdmgr clear-offline'
+
Improve the update report message
+
Only enumerate Dell Docks if the type is known
+
Only run certtool if a new enough gnutls is present
+
Prevent a client crash if the daemon somehow sends invalid data
+
Reboot after scheduling using logind not systemd
+
Use the right encoding for the label in make-images
+
+
+
+
+
+
This release adds the following features:
+
+
Add bash completion for fwupdmgr
+
Add support for newest Thunderbolt chips
+
Allow all functions that take device arguments to be prompted
+
Allow devices to use the runtime version when in bootloader mode
+
Allow overriding ESP mount point via conf file
+
Delete any old fwupdate capsules and efivars when launching fwupd
+
Generate Vala bindings
+
+
This release fixes the following bugs:
+
+
Allow ctrl-d out of the prompt for devices
+
Allow to create package out of provided binary
+
Correct handling of unknown Thunderbolt devices
+
Correctly detect new remotes that are manually copied
+
Fix a crash related to when passing device to downgrade in CLI
+
Fix running the self tests when no fwupd is installed
+
Fix Unifying signature writing and parsing for Texas bootloader
+
Only send success and failure reports to the server
+
Use a CNAME to redirect to the correct CDN for metadata
+
Use a longer timeout when powering back the Thunderbolt device
+
+
+
+
+
+
This release adds the following features:
+
+
Offer to reboot when processing an offline update
+
Report the efivar, libsmbios and fwupdate library versions
+
Report Thunderbolt safe mode and SecureBoot status
+
Show the user a URL when they report a known problem
+
Support split cabinet archives as produced by Windows Update
+
+
This release fixes the following bugs:
+
+
Be more careful deleting and modifying device history
+
Clarify which devices don't have upgrades
+
Ensure the Thunderbolt version is xx.yy
+
Fix a daemon warning when using fwupdmgr get-results
+
Fix crash with MST flashing
+
Fix DFU detach with newer releases of libusb
+
Include the device VID and PID when generating the device-id
+
Set the RemoteId when using GetDetails
+
Stop matching 8bitdo DS4 controller VID/PID
+
Use help2man for dfu-tool and drop docbook dependencies
+
Use ngettext for any strings with plurals
+
Use the default value if ArchiveSizeMax is unspecified
+
+
+
+
+
+
This release adds the following features:
+
+
Add D-Bus methods to get and modify the history information
+
Allow the user to share firmware update success or failure
+
Ask the user to refresh metadata when it is very old
+
Store firmware update success and failure to a local database
+
+
This release fixes the following bugs:
+
+
Add a device name for locked UEFI devices
+
Allow each plugin to opt-in to the recoldplug action
+
Fix firmware downloading using gnome-software
+
Fix UX capsule reference to the one specified in efivar
+
Never add two devices to the daemon with the same ID
+
Rescan supported flags when refreshing metadata
+
+
+
+
+
+
This release adds the following features:
+
+
Add a new plugin to add support for CSR 'Driverless DFU'
+
Add initial SF30/SN30 Pro support
+
Support AppStream metadata with relative <location> URLs
+
+
This release fixes the following bugs:
+
+
Add more metadata to the user-agent string
+
Block owned Dell TPM updates
+
Choose the correct component from provides matches using requirements
+
Do not try to parse huge compressed archive files
+
Fix a double-free bug in the Udev code
+
Handle Thunderbolt 'native' mode
+
+ Use the new functionality in libgcab >= 1.0 to avoid writing temp
+ files
+
+
+
+
+
+
+
This release adds the following features:
+
+
Add a plugin for the Nitrokey Storage device
+
Add support for the original AVR DFU protocol
+
Allow different plugins to claim the same device
+
Allow quirks to set common USB properties
+
Move a common plugin functionality out to a new shared object
+
Optionally delay the device removal for better replugging
+
Set environment variables to allow easy per-plugin debugging
+
Use a SHA1 hash for the internal DeviceID
+
+
This release fixes the following bugs:
+
+
Add quirk for AT32UC3B1256 as used in the RubberDucky
+
Disable the dell plugin if libsmbios fails
+
Don't register for USB UDev events to later ignore them
+
Fix a possible buffer overflow when debugging ebitdo devices
+
Fix critical warning when more than one remote fails to load
+
Fix DFU attaching AVR32 devices like the XMEGA
+
Ignore useless Thunderbolt device types
+
Refactor ColorHug into a much more modern plugin
+
Release the Steelseries interface if getting the version failed
+
Remove autoconf-isms from the meson configure options
+
Show a nicer error message if the requirement fails
+
Sort the output of GetUpgrades correctly
+
+
+
+
+
+
This release adds the following features:
+
+
Add support for HWID requirements
+
Add support for programming various AVR32 and XMEGA parts using DFU
+
Add the various DFU quirks for the Jabra Speak devices
+
Allow specifying the output file type for 'dfu-tool read'
+
Move the database of supported devices out into runtime loaded files
+
Support the IHEX record type 0x05
+
Use help2man to generate the man page at build time
+
Use the new quirk infrastructure for version numbers
+
+
This release fixes the following bugs:
+
+
Catch invalid Dell dock component requests
+
Correctly output Intel HEX files with > 16bit offset addresses
+
Do not try to verify the element write if upload is unsupported
+
Fix a double-unref when updating any 8Bitdo device
+
Fix crash when enumerating with Dell dock connected but with no UEFI
+
Fix uploading large firmware files over DFU
+
Format the BCD USB revision numbers correctly
+
Guess the DFU transfer size if it is not specified
+
Include the reset timeout as wValue to fix some DFU bootloaders
+
Make the error message clearer when sans fonts are missing
+
Support devices with truncated DFU interface data
+
+ Use the correct remote-specified username and passord when using
+ fwupdmgr
+
+
Use the correct wDetachTimeOut when writing DFU firmware
+
Verify devices with legacy VIDs are actually 8Bitdo controllers
+
+
+
+
+
+
This release breaks API and ABI to remove deprecated symbols!
+
This release adds the following features:
+
+
Add a human-readable title for each remote
+
Add a method to return a list of upgrades for a specific device
+
+ Add an 'Summary' and 'Icons' properties to each
+ device
+
+
Add FuDeviceLocker to simplify device open/close lifecycles
+
Add functionality to blacklist Dell HW with problems
+
Add fu_plugin_check_supported()
+
Add fwupd_remote_get_checksum() to use in client programs
+
Add ModifyRemote as an easy way to enable and disable remotes
+
Add the plugin documentation to the main gtk-doc
+
Allow plugins to depend on each other
+
Disable the fallback USB plugin
+
Parse the SMBIOS v2 and v3 DMI tables directly
+
Support uploading the UEFI firmware splash image
+
Use the intel-wmi-thunderbolt kernel module to force power
+
+
This release fixes the following bugs:
+
+
Only run SMI to toggle host MST GPIO on Dell systems with host MST
+
Disable unifying support if no CONFIG_HIDRAW support
+
Do not auto-open all USB devices at startup
+
Do not fail to load the daemon if cached metadata is invalid
+
Do not use system-specific information for UEFI PCI devices
+
Fix a crash when using fu_plugin_device_add_delay()
+
Fix the libdfu self test failure on s390 and ppc64
+
Fix various printing issues with the progressbar
+
Generate the LD script from the GObject introspection data
+
Never fallback to an offline update from client code
+
Only set the Dell coldplug delay when we know we need it
+
Prefer to use HWIDs to get DMI keys and DE table
+
+
+
+
+
+
This release adds the following features:
+
+
Add a configure switch for the LVFS remotes
+
Add a FirmwareBaseURI parameter to the remote config
+
Add a firmware builder that uses bubblewrap
+
+ Add a python script to create fwupd compatible cab files from
+ Microsoft .exe files
+
+
Add a thunderbolt plugin for new kernel interface
+
Allow plugins to get DMI data from the hardware in a safe way
+
Allow plugins to set metadata on devices created by other plugins
+
Optionally install the LVFS PKCS7 root certificate
+
Optionally use GnuTLS to verify PKCS7 certificates
+
+
This release fixes the following bugs:
+
+
Add back options for HAVE_SYNAPTICS and HAVE_THUNDERBOLT
+
Allow configuring systemd and udev directories
+
Enable C99 support in meson.build
+
Fix an incomplete cipher when using XTEA on data not in 4 byte chunks
+
Fix minor const-correctness issues
+
Implement thunderbolt image validation
+
Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags
+
Show a bouncing progress bar if the percentage remains at zero
+
Use a hwid to match supported systems for synapticsmst
+
Use the new bootloader PIDs for Unifying pico receivers
+
When thunderbolt is in safe mode on a Dell recover using SMBIOS
+
+
+
+
+
+
This release adds the following features:
+
+
Add DfuPatch to support forward-only firmware patching
+
Add --version option to fwupdmgr
+
Display all errors recorded by efi_error tracing
+
Make building introspection optional
+
Support embedded devices with local firmware metadata
+
+
This release fixes the following bugs:
+
+
Check all the device GUIDs against the blacklist when added
+
Correct a memory leak in Dell plugin
+
Default to 'en' for UEFI capsule graphics
+
Don't log a warning when an unknown unifying report is parsed
+
Enable test suite via /etc/fwupd.conf
+
Fix a hang on 32 bit computers
+
Fix compilation of the policy on a variety of configurations
+
Fix UEFI crash when the product name is NULL
+
Make flashing ebitdo devices work with fu-ebitdo-tool
+
Make messages from installing capsules useful
+
Make sure the unifying percentage completion goes from 0% to 100%
+
Run the plugin coldplug methods in a predictable order
+
Test UEFI for kernel support during coldplug
+
Use new GUsb functionality to fix flashing Unifying devices
+
+
+
+
+
+
This release adds the following features:
+
+
Add a get-remotes command to fwupdmgr
+
Add a plugin to get the version of the AMT ME interface
+
Add Arch Linux to CI
+
Add some installed tests flashing actual hardware
+
Allow flashing Unifying devices in bootloader modes
+
Allow ordering the metadata remotes
+
+
This release fixes the following bugs:
+
+
Do not check the runtime if the DFU device is in bootloader mode
+
Do not unlock devices when doing VerifyUpdate
+
Filter by Unifying SwId when making HID++2.0 requests
+
Fix downgrades when version_lowest is set
+
Fix the self tests when running on PPC64 big endian
+
Move the remotes parsing from the client to the server
+
Split up the Unifying HID++2.0 and HID++1.0 functionality
+
Store the metadata files rather than merging to one store
+
Use a longer timeout for some Unifying operations
+
Use the UFY DeviceID prefix for Unifying devices
+
+
+
+
+
+
This release adds the following features:
+
+
Add installed tests that use the daemon
+
Add the ability to restrict firmware to specific vendors
+
Enable Travis CI for Fedora and Debian
+
Export some more API for dealing with checksums
+
Generate a images for status messages during system firmware update
+
Show progress download when refreshing metadata
+
+
This release fixes the following bugs:
+
+
Compile with newer versions of meson
+
Ensure that firmware provides are legal GUIDs
+
Fix a common crash when refreshing metadata
+
Use the correct type signature in the D-Bus introspection file
+
+
+
+
+
+
This release adds the following features:
+
+
Add a 'downgrade' command to fwupdmgr
+
Add a 'get-releases' command to fwupdmgr
+
Add support for ConsoleKit2
+
Add support for Microsoft HardwareIDs
+
Allow downloading metadata from more than just the LVFS
+
Allow multiple checksums on devices and releases
+
+
This release fixes the following bugs:
+
+
Allow to specify bindir
+
Correctly open Unifying devices with original factory firmware
+
Deprecate some of the old FwupdResult API
+
Do not copy the origin from the new metadata file
+
Do not expect a Unifying reply when issuing a REBOOT command
+
Do not re-download firmware that exists in the cache
+
Fix a problem when testing for a Dell system
+
Fix flashing new firmware to 8bitdo controllers
+
Increase minimum required AppStream-Glib version to 0.6.13
+
Make documentation and man pages optional
+
Make systemd dependency at least version 231
+
Only decompress the firmware after the signature check
+
Remove 'lib' prefix when looking for libraries
+
Return the remote ID when getting updates about hardware
+
Send the daemon the remote ID when sending firmware metadata
+
+
+
+
+
+
This release adds the following feature:
+
+
Add support for Unifying DFU features
+
+
This release fixes the following bugs:
+
+
Do not spew a critial warning when parsing an invalid URI
+
Ensure device is closed if did not complete setup
+
Ensure steelseries device is closed if it returns an invalid packet
+
Fix man page installation location
+
Ignore spaces in the Unifying version prefix
+
Set HAVE_POLKIT_0_114 when polkit is newer than 0.114
+
+
+
+
+
+
This release adds the following features:
+
+
Add a config option to allow runtime disabling plugins by name
+
Add the Meson build system and remove autotools
+
Support signed Intel HEX files
+
+
This release fixes the following bugs:
+
+
Add DFU quirk for OpenPICC and SIMtrace
+
Create directories in /var/cache as required
+
Refactor the unifying plugin now we know more about the hardware
+
Set the source origin when saving metadata
+
Support proxy servers in fwupdmgr
+
Use a 60 second timeout on all client downloads
+
+
+
+
+
+
This release fixes the following bugs:
+
+
Adjust systemd confinement restrictions
+
Do not hardcode docbook2man path
+
Don't initialize libsmbios on unsupported systems
+
Fix a crash when enumerating devices on a Dell WLD15
+
Fix compiler warnings
+
Fix fwupdmgr timeout with missing pending database
+
+
+
+
+
+
This release adds the following features:
+
+
Add a set of vfuncs that are run before and after a device update
+
+ Add Dell-specific functionality to allow other plugins turn on
+ TBT/GPIO
+
+
Add support for Intel Thunderbolt devices
+
Add support for Logitech Unifying devices
+
Add support for Synaptics MST cascades hubs
+
Add support for the Altus-Metrum ChaosKey device
+
Add VerifyUpdate to update the device checksums server-side
+
+ Allow the metadata to match a version of fwupd and the existing fw
+ version
+
+
+
This release fixes the following bugs:
+
+
Add a new method for forcing a controller to flash mode
+
Always make sure we're getting a C99 compiler
+
Close USB devices before error returns
+
Don't read data from some DfuSe targets
+
Include all debug messages when run with --verbose
+
Return the pending UEFI update when not on AC power
+
+ Use a heuristic for the start address if the firmware has no DfuSe
+ footer
+
+
Use more restrictive settings when running under systemd
+
+
+
+
+
+
This release adds the following features:
+
+
Add a 'replace-data' command to dfu-tool
+
Use an animated progress bar when performing DFU operations
+
+
This release fixes the following bugs:
+
+
Add quirks for HydraBus as it does not have a DFU runtime
+
+ Don't create the UEFI dummy device if the unlock will happen on
+ next boot
+
+
Enable hardening flags on more binaries
+
Fix an assert when unlocking the dummy ESRT device
+
Fix writing firmware to devices using the ST reference bootloader
+
Match the Dell TB16 device
+
Re-get the quirks when the DfuDevice gets a new GUsbDevice
+
Show the nicely formatted target name for DfuSe devices
+
Verify devices support updating in mode they are called
+
+
+
+
+
+
This release adds the following features:
+
+
Add dfu_firmware_add_symbol()
+
Allow the argument to 'dfu-tool set-release' be major.minor
+
Load the Altos USB descriptor from ELF files
+
Support writing the IHEX symbol table
+
+
This release fixes the following bugs:
+
+
Add a fallback for older appstream-glib releases
+
Fix a possible crash when uploading firmware files using libdfu
+
Fix libfwupd self tests when a host-provided fwupd is not available
+
+ Show the human-readable version in the 'dfu-tool dump'
+ output
+
+
Write the ELF files with the correct section type
+
+
+
+
+
+
This release adds the following features:
+
+
Add a set-address and set-target-size commands to dfu-util
+
Add a small library for talking with 0bitdo hardware
+
Add Dell TPM and TB15/WD15 support via new Dell provider
+
Add FU_DEVICE_FLAG_NEEDS_BOOTLOADER
+
Add fwupd_client_get_status()
+
Add fwupd_result_get_unique_id()
+
Add initial ELF reading and writing support to libdfu
+
Add support for installing multiple devices from a CAB file
+
Allow providers to export percentage completion
+
Show a progress notification when installing firmware
+
Show the vendor flashing instructions when installing
+
+
This release fixes the following bugs:
+
+
Add XPS 9250 to Dell TPM modeswitch blacklist
+
Allow blacklisting devices by their GUID
+
Conditionally enable all providers based upon installed
+
Display flashes left in results output when it gets low
+
Do not attempt to add DFU devices not in runtime mode
+
Do not use the deprecated GNOME_COMPILE_WARNINGS
+
Don't fail while checking versions or locked state
+
Embed fwupd version in generated documentation
+
Ensure the ID is set when getting local firmware details
+
Fix gtk-doc build when srcdir != builddir
+
Fix libdfu hang when parsing corrupt IHEX files
+
Ignore devices that do not add at least one GUID
+
In get-details output, display the blob filename
+
Save the unique ID in the pending database
+
Support the 'DEVO' cipher kind in libdfu
+
Switch to the Amazon S3 CDN for firmware metadata
+
Update fwupdmgr manpage for new commands and arguments
+
Use a private gnupg key store
+
Use the correct firmware when installing a composite device
+
Use the SHA1 hash of the local file data as the origin
+
+
+
+
+
+
This release adds the following features:
+
+
Add a GetDetailsLocal() method to eventually replace GetDetails()
+
Add fu_device_get_alternate()
+
Allow devices to have multiple assigned GUIDs
+
Allow metainfo files to match only specific revisions of devices
+
Show the DFU protocol version in 'dfu-tool list'
+
+
This release fixes the following bugs:
+
+
Enforce allowing providers to take away flash abilities
+
Only claim the DFU interface when required
+
Only return updatable devices from GetDevices()
+
+
+
+
+
+
This release adds the following features:
+
+
Add a --force flag to override provider warnings
+
Add device-added, device-removed and device-changed signals
+
Add dfu_image_get_element_default()
+
Add for a new device field 'Flashes Left'
+
Add fwupd_client_connect()
+
Add the 'monitor' debugging command for fwupdmgr
+
Add the 'supported' flag to the FuDevice
+
+
This release fixes the following bugs:
+
+
Add summary and name field for Rival SteelSeries
+
Fix a critical warning when restarting the daemon
+
Fix BE issues when reading and writing DFU files
+
Make the device display name nicer
+
Match the AppStream metadata after a device has been added
+
Remove non-interactive pinentry setting from fu-keyring
+
Return all update descriptions newer than the installed version
+
Set the device description when parsing local firmware files
+
+
+
+
+
+
This release adds the following features:
+
+
Add a version plugin for SteelSeries hardware
+
Add FwupdClient and FwupdResult to libfwupd
+
Generate gtk-doc documentation for libfwupd
+
Return the device flags when getting firmware details
+
Support other checksum kinds
+
+
This release fixes the following bugs:
+
+
Add Alienware to the version quirk table
+
Allow the test suite to run in %check
+
Do not return updates that require AC when on battery
+
Do not use /tmp for downloaded files
+
Test that GPG key import actually was successful
+
+
+
+
+
+
This release adds the following features:
+
+
Add an unlock method for devices
+
Add a simple plugin infrastructure
+
Add ESRT enable method into UEFI provider
+
Install the hardcoded firmware AppStream file
+
+
This release fixes the following bugs:
+
+
Correct the BCD version number for DFU 1.1
+
Do not use deprecated API from libappstream-glib
+
Ignore the DFU runtime on the DW1820A
+
Only read PCI OptionROM firmware when devices are manually unlocked
+
Require AC power before scheduling some types of firmware update
+
Show ignored DFU devices in dfu-util, but not in fwupd
+
+
+
+
+
+
This release adds the following feature:
+
+
+ Add 'Created' and 'Modified' properties on
+ managed devices
+
+
+
This release fixes the following bugs:
+
+
Fix get-results for UEFI provider
+
Support vendor-specific UEFI version encodings
+
+
+
+
+
+
This release fixes the following bugs:
+
+
Always persist ColorHug devices after replug
+
Do not misdetect different ColorHug devices
+
Only dump the profiling data when run with --verbose
+
+
+
+
+
+
+ This release adds a new GObject library called libdfu and a command
+ line client called dfu-tool. This is a low-level tool used to upgrade
+ USB device firmware and can either be shipped in the same package as
+ fwupd or split off as separate subpackages.
+
+
This release adds the following feature:
+
+
Add support for automatically updating USB DFU-capable devices
+
+
This release fixes the following bugs:
+
+
Emit the changed signal after doing an update
+
Export the AppStream ID when returning device results
+
Fix compile with --disable-shared
+
Use new API available in fwup 0.5
+
Use the same device identification string format as Microsoft
+
+
+
+
+
+
This release fixes the following bugs:
+
+
Avoid seeking when reading the file magic during refresh
+
Do not assume that the compressed XML data will be NUL terminated
+
Use the correct user agent string for fwupdmgr
+
+
+
+
+
+
This release adds the following features:
+
+
Add profiling data to debug slow startup times
+
Support cabinet archives files with more than one firmware
+
+
This release fixes the following bugs:
+
+
Add the update description to the GetDetails results
+
+ Clear the in-memory firmware store only after parsing a valid XML
+ file
+
+
Ensure D-Bus remote errors are registered at fwupdmgr startup
+
+ Fix verify-update to produce components with the correct provide
+ values
+
+
Require appstream-glib 0.5.1
+
Show the dotted-decimal representation of the UEFI version number
+
+ When the version is from the 'FW' extension do not cache
+ the device
+
+
+
+
+
+
+
This release fixes the following bugs:
+
+
Fix the error message when no devices can be updated
+
Fix reading symlink to prevent crash with some compilers
+
+
+
+
+
+
This release adds the following feature:
+
+
Raise the dep on GLib to support and use g_autoptr()
+
+
This release fixes the following bugs:
+
+
Do not merge existing firmware metadata
+
Do not reboot if racing with the PackageKit offline update mechanism
+
+
+
+
+
+
This release adds the following feature:
+
+
Remove fwsignd, we have the LVFS now
+
+
This release fixes the following bugs:
+
+
Add application metadata when getting the updates list
+
Depend on appstream-glib >= 0.5.0
+
Don't apply firmware if something else is processing the update
+
Install fwupd into /usr/lib/$(triplet)/fwupd instead
+
Simplify the version properties on devices to avoid complexity
+
Update the offline update service to invoke right command
+
Use the new secure metadata URI
+
+
+
+
+
+
+ For the device verification code to work correctly you need at least
+ libappstream-glib 0.5.0 installed.
+
+
This release adds the following features:
+
+
Add a Raspberry Pi firmware provider
+
Add a simple config file to store the correct LVFS download URI
+
Make parsing the option ROM runtime optional
+
+
This release fixes the following bugs:
+
+
Allow fwupd to be autostarted by systemd
+
+ Allow no arguments to 'fwupdmgr verify-update' and use sane
+ defaults
+
+
Devices with option ROM are always internal
+
Do not pre-convert the update description from AppStream XML
+
Fix validation of written firmware
+
Move the verification and metadata matching phase to the daemon
+
Sign the test binary with the correct key
+
Use the AppStream 0.9 firmware specification by default
+
+
+
+
+
+
+ In this release we've moved the LVFS website to the fwupd project
+ and made them work really well together. To update all the firmware on
+ your system is now just a case of 'fwupdmgr refresh &&
+ fwupdmgr update'.
+ We've also added verification of BIOS and PCI ROM firmware, which
+ may be useful for forensics or to verify that system updates have been
+ applied.
+
+
This release adds the following features:
+
+
Actually parse the complete PCI option ROM
+
+ Add a 'fwupdmgr update' command to update all devices to
+ latest versions
+
+
Add a simple signing server that operates on .cab files
+
+ Add a 'verify' command that verifies the cryptographic hash
+ of device firmware
+
+
Allow clients to add new firmware metadata to the system cache
+
Move GetUpdates to the daemon
+
Move the LVFS website to the fwupd project
+
+
This release fixes the following bugs:
+
+
Accept multiple files at one time when using fwupdmgr dump-rom
+
Automatically download metadata using fwupdmgr if required
+
Do not return NULL as a gboolean
+
Don't call efibootmgr after fwupdate
+
Fallback to offline install when calling the update argument
+
Fix Intel VBIOS detection on Dell hardware
+
Reload appstream data after refreshing
+
Use the new LVFS GPG key
+
Fix build: libgusb is required even without colorhug support
+
+
+
+
+
+
This release adds the following features:
+
+
Get the firmware version from the device descriptors
+
Run the offline actions using systemd when required
+
Support OpenHardware devices using the fwupd vendor extensions
+
+
This release fixes the following bugs:
+
+
Add an UNKNOWN status so we can return meaningful enum values
+
Coldplug the devices before acquiring the well known name
+
+
+
+
+
+
+
+
+
+
This release adds the following features:
+
+
Add a 'get-updates' command to fwupdmgr
+
Add and document the offline-update lifecycle
+
Create a libfwupd shared library
+
+
This release fixes the following bugs:
+
+
Create runtime directories if they do not exist
+
Do not crash when there are no devices to return
+
+
+
+
+
+
fwupd is a simple daemon to allow session software to update firmware.
+ The LVFS is a free service that operates as an independent legal
+ entity and has no connection with $OS_RELEASE:NAME$.
+ Your distributor may not have verified any of the firmware updates for
+ compatibility with your system or connected devices.
+ All firmware is provided only by the original equipment manufacturer.
+
+
+ Enabling this functionality is done at your own risk, which means you
+ have to contact your original equipment manufacturer regarding any
+ problems caused by these updates.
+ Only problems with the update process itself should be filed at
+ $OS_RELEASE:BUG_REPORT_URL$.
+
+ The LVFS is a free service that operates as an independent legal
+ entity and has no connection with $OS_RELEASE:NAME$.
+ Your distributor may not have verified any of the firmware updates for
+ compatibility with your system or connected devices.
+ All firmware is provided only by the original equipment manufacturer.
+
+
+ This remote contains firmware which is not embargoed, but is still being
+ tested by the hardware vendor.
+ You should ensure you have a way to manually downgrade the firmware if
+ the firmware update fails.
+
+
+ Enabling this functionality is done at your own risk, which means you
+ have to contact your original equipment manufacturer regarding any
+ problems caused by these updates.
+ Only problems with the update process itself should be filed at
+ $OS_RELEASE:BUG_REPORT_URL$.
+
+
+
+
+
diff -Nru fwupd-1.0.6/data/remotes.d/meson.build fwupd-1.2.10/data/remotes.d/meson.build
--- fwupd-1.0.6/data/remotes.d/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/remotes.d/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,10 +1,28 @@
-if get_option('lvfs')
+if get_option('daemon') and get_option('lvfs')
install_data([
'lvfs.conf',
'lvfs-testing.conf',
],
install_dir : join_paths(sysconfdir, 'fwupd', 'remotes.d')
)
+ i18n.merge_file(
+ input: 'lvfs.metainfo.xml',
+ output: 'org.freedesktop.fwupd.remotes.lvfs.metainfo.xml',
+ type: 'xml',
+ po_dir: join_paths(meson.source_root(), 'po'),
+ data_dirs: join_paths(meson.source_root(), 'po'),
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'fwupd', 'metainfo')
+ )
+ i18n.merge_file(
+ input: 'lvfs-testing.metainfo.xml',
+ output: 'org.freedesktop.fwupd.remotes.lvfs-testing.metainfo.xml',
+ type: 'xml',
+ po_dir: join_paths(meson.source_root(), 'po'),
+ data_dirs: join_paths(meson.source_root(), 'po'),
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'fwupd', 'metainfo')
+ )
endif
install_data('README.md',
@@ -15,15 +33,15 @@
con2 = configuration_data()
con2.set('datadir', datadir)
configure_file(
- input : 'fwupd.conf',
- output : 'fwupd.conf',
+ input : 'vendor.conf',
+ output : 'vendor.conf',
configuration : con2,
install: true,
install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
)
configure_file(
- input : 'vendor.conf',
- output : 'vendor.conf',
+ input : 'vendor-directory.conf',
+ output : 'vendor-directory.conf',
configuration : con2,
install: true,
install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
diff -Nru fwupd-1.0.6/data/remotes.d/README.md fwupd-1.2.10/data/remotes.d/README.md
--- fwupd-1.0.6/data/remotes.d/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/remotes.d/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -1,12 +1,12 @@
Vendor Firmware
===============
-These are the steps to add vendor that is installed as part of an OSTree image:
+These are the steps to add vendor firmware that is installed as part of an embedded image such as an OSTree or ChromeOS image:
* Change `/etc/fwupd/remotes.d/vendor.conf` to have `Enabled=true`
* Change `/etc/fwupd/remotes.d/vendor.conf` to have the correct `Title`
* Deploy the firmware to `/usr/share/fwupd/remotes.d/vendor/firmware`
-* Deploy the metadata to `/usr/share/fwupd/remotes.d/vendor/vendor.xml`
+* Deploy the metadata to `/usr/share/fwupd/remotes.d/vendor/vendor.xml.gz`
The metadata should be of the form:
@@ -39,13 +39,27 @@
in `/etc/fwupd/remotes.d/vendor.conf` and ensure the correct public key or
signing certificate is installed in the `/etc/pki/fwupd` location.
+Automatic metadata generation
+=============================
+`fwupd` and `fwupdtool` support automatically generating metadata for a remote
+by configuring it to be a *directory* type. This is very convenient if you want to dynamically add firmware from multiple packages while generating the image but there are a few deficiencies:
+* There will be a performance impact of starting the daemon or tool measured by O(# CAB files)
+* It's not possible to verify metadata signature and any file validation should be part of the image validation.
+
+To enable this:
+* Change `/etc/fwupd/remotes.d/vendor-directory.conf` to have `Enabled=true`
+* Change `/etc/fwupd/remotes.d/vendor.conf-directory` to have the correct `Title`
+* Deploy the firmware to `/usr/share/fwupd/remotes.d/vendor/firmware`
+* Change `MetadataURI` to that of the directory (Eg `/usr/share/fwupd/remotes.d/vendor/`)
+
+
Mirroring a Repository
======================
The LVFS currently outputs XML with absolute URI locations, e.g.
`http://foo/bar.cab` rather than `bar.cab`
-This makes mirroring the master LVFS (or other slave instance) somewhat tricky.
+This makes mirroring the master LVFS (or other private instance) somewhat tricky.
To work around this issue client remotes can specify `FirmwareBaseURI` to
replace the URI of the firmware before it is downloaded.
diff -Nru fwupd-1.0.6/data/remotes.d/vendor.conf fwupd-1.2.10/data/remotes.d/vendor.conf
--- fwupd-1.0.6/data/remotes.d/vendor.conf 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/remotes.d/vendor.conf 2019-07-15 18:25:54.000000000 +0000
@@ -1,8 +1,8 @@
[fwupd Remote]
-
# this remote provides metadata shipped by the OS vendor and can be found in
-# /usr/share/fwupd/remotes.d/vendor and /usr/share/fwupd/remotes.d/vendor/firmware
+# @datadir@/fwupd/remotes.d/vendor and firmware in @datadir@/fwupd/remotes.d/vendor/firmware
Enabled=false
Title=Vendor
Keyring=none
MetadataURI=file://@datadir@/fwupd/remotes.d/vendor/vendor.xml.gz
+ApprovalRequired=false
diff -Nru fwupd-1.0.6/data/remotes.d/vendor-directory.conf fwupd-1.2.10/data/remotes.d/vendor-directory.conf
--- fwupd-1.0.6/data/remotes.d/vendor-directory.conf 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/remotes.d/vendor-directory.conf 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,8 @@
+[fwupd Remote]
+# this remote provides dynamically generated metadata shipped by the OS vendor and can
+# be found in @datadir@/fwupd/remotes.d/vendor/firmware
+Enabled=false
+Title=Vendor (Automatic)
+Keyring=none
+MetadataURI=file://@datadir@/fwupd/remotes.d/vendor/firmware
+ApprovalRequired=false
diff -Nru fwupd-1.0.6/data/tests/colorhug/meson.build fwupd-1.2.10/data/tests/colorhug/meson.build
--- fwupd-1.0.6/data/tests/colorhug/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/tests/colorhug/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,25 @@
-gcab = find_program('gcab', required : false)
-if gcab.found()
- colorhug_test_firmware = custom_target('colorhug-test-firmware',
- input : [
- 'firmware.bin',
- 'firmware.bin.asc',
- 'firmware.metainfo.xml',
- ],
- output : 'colorhug-als-3.0.2.cab',
- command : [
- gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
- ],
+colorhug_test_firmware = custom_target('colorhug-test-firmware',
+ input : [
+ 'firmware.bin',
+ 'firmware.bin.asc',
+ 'firmware.metainfo.xml',
+ ],
+ output : 'colorhug-als-3.0.2.cab',
+ command : [
+ gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
+ ],
+)
+
+if get_option('pkcs7')
+ # generate self-signed detached signature
+ colorhug_pkcs7_signature = custom_target('firmware.bin.p7c',
+ input: 'firmware.bin',
+ output: 'firmware.bin.p7c',
+ command: [certtool, '--p7-detached-sign',
+ '--p7-time',
+ '--load-privkey', pkcs7_privkey,
+ '--load-certificate', pkcs7_certificate,
+ '--infile', '@INPUT@',
+ '--outfile', '@OUTPUT@'],
)
endif
-
-# generate self-signed detached signature
-colorhug_pkcs7_signature = custom_target('firmware.bin.p7c',
- input: 'firmware.bin',
- output: 'firmware.bin.p7c',
- command: [certtool, '--p7-detached-sign',
- '--p7-time',
- '--load-privkey', pkcs7_privkey,
- '--load-certificate', pkcs7_certificate,
- '--infile', '@INPUT@',
- '--outfile', '@OUTPUT@'],
-)
diff -Nru fwupd-1.0.6/data/tests/daemon.conf fwupd-1.2.10/data/tests/daemon.conf
--- fwupd-1.0.6/data/tests/daemon.conf 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/tests/daemon.conf 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-[fwupd]
-ArchiveSizeMax=5
diff -Nru fwupd-1.0.6/data/tests/fwupd/daemon.conf fwupd-1.2.10/data/tests/fwupd/daemon.conf
--- fwupd-1.0.6/data/tests/fwupd/daemon.conf 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/tests/fwupd/daemon.conf 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,3 @@
+[fwupd]
+ArchiveSizeMax=5
+ApprovedFirmware=deadbeef
diff -Nru fwupd-1.0.6/data/tests/metadata.xml fwupd-1.2.10/data/tests/metadata.xml
--- fwupd-1.0.6/data/tests/metadata.xml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/tests/metadata.xml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,14 @@
+
+
+
+ org.fwupd.8330a096d9f1af8567c7374cb8403e1ce9cf3163.device
+
+ 2d47f29b-83a2-4f31-a2e8-63474f4d4c2e
+
+
+
+
Applying will enable UEFI firmware reporting
+
+
+
+
diff -Nru fwupd-1.0.6/data/tests/missing-hwid/meson.build fwupd-1.2.10/data/tests/missing-hwid/meson.build
--- fwupd-1.0.6/data/tests/missing-hwid/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/tests/missing-hwid/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,23 +1,20 @@
-gcab = find_program('gcab', required : false)
-if gcab.found()
- hwid_test_firmware = custom_target('hwid-test-firmware',
- input : [
- 'firmware.bin',
- 'firmware.metainfo.xml',
- ],
- output : 'hwid-1.2.3.cab',
- command : [
- gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
- ],
- )
- noreqs_test_firmware = custom_target('noreqs-test-firmware',
- input : [
- 'firmware.bin',
- 'firmware2.metainfo.xml',
- ],
- output : 'noreqs-1.2.3.cab',
- command : [
- gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
- ],
- )
-endif
+hwid_test_firmware = custom_target('hwid-test-firmware',
+ input : [
+ 'firmware.bin',
+ 'firmware.metainfo.xml',
+ ],
+ output : 'hwid-1.2.3.cab',
+ command : [
+ gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
+ ],
+)
+noreqs_test_firmware = custom_target('noreqs-test-firmware',
+ input : [
+ 'firmware.bin',
+ 'firmware2.metainfo.xml',
+ ],
+ output : 'noreqs-1.2.3.cab',
+ command : [
+ gcab, '--create', '--nopath', '@OUTPUT@', '@INPUT@',
+ ],
+)
diff -Nru fwupd-1.0.6/data/tests/quirks.d/merged.quirk fwupd-1.2.10/data/tests/quirks.d/merged.quirk
--- fwupd-1.0.6/data/tests/quirks.d/merged.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/tests/quirks.d/merged.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+[USB\VID_0A5C&PID_6412]
+Flags = MERGE_ME
diff -Nru fwupd-1.0.6/data/tests/quirks.d/tests.quirk fwupd-1.2.10/data/tests/quirks.d/tests.quirk
--- fwupd-1.0.6/data/tests/quirks.d/tests.quirk 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/tests/quirks.d/tests.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -1,12 +1,20 @@
-[fwupd-plugin-test]
+[USB\VID_0A5C&PID_6412]
+Flags= ignore-runtime
-USB\VID_0A5C&PID_6412=ignore-runtime
+[USB\VID_FFFF&PID_FFFF]
+Flags =
-# this is an empty key
-USB\VID_FFFF&PID_FFFF=
+[ACME Inc.=True]
+Test = awesome
-# this is a key with a space
-ACME Inc.=awesome
+[CORP*]
+Test = town
-# this is a wildcard
-CORP*=town
+[DeviceInstanceId=USB\VID_0BDA&PID_1100]
+Flags = clever
+Name = Hub
+Children = FuDevice|USB\VID_0763&PID_2806&I2C_01
+
+[DeviceInstanceId=USB\VID_0763&PID_2806&I2C_01]
+Name = HDMI
+Flags = updatable,internal
diff -Nru fwupd-1.0.6/data/tests/remotes.d/directory.conf fwupd-1.2.10/data/tests/remotes.d/directory.conf
--- fwupd-1.0.6/data/tests/remotes.d/directory.conf 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/data/tests/remotes.d/directory.conf 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,4 @@
+[fwupd Remote]
+Enabled=true
+Keyring=none
+MetadataURI=file:///tmp/fwupd-self-test/var/cache/fwupd
diff -Nru fwupd-1.0.6/data/tests/remotes.d/testing.conf fwupd-1.2.10/data/tests/remotes.d/testing.conf
--- fwupd-1.0.6/data/tests/remotes.d/testing.conf 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/data/tests/remotes.d/testing.conf 2019-07-15 18:25:54.000000000 +0000
@@ -1,3 +1,4 @@
[fwupd Remote]
Enabled=true
MetadataURI=file:///tmp/fwupd-self-test/testing.xml
+ApprovalRequired=true
diff -Nru fwupd-1.0.6/debian/changelog fwupd-1.2.10/debian/changelog
--- fwupd-1.0.6/debian/changelog 2018-03-12 12:30:30.000000000 +0000
+++ fwupd-1.2.10/debian/changelog 2020-01-09 08:25:38.000000000 +0000
@@ -1,3 +1,239 @@
+fwupd (1.2.10-1ubuntu2~ubuntu18.04.3) bionic; urgency=medium
+
+ * d/p/0001-dont-semver-conversion.patch, d/p/0001-version-handling.patch
+ d/p/0001-plain_support_in_version.patch:
+ backport regression fix that we can install firmware with the same
+ without --allow-reinstall in command line. the patch already merged
+ in upstream 1.2.X branch. (LP: #1820768)
+
+ -- Yuan-Chen Cheng Thu, 09 Jan 2020 16:25:38 +0800
+
+fwupd (1.2.10-1ubuntu2~ubuntu18.04.2) bionic; urgency=medium
+
+ * d/p/0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch:
+ - Only check the vendor ID if the device has one set (LP: #1856896)
+
+ -- Robert Ancell Thu, 19 Dec 2019 13:13:48 +1300
+
+fwupd (1.2.10-1ubuntu2~ubuntu18.04.1) bionic; urgency=medium
+
+ * Backport to bionic (LP: #1820768)
+ - meson-0.45-bc.patch: Fix build with meson 0.45
+
+ [ Steve Langasek ]
+ * Drop added Recommends: on bolt which is not in flavor seeds and adds a
+ new service.
+
+ -- Yuan-Chen Cheng Fri, 25 Oct 2019 16:38:06 +0800
+
+fwupd (1.2.10-1ubuntu2) eoan; urgency=medium
+
+ * Backport a patch from upstream to relax expired cert checks
+ in self tests to fix FTBFS (LP: #184375)
+ * Add a patch to skip some self tests if /etc/machine-id exists
+ but is empty (LP: #184375)
+
+ -- Mario Limonciello Tue, 24 Sep 2019 09:24:22 -0500
+
+fwupd (1.2.10-1ubuntu1) eoan; urgency=medium
+
+ * Merge with debian unstable.
+ - Remainining changes: downgrade tpm2-tools/tpm2-abrmd to Suggests.
+
+ -- Mario Limonciello Mon, 15 Jul 2019 14:13:33 -0500
+
+fwupd (1.2.10-1) unstable; urgency=medium
+
+ * New upstream version (1.2.10)
+
+ -- Mario Limonciello Mon, 15 Jul 2019 13:58:47 -0500
+
+fwupd (1.2.9-1ubuntu1) eoan; urgency=medium
+
+ * Merge with debian unstable.
+ - Remainining changes: downgrade tpm2-tools/tpm2-abrmd to Suggests.
+
+ -- Mario Limonciello Fri, 12 Jul 2019 16:07:38 -0500
+
+fwupd (1.2.9-1) unstable; urgency=medium
+
+ * New upstream version (1.2.9)
+
+ -- Mario Limonciello Fri, 12 Jul 2019 14:25:32 -0500
+
+fwupd (1.2.6-1) unstable; urgency=medium
+
+ * New upstream version (1.2.6)
+ * debian/control:
+ - Add new build depends related to Modem Manager
+
+ -- Mario Limonciello Mon, 01 Apr 2019 21:18:14 -0500
+
+fwupd (1.2.5-2) unstable; urgency=medium
+
+ * debian/gen_signing_json: Update the format of the json metadata to
+ match new requirements:
+ + Move all the data under a new top-level "packages" key
+ + Add an empty "trusted_certs" key - our binaries do not do any
+ further verification with an embedded key.
+
+ -- Steve McIntyre <93sam@debian.org> Mon, 25 Mar 2019 00:32:07 +0000
+
+fwupd (1.2.5-1) unstable; urgency=medium
+
+ * New upstream version (1.2.5)
+ * Drop all patches, upstream
+
+ -- Mario Limonciello Tue, 26 Feb 2019 16:30:52 -0600
+
+fwupd (1.2.4-3) unstable; urgency=medium
+
+ * Backport a patch from master that fixes FTBFS with newer glib
+
+ -- Mario Limonciello Fri, 15 Feb 2019 08:06:55 -0600
+
+fwupd (1.2.4-2) unstable; urgency=medium
+
+ * debian: explicitly depend on shared-mime-info
+
+ -- Mario Limonciello Thu, 14 Feb 2019 21:21:46 -0600
+
+fwupd (1.2.4-1) unstable; urgency=medium
+
+ * New upstream version
+ * refresh build dependencies
+ * Recommends on tpm2 stack to read PCR values
+
+ -- Mario Limonciello Wed, 06 Feb 2019 20:31:24 -0600
+
+fwupd (1.1.4-1) unstable; urgency=medium
+
+ * New upstream version
+
+ -- Mario Limonciello Wed, 07 Nov 2018 11:30:14 -0600
+
+fwupd (1.1.3-2) unstable; urgency=medium
+
+ * Move location of fwupd-SIGNARCH-signed.install to proper directory
+ to fix generation of signed packages.
+
+ -- Mario Limonciello Sat, 13 Oct 2018 14:17:07 -0500
+
+fwupd (1.1.3-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Mario Limonciello Fri, 12 Oct 2018 13:18:46 -0500
+
+fwupd (1.1.2-1) unstable; urgency=medium
+
+ * New upstream release
+ - Fixes ESP autodetection for autofs (Closes: #906216)
+ - Adds missing signing bits (Closes: #906599)
+ * debian/rules:
+ - Pass -a into dh_missing (Closes: #906357)
+ * debian/control:
+ - Recommends for bolt for new thunderbolt power API
+ - Build depends on Noto fonts instead of Dejavu fonts
+ * Drop all patches.
+
+ -- Mario Limonciello Mon, 10 Sep 2018 11:42:03 -0500
+
+fwupd (1.1.1-1) unstable; urgency=medium
+
+ * New upstream release.
+ - Adds support for more Synaptics and Intel hardware.
+ - Fixes firmware update on some UEFI implementations (Closes: #905570)
+ * debian/
+ - contrib: debian: regenerate control on clean
+ - refresh debian/{control,copyright} for upstream fixes
+ - drop all patches, upstream.
+
+ -- Mario Limonciello Mon, 13 Aug 2018 08:08:53 -0500
+
+fwupd (1.1.0-7) unstable; urgency=medium
+
+ * Correct another syntax error in SB signing template (Closes: #905482)
+
+ -- Mario Limonciello Sun, 05 Aug 2018 08:34:37 -0500
+
+fwupd (1.1.0-6) unstable; urgency=medium
+
+ * correct secure boot signing template name (Closes: #905471)
+
+ -- Mario Limonciello Sun, 05 Aug 2018 00:06:30 -0500
+
+fwupd (1.1.0-5) unstable; urgency=medium
+
+ * Fix secure boot signing template version string (Closes: #905468)
+ * Refresh debian/copyright (Closes: #904671)
+
+ -- Mario Limonciello Sat, 04 Aug 2018 22:37:36 -0500
+
+fwupd (1.1.0-4) unstable; urgency=medium
+
+ * debian/rules: dynamically install EFI binaries
+
+ -- Mario Limonciello Sat, 04 Aug 2018 19:43:44 -0500
+
+fwupd (1.1.0-3) unstable; urgency=medium
+
+ * debian/rules: use pkg-config to determine when to turn on redfish and UEFI
+ - Fixes FTBFS due to redfish on other architectures.
+
+ -- Mario Limonciello Sat, 04 Aug 2018 17:04:27 -0500
+
+fwupd (1.1.0-2) unstable; urgency=medium
+
+ * Fix the filename of the signed archive used for secure boot on Ubuntu
+ * Only build uefi plugin on supported architectures
+
+ -- Mario Limonciello Sat, 04 Aug 2018 11:27:24 -0500
+
+fwupd (1.1.0-1) unstable; urgency=medium
+
+ [ Steve Mcintyre ]
+ * Initial support for UEFI Secure Boot in Debian infrastructure
+ + When building, also generate a fwupdate-$ARCH-signed-template package
+ which contains metadata needed by the Debian signing service. This
+ will end up being turned into a new source package including a signed
+ version of the fwupdate binary.
+
+ [ Mario Limonciello ]
+ * New upstream version (1.1.0)
+ * Drop patches merged upstream.
+ * debian/control:
+ - Add a patch from upstream that will add gnu-efi to dependencies
+ - No longer recommends for fwupdate as it has been merged into fwupd.
+ * Adjust infrastructure for fwupdate signed package to be used by fwupd signed
+ package
+
+ -- Mario Limonciello Thu, 12 Jul 2018 08:28:32 -0500
+
+fwupd (1.0.8-1) unstable; urgency=medium
+
+ * New upstream version (1.0.8)
+ - Adds new fwupdtool
+ - License is now LGPL 2.1
+ - Drops colorhug dependency (built in now)
+ - refresh symbols
+
+ -- Mario Limonciello Thu, 07 Jun 2018 08:16:22 -0500
+
+fwupd (1.0.7-1) unstable; urgency=medium
+
+ * New upstream version (1.0.7)
+ * /debian changes:
+ - ignore library-not-linked-against-libc
+ - Remove unused override in debian/lintian/fwupd
+ - rename tag for debian/source/lintian-overrides
+ - Adjust to use https in debian/copyright
+ - Bump debian/compat to 10
+ - Update control version
+ - update standards version
+
+ -- Mario Limonciello Mon, 30 Apr 2018 13:11:17 -0500
+
fwupd (1.0.6-2) unstable; urgency=medium
[ Mario Limonciello ]
@@ -46,7 +282,7 @@
fwupd (1.0.2-1) unstable; urgency=medium
* New upstream version
- * Drop patch for doing libsmbios on only supported architectures,
+ * Drop patch for doing libsmbios on only supported architectures,
now upstream.
-- Mario Limonciello Tue, 28 Nov 2017 09:36:57 -0600
@@ -265,7 +501,7 @@
* Correct a cleanup rule
* Drop intltool build dependency
* Re-enable PIE for builds
- * Add additional build dependencies that will be needed for generating
+ * Add additional build dependencies that will be needed for generating
capsule graphics
* debian/control: sort build-dependencies
* Drop packaging from debian/, it will be git mv'ed from contrib/ upstream
diff -Nru fwupd-1.0.6/debian/compat fwupd-1.2.10/debian/compat
--- fwupd-1.0.6/debian/compat 2018-03-12 11:53:58.000000000 +0000
+++ fwupd-1.2.10/debian/compat 2019-12-19 00:13:48.000000000 +0000
@@ -1 +1 @@
-9
+11
diff -Nru fwupd-1.0.6/debian/control fwupd-1.2.10/debian/control
--- fwupd-1.0.6/debian/control 2018-03-12 12:30:30.000000000 +0000
+++ fwupd-1.2.10/debian/control 2020-01-09 08:25:38.000000000 +0000
@@ -1,33 +1,34 @@
Source: fwupd
Priority: optional
-Maintainer: Debian EFI
+Maintainer: Ubuntu Developers
+XSBC-Original-Maintainer: Debian EFI
Uploaders: Steve McIntyre <93sam@debian.org>,
Daniel Jared Dominguez ,
Matthias Klumpp ,
Mario Limonciello
Build-Depends:
- debhelper (>= 10.3),
+ bash-completion,
+ bubblewrap,
+ debhelper (>= 11),
dh-strip-nondeterminism,
fontconfig,
- fonts-dejavu,
+ fonts-noto,
gcab,
gettext (>= 0.19.8.1),
gir1.2-pango-1.0,
+ gnu-efi [amd64 arm64 armhf i386],
gnutls-bin,
gnutls-dev,
gobject-introspection,
gtk-doc-tools,
help2man,
- libappstream-glib-dev (>= 0.7.4),
libarchive-dev,
libcairo-dev,
libcairo-gobject2,
- libcolord-dev (>= 1.0.0),
- libcolorhug-dev,
- libefivar-dev [amd64 arm64 armhf armel i386],
+ libefiboot-dev [amd64 arm64 armhf i386],
+ libefivar-dev [amd64 arm64 armhf i386],
libelf-dev,
libfreetype6-dev,
- libfwup-dev (>= 10-3) [amd64 arm64 armhf i386],
libgcab-dev,
libgirepository1.0-dev,
libglib2.0-dev (>= 2.45.8),
@@ -35,11 +36,14 @@
libgudev-1.0-dev,
libgusb-dev (>= 0.2.9),
libjson-glib-dev (>= 1.1.1),
+ libmm-glib-dev,
libpolkit-gobject-1-dev,
+ libqmi-glib-dev,
libsmbios-dev [i386 amd64],
libsoup2.4-dev,
libsqlite3-dev,
libtool-bin,
+ libxmlb-dev (>= 0.1.5),
locales,
meson,
pkg-config,
@@ -47,12 +51,13 @@
python3-gi-cairo,
python3-pil,
python3-requests,
+ shared-mime-info,
systemd (>= 231),
udev,
umockdev,
valac,
- valgrind [!mips !sparc64 !sh4 !ppc64 !powerpcspe !hppa !alpha !mips64el !armhf !armel !mipsel !m68k],
-Standards-Version: 4.1.3
+ valgrind [!ia64 !riscv64 !x32 !mips !sparc64 !sh4 !ppc64 !powerpcspe !hppa !alpha !mips64el !armhf !armel !mipsel !m68k],
+Standards-Version: 4.3.0
Section: admin
Homepage: https://github.com/hughsie/fwupd
Vcs-Git: https://salsa.debian.org/efi-team/fwupd.git
@@ -68,8 +73,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the library used by the daemon.
@@ -77,9 +81,13 @@
Package: fwupd
Architecture: linux-any
Depends: ${misc:Depends},
- ${shlibs:Depends}
-Recommends: fwupdate,
- python3
+ ${shlibs:Depends},
+ shared-mime-info
+Recommends: python3,
+ fwupd-signed
+Suggests: bolt,
+ tpm2-tools,
+ tpm2-abrmd,
Breaks: gir1.2-dfu-1.0 (<< 0.9.7-1),
libdfu1 (<< 0.9.7-1),
libdfu-dev (<< 0.9.7-1)
@@ -91,8 +99,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
Package: fwupd-tests
@@ -114,8 +121,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides a set of installed tests that can be run to validate
@@ -130,8 +136,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides development documentation for creating a package that
@@ -150,8 +155,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the development files for libfwupd
@@ -167,3 +171,31 @@
.
It can be used by packages using the GIRepository format to generate
dynamic bindings.
+
+Package: fwupd-amd64-signed-template
+Architecture: amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-i386-signed-template
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-armhf-signed-template
+Architecture: armhf
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-arm64-signed-template
+Architecture: arm64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
diff -Nru fwupd-1.0.6/debian/control.in fwupd-1.2.10/debian/control.in
--- fwupd-1.0.6/debian/control.in 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/control.in 2019-12-19 00:13:48.000000000 +0000
@@ -1,12 +1,13 @@
Source: fwupd
Priority: optional
-Maintainer: Debian EFI
+Maintainer: Ubuntu Developers
+XSBC-Original-Maintainer: Debian EFI
Uploaders: Steve McIntyre <93sam@debian.org>,
Daniel Jared Dominguez ,
Matthias Klumpp ,
Mario Limonciello
Build-Depends: %%%DYNAMIC%%%
-Standards-Version: 4.1.3
+Standards-Version: 4.3.0
Section: admin
Homepage: https://github.com/hughsie/fwupd
Vcs-Git: https://salsa.debian.org/efi-team/fwupd.git
@@ -22,8 +23,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the library used by the daemon.
@@ -31,9 +31,13 @@
Package: fwupd
Architecture: linux-any
Depends: ${misc:Depends},
- ${shlibs:Depends}
-Recommends: fwupdate,
- python3
+ ${shlibs:Depends},
+ shared-mime-info
+Recommends: python3,
+ fwupd-signed
+Suggests: bolt,
+ tpm2-tools,
+ tpm2-abrmd,
Breaks: gir1.2-dfu-1.0 (<< 0.9.7-1),
libdfu1 (<< 0.9.7-1),
libdfu-dev (<< 0.9.7-1)
@@ -45,8 +49,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
Package: fwupd-tests
@@ -68,8 +71,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides a set of installed tests that can be run to validate
@@ -84,8 +86,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides development documentation for creating a package that
@@ -104,8 +105,7 @@
fwupd is a daemon to allow session software to update device firmware.
You can either use a GUI software manager like GNOME Software to view and
apply updates, the command-line tool or the system D-Bus interface directly.
- Currently, firmware updates using the UEFI capsule format and for the
- ColorHug are supported. More formats may be supported in the future.
+ Firmware updates are supported for a variety of technologies.
See for details
.
This package provides the development files for libfwupd
@@ -121,3 +121,31 @@
.
It can be used by packages using the GIRepository format to generate
dynamic bindings.
+
+Package: fwupd-amd64-signed-template
+Architecture: amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-i386-signed-template
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-armhf-signed-template
+Architecture: armhf
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
+
+Package: fwupd-arm64-signed-template
+Architecture: arm64
+Depends: ${shlibs:Depends}, ${misc:Depends}, make | build-essential | dpkg-dev
+Description: Template for signed fwupd package
+ This package is used to control code signing by the Debian signing
+ service.
diff -Nru fwupd-1.0.6/debian/copyright fwupd-1.2.10/debian/copyright
--- fwupd-1.0.6/debian/copyright 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/copyright 2020-01-09 08:25:38.000000000 +0000
@@ -1,40 +1,35 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: fwupd
Source: https://github.com/hughsie/fwupd
Files: *
-Copyright: 2015 Richard Hughes
-License: GPL-2.0+
-
-Files: libfwupd/*
-Copyright: 2015 Richard Hughes
+Copyright: Aleksander Morgado
+ Christian J. Kellner
+ Dell Inc.
+ Dell, Inc.
+ Google, Inc.
+ Intel Corporation.
+ Kalev Lember
+ Mario Limonciello
+ Max Ehrlich max.ehr@gmail.com
+ Peichen Huang
+ Peter Jones
+ Realtek Semiconductor Corporation
+ Red Hat, Inc.
+ Richard Hughes
+ Ryan Chang
+ Synaptics
+ Synaptics Inc
License: LGPL-2.1+
-Files: data/tests/colorhug/firmware.metainfo.xml
-Copyright: 2015 Richard Hughes
+Files: *.metainfo.xml
+Copyright: Richard Hughes
License: CC0-1.0
Files: debian/*
Copyright: 2015 Daniel Jared Dominguez
- 2015 Mario Limonciello
-License: GPL-2.0+
-
-License: GPL-2.0+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program. If not, see
- .
- On Debian systems, the complete text of the GNU General
- Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+ 2015-2018 Mario Limonciello
+License: LGPL-2.1+
License: LGPL-2.1+
This package is free software; you can redistribute it and/or modify
diff -Nru fwupd-1.0.6/debian/copyright.in fwupd-1.2.10/debian/copyright.in
--- fwupd-1.0.6/debian/copyright.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/copyright.in 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,140 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fwupd
+Source: https://github.com/hughsie/fwupd
+
+%%%DYNAMIC%%%
+Files: *.metainfo.xml
+Copyright: Richard Hughes
+License: CC0-1.0
+
+Files: debian/*
+Copyright: 2015 Daniel Jared Dominguez
+ 2015-2018 Mario Limonciello
+License: LGPL-2.1+
+
+License: LGPL-2.1+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see
+ .
+ On Debian systems, the complete text of the GNU Lesser General
+ Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1".
+
+
+License: CC0-1.0
+ Creative Commons CC0 1.0 Universal
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
+ SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT
+ RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS.
+ CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE
+ INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
+ RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+ .
+ Statement of Purpose
+ .
+ The laws of most jurisdictions throughout the world automatically confer
+ exclusive Copyright and Related Rights (defined below) upon the creator and
+ subsequent owner(s) (each and all, an "owner") of an original work of
+ authorship and/or a database (each, a "Work"). Certain owners wish to
+ permanently relinquish those rights to a Work for the purpose of contributing
+ to a commons of creative, cultural and scientific works ("Commons") that the
+ public can reliably and without fear of later claims of infringement build
+ upon, modify, incorporate in other works, reuse and redistribute as freely as
+ possible in any form whatsoever and for any purposes, including without
+ limitation commercial purposes. These owners may contribute to the Commons to
+ promote the ideal of a free culture and the further production of creative,
+ cultural and scientific works, or to gain reputation or greater distribution
+ for their Work in part through the use and efforts of others. For these and/or
+ other purposes and motivations, and without any expectation of additional
+ consideration or compensation, the person associating CC0 with a Work (the
+ "Affirmer"), to the extent that he or she is an owner of Copyright and Related
+ Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly
+ distribute the Work under its terms, with knowledge of his or her Copyright and
+ Related Rights in the Work and the meaning and intended legal effect of CC0 on
+ those rights.
+ .
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
+ protected by copyright and related or neighboring rights ("Copyright and
+ Related Rights"). Copyright and Related Rights include, but are not limited to,
+ the following:
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work, subject
+ to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data in a
+ Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal protection
+ of databases, and under any national implementation thereof, including any
+ amended or successor version of such directive); and
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+ .
+ 2. Waiver. To the greatest extent permitted by, but not in contravention of,
+ applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+ unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+ and Related Rights and associated claims and causes of action, whether now
+ known or unknown (including existing as well as future claims and causes of
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum
+ duration provided by applicable law or treaty (including future time
+ extensions), (iii) in any current or future medium and for any number of
+ copies, and (iv) for any purpose whatsoever, including without limitation
+ commercial, advertising or promotional purposes (the "Waiver").
+ Affirmer makes the Waiver for the benefit of each member of the public at large
+ and to the detriment of Affirmer's heirs and successors, fully intending that
+ such Waiver shall not be subject to revocation, rescission, cancellation,
+ termination, or any other legal or equitable action to disrupt the quiet
+ enjoyment of the Work by the public as contemplated by Affirmer's express
+ Statement of Purpose.
+ .
+ 3. Public License Fallback. Should any part of the Waiver for any reason be
+ judged legally invalid or ineffective under applicable law, then the Waiver
+ shall be preserved to the maximum extent permitted taking into account
+ Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+ is so judged Affirmer hereby grants to each affected person a royalty-free, non
+ transferable, non sublicensable, non exclusive, irrevocable and unconditional
+ license to exercise Affirmer's Copyright and Related Rights in the Work (i) in
+ all territories worldwide, (ii) for the maximum duration provided by
+ applicable law or treaty (including future time extensions), (iii) in any
+ current or future medium and for any number of copies, and (iv) for any
+ purpose whatsoever, including without limitation commercial, advertising or
+ promotional purposes (the "License"). The License shall be deemed effective
+ as of the date CC0 was applied by Affirmer to the Work. Should any part of
+ the License for any reason be judged legally invalid or ineffective under
+ applicable law, such partial invalidity or ineffectiveness shall not
+ invalidate the remainder of the License, and in such case Affirmer hereby
+ affirms that he or she will not (i) exercise any of his or her remaining
+ Copyright and Related Rights in the Work or (ii) assert any associated claims
+ and causes of action with respect to the Work, in either case contrary to
+ Affirmer's express Statement of Purpose.
+ .
+ 4. Limitations and Disclaimers.
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or warranties of
+ any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness for
+ a particular purpose, non infringement, or the absence of latent or other
+ defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons that
+ may apply to the Work or any use thereof, including without limitation any
+ person's Copyright and Related Rights in the Work. Further, Affirmer disclaims
+ responsibility for obtaining any necessary consents, permissions or other
+ rights required for any use of the Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a party
+ to this document and has no duty or obligation with respect to this CC0 or use
+ of the Work.
diff -Nru fwupd-1.0.6/debian/docs fwupd-1.2.10/debian/docs
--- fwupd-1.0.6/debian/docs 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/docs 2019-12-19 00:13:48.000000000 +0000
@@ -1 +1 @@
-NEWS
+
diff -Nru fwupd-1.0.6/debian/fwupd.install fwupd-1.2.10/debian/fwupd.install
--- fwupd-1.0.6/debian/fwupd.install 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/fwupd.install 2019-12-19 00:13:48.000000000 +0000
@@ -4,12 +4,17 @@
usr/share/bash-completion
usr/share/fwupd/*
usr/share/dbus-1/*
+usr/share/icons/*
usr/share/polkit-1/*
usr/share/locale
usr/share/metainfo/*
usr/lib/*/fwupd
+usr/lib/*/fwupdagent
+usr/lib/*/fwupdoffline
+usr/lib/*/fwupdtool
usr/share/man/man1/*
lib/systemd/system/*
+lib/systemd/system-shutdown/*
var/lib/fwupd
lib/udev/rules.d/*
data/daemon.conf etc/fwupd
diff -Nru fwupd-1.0.6/debian/fwupd.postinst fwupd-1.2.10/debian/fwupd.postinst
--- fwupd-1.0.6/debian/fwupd.postinst 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/fwupd.postinst 2019-12-19 00:13:48.000000000 +0000
@@ -6,4 +6,6 @@
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
dpkg-maintscript-helper rm_conffile \
/etc/fwupd.conf 1.0.0~ -- "$@"
+ dpkg-maintscript-helper rm_conffile \
+ /etc/fwupd/remotes.d/fwupd.conf 1.2.7~ -- "$@"
fi
diff -Nru fwupd-1.0.6/debian/fwupd-tests.install fwupd-1.2.10/debian/fwupd-tests.install
--- fwupd-1.0.6/debian/fwupd-tests.install 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/fwupd-tests.install 2019-12-19 00:13:48.000000000 +0000
@@ -4,3 +4,5 @@
#https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872458
usr/share/installed-tests/*
usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
+debian/lintian/fwupd-tests usr/share/lintian/overrides
+etc/fwupd/remotes.d/fwupd-tests.conf
diff -Nru fwupd-1.0.6/debian/fwupd-tests.postinst fwupd-1.2.10/debian/fwupd-tests.postinst
--- fwupd-1.0.6/debian/fwupd-tests.postinst 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/fwupd-tests.postinst 2019-12-19 00:13:48.000000000 +0000
@@ -12,4 +12,12 @@
echo "To enable test suite, modify /etc/fwupd/daemon.conf"
fi
fi
+ if [ -f /etc/fwupd/remotes.d/fwupd-tests.conf ]; then
+ if [ "$CI" = "true" ]; then
+ sed "s,^Enabled=false,Enabled=true," -i /etc/fwupd/remotes.d/fwupd-tests.conf
+ else
+ echo "To enable test suite, enable fwupd-tests remote"
+ fi
+
+ fi
fi
diff -Nru fwupd-1.0.6/debian/gbp.conf fwupd-1.2.10/debian/gbp.conf
--- fwupd-1.0.6/debian/gbp.conf 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/gbp.conf 2019-12-19 00:13:48.000000000 +0000
@@ -1,5 +1,5 @@
[DEFAULT]
-debian-branch = debian
+debian-branch = ubuntu
upstream-tag = %(version)s
[buildpackage]
diff -Nru fwupd-1.0.6/debian/gen_signing_changelog fwupd-1.2.10/debian/gen_signing_changelog
--- fwupd-1.0.6/debian/gen_signing_changelog 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/gen_signing_changelog 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Generate a changelog file for the signed fwupdate package, based on
+# a changelog.in file and other state
+
+DIR=$1
+SOURCE=$2
+ARCH=$3
+IN="${DIR}/changelog.in"
+OUT="${DIR}/changelog"
+
+# Parse out fields from our changelg entry - want the signing-template
+# one to match all the important details where we can
+DISTRIBUTION="$(dpkg-parsechangelog | sed -ne 's/^Distribution: \(.*\)/\1/p')"
+URGENCY="$(dpkg-parsechangelog | sed -ne 's/^Urgency: \(.*\)/\1/p')"
+MAINT="$(dpkg-parsechangelog | sed -ne 's/^Maintainer: \(.*\)/\1/p')"
+DATE="$(dpkg-parsechangelog | sed -ne 's/^Date: \(.*\)/\1/p')"
+
+# If the version ends in "+bXXX", this is a binNMU. We don't want a new
+# source package to look like that, so change it to ".bXXX" instead
+VERSION="$(dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')"
+MANGLED_VERSION="$(echo $VERSION | sed -r 's/-/\+/;s/\+(b[[:digit:]]+)$/.\1/')"
+
+printf "%s-%s-signed (%s) %s; urgency=%s\n" "${SOURCE}" "${ARCH}" "${MANGLED_VERSION}" "${DISTRIBUTION}" "${URGENCY}" > $OUT
+printf "\n" >> $OUT
+printf " * Update to %s version %s\n" "${SOURCE}" "${VERSION}" >> $OUT
+printf "\n" >> $OUT
+printf " -- %s %s\n" "${MAINT}" "${DATE}" >> $OUT
+printf "\n" >> $OUT
+
+cat $IN >> $OUT
+rm -f $IN
diff -Nru fwupd-1.0.6/debian/gen_signing_json fwupd-1.2.10/debian/gen_signing_json
--- fwupd-1.0.6/debian/gen_signing_json 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/gen_signing_json 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Generate a json file to go in the the fwupd-signed template
+# package. Describes exactly what needs to be signed, and how.
+
+DIR=$1
+SOURCE=$2
+ARCH=$3
+OUT="$DIR/files.json"
+
+# What file are we looking to sign?
+BINARY=$(find debian/tmp -name '*.efi' | xargs basename)
+
+# Actually needs full path within the binary deb
+BINARY="usr/lib/${SOURCE}/efi/${BINARY}"
+
+rm -f $OUT
+
+printf '{\n' >> $OUT
+printf ' "packages": {\n' >> $OUT
+printf ' "%s": {\n' "${SOURCE}" >> $OUT
+printf ' "trusted_certs": [],\n' >> $OUT
+printf ' "files": [ \n' >> $OUT
+printf ' {"sig_type": "efi", "file": "%s"}\n' "${BINARY}" >> $OUT
+printf ' ]\n' >> $OUT
+printf ' }\n' >> $OUT
+printf ' }\n' >> $OUT
+printf '}\n' >> $OUT
+
diff -Nru fwupd-1.0.6/debian/gir1.2-fwupd-2.0.install fwupd-1.2.10/debian/gir1.2-fwupd-2.0.install
--- fwupd-1.0.6/debian/gir1.2-fwupd-2.0.install 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/gir1.2-fwupd-2.0.install 2019-12-19 00:13:48.000000000 +0000
@@ -1 +1 @@
-usr/lib/*/girepository-1.0/Fwupd-2.0.typelib
+usr/lib/*/girepository-1.0/*.typelib
diff -Nru fwupd-1.0.6/debian/libfwupd2.install fwupd-1.2.10/debian/libfwupd2.install
--- fwupd-1.0.6/debian/libfwupd2.install 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/libfwupd2.install 2019-12-19 00:13:48.000000000 +0000
@@ -1 +1 @@
-usr/lib/*/libfwup*.so.*
+usr/lib/*/*.so.*
diff -Nru fwupd-1.0.6/debian/libfwupd2.symbols fwupd-1.2.10/debian/libfwupd2.symbols
--- fwupd-1.0.6/debian/libfwupd2.symbols 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/libfwupd2.symbols 2019-12-19 00:13:48.000000000 +0000
@@ -14,6 +14,21 @@
LIBFWUPD_1.0.0@LIBFWUPD_1.0.0 1.0.0
LIBFWUPD_1.0.3@LIBFWUPD_1.0.3 1.0.3
LIBFWUPD_1.0.4@LIBFWUPD_1.0.4 1.0.4
+ LIBFWUPD_1.0.7@LIBFWUPD_1.0.7 1.0.7
+ LIBFWUPD_1.0.8@LIBFWUPD_1.0.8 1.0.8
+ LIBFWUPD_1.1.0@LIBFWUPD_1.1.0 1.1.0
+ LIBFWUPD_1.1.1@LIBFWUPD_1.1.1 1.1.1
+ LIBFWUPD_1.1.2@LIBFWUPD_1.1.2 1.1.2
+ LIBFWUPD_1.1.3@LIBFWUPD_1.1.3 1.1.3
+ LIBFWUPD_1.2.10@LIBFWUPD_1.2.10 1.2.10
+ LIBFWUPD_1.2.1@LIBFWUPD_1.2.1 1.2.1
+ LIBFWUPD_1.2.2@LIBFWUPD_1.2.2 1.2.2
+ LIBFWUPD_1.2.4@LIBFWUPD_1.2.4 1.2.4
+ LIBFWUPD_1.2.5@LIBFWUPD_1.2.5 1.2.5
+ LIBFWUPD_1.2.6@LIBFWUPD_1.2.6 1.2.6
+ LIBFWUPD_1.2.7@LIBFWUPD_1.2.7 1.2.7
+ LIBFWUPD_1.2.8@LIBFWUPD_1.2.8 1.2.8
+ LIBFWUPD_1.2.9@LIBFWUPD_1.2.9 1.2.9
fwupd_build_history_report_json@LIBFWUPD_1.0.4 1.0.4
fwupd_build_machine_id@LIBFWUPD_1.0.4 1.0.4
fwupd_build_user_agent@LIBFWUPD_1.0.3 1.0.3
@@ -21,8 +36,10 @@
fwupd_checksum_get_best@LIBFWUPD_0.9.4 1.0.0
fwupd_checksum_get_by_kind@LIBFWUPD_0.9.4 1.0.0
fwupd_checksum_guess_kind@LIBFWUPD_0.9.3 1.0.0
+ fwupd_client_activate@LIBFWUPD_1.2.6 1.2.6
fwupd_client_clear_results@LIBFWUPD_0.7.0 1.0.0
fwupd_client_connect@LIBFWUPD_0.7.1 1.0.0
+ fwupd_client_get_approved_firmware@LIBFWUPD_1.2.6 1.2.6
fwupd_client_get_daemon_version@LIBFWUPD_0.9.6 1.0.0
fwupd_client_get_details@LIBFWUPD_1.0.0 1.0.0
fwupd_client_get_device_by_id@LIBFWUPD_0.9.3 1.0.0
@@ -35,12 +52,16 @@
fwupd_client_get_remotes@LIBFWUPD_0.9.3 1.0.0
fwupd_client_get_results@LIBFWUPD_0.7.0 1.0.0
fwupd_client_get_status@LIBFWUPD_0.7.3 1.0.0
+ fwupd_client_get_tainted@LIBFWUPD_1.2.4 1.2.4
fwupd_client_get_type@LIBFWUPD_0.7.0 1.0.0
fwupd_client_get_upgrades@LIBFWUPD_0.9.8 1.0.0
fwupd_client_install@LIBFWUPD_0.7.0 1.0.0
+ fwupd_client_modify_config@LIBFWUPD_1.2.8 1.2.8
fwupd_client_modify_device@LIBFWUPD_1.0.4 1.0.4
fwupd_client_modify_remote@LIBFWUPD_0.9.8 1.0.0
fwupd_client_new@LIBFWUPD_0.7.0 1.0.0
+ fwupd_client_self_sign@LIBFWUPD_1.2.6 1.2.6
+ fwupd_client_set_approved_firmware@LIBFWUPD_1.2.6 1.2.6
fwupd_client_unlock@LIBFWUPD_0.7.0 1.0.0
fwupd_client_update_metadata@LIBFWUPD_1.0.0 1.0.0
fwupd_client_verify@LIBFWUPD_0.7.0 1.0.0
@@ -49,7 +70,10 @@
fwupd_device_add_flag@LIBFWUPD_0.9.3 1.0.0
fwupd_device_add_guid@LIBFWUPD_0.9.3 1.0.0
fwupd_device_add_icon@LIBFWUPD_0.9.8 1.0.0
+ fwupd_device_add_instance_id@LIBFWUPD_1.2.5 1.2.5
fwupd_device_add_release@LIBFWUPD_0.9.8 1.0.0
+ fwupd_device_array_from_variant@LIBFWUPD_1.2.10 1.2.10
+ fwupd_device_compare@LIBFWUPD_1.1.1 1.1.1
fwupd_device_flag_from_string@LIBFWUPD_0.7.0 1.0.0
fwupd_device_flag_to_string@LIBFWUPD_0.7.0 1.0.0
fwupd_device_from_variant@LIBFWUPD_1.0.0 1.0.0
@@ -62,22 +86,31 @@
fwupd_device_get_guids@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_icons@LIBFWUPD_0.9.8 1.0.0
fwupd_device_get_id@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_get_install_duration@LIBFWUPD_1.1.3 1.1.3
+ fwupd_device_get_instance_ids@LIBFWUPD_1.2.5 1.2.5
fwupd_device_get_modified@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_name@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_get_parent@LIBFWUPD_1.0.8 1.0.8
+ fwupd_device_get_parent_id@LIBFWUPD_1.0.8 1.0.8
fwupd_device_get_plugin@LIBFWUPD_1.0.0 1.0.0
fwupd_device_get_release_default@LIBFWUPD_0.9.8 1.0.0
fwupd_device_get_releases@LIBFWUPD_0.9.8 1.0.0
+ fwupd_device_get_serial@LIBFWUPD_1.1.2 1.1.2
fwupd_device_get_summary@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_type@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_update_error@LIBFWUPD_0.9.8 1.0.0
+ fwupd_device_get_update_message@LIBFWUPD_1.2.4 1.2.4
fwupd_device_get_update_state@LIBFWUPD_0.9.8 1.0.0
fwupd_device_get_vendor@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_vendor_id@LIBFWUPD_0.9.4 1.0.0
fwupd_device_get_version@LIBFWUPD_0.9.3 1.0.0
fwupd_device_get_version_bootloader@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_get_version_format@LIBFWUPD_1.2.9 1.2.9
fwupd_device_get_version_lowest@LIBFWUPD_0.9.3 1.0.0
fwupd_device_has_flag@LIBFWUPD_0.9.3 1.0.0
fwupd_device_has_guid@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_has_instance_id@LIBFWUPD_1.2.5 1.2.5
+ fwupd_device_incorporate@LIBFWUPD_1.1.0 1.1.0
fwupd_device_new@LIBFWUPD_0.9.3 1.0.0
fwupd_device_remove_flag@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_created@LIBFWUPD_0.9.3 1.0.0
@@ -85,64 +118,104 @@
fwupd_device_set_flags@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_flashes_left@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_id@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_set_install_duration@LIBFWUPD_1.1.3 1.1.3
fwupd_device_set_modified@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_name@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_set_parent@LIBFWUPD_1.0.8 1.0.8
+ fwupd_device_set_parent_id@LIBFWUPD_1.0.8 1.0.8
fwupd_device_set_plugin@LIBFWUPD_1.0.0 1.0.0
+ fwupd_device_set_serial@LIBFWUPD_1.1.2 1.1.2
fwupd_device_set_summary@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_update_error@LIBFWUPD_0.9.8 1.0.0
+ fwupd_device_set_update_message@LIBFWUPD_1.2.4 1.2.4
fwupd_device_set_update_state@LIBFWUPD_0.9.8 1.0.0
fwupd_device_set_vendor@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_vendor_id@LIBFWUPD_0.9.4 1.0.0
fwupd_device_set_version@LIBFWUPD_0.9.3 1.0.0
fwupd_device_set_version_bootloader@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_set_version_format@LIBFWUPD_1.2.9 1.2.9
fwupd_device_set_version_lowest@LIBFWUPD_0.9.3 1.0.0
+ fwupd_device_to_json@LIBFWUPD_1.2.6 1.2.6
fwupd_device_to_string@LIBFWUPD_0.9.3 1.0.0
fwupd_device_to_variant@LIBFWUPD_1.0.0 1.0.0
+ fwupd_device_to_variant_full@LIBFWUPD_1.1.2 1.1.2
fwupd_error_from_string@LIBFWUPD_0.7.0 1.0.0
fwupd_error_quark@LIBFWUPD_0.1.1 1.0.0
fwupd_error_to_string@LIBFWUPD_0.7.0 1.0.0
+ fwupd_get_os_release@LIBFWUPD_1.0.7 1.0.7
+ fwupd_guid_from_string@LIBFWUPD_1.2.5 1.2.5
+ fwupd_guid_hash_data@LIBFWUPD_1.2.5 1.2.5
+ fwupd_guid_hash_string@LIBFWUPD_1.2.5 1.2.5
+ fwupd_guid_is_valid@LIBFWUPD_1.2.5 1.2.5
+ fwupd_guid_to_string@LIBFWUPD_1.2.5 1.2.5
fwupd_keyring_kind_from_string@LIBFWUPD_0.9.7 1.0.0
fwupd_keyring_kind_to_string@LIBFWUPD_0.9.7 1.0.0
+ fwupd_release_add_category@LIBFWUPD_1.2.7 1.2.7
fwupd_release_add_checksum@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_add_flag@LIBFWUPD_1.2.6 1.2.6
fwupd_release_add_metadata@LIBFWUPD_1.0.4 1.0.4
fwupd_release_add_metadata_item@LIBFWUPD_1.0.4 1.0.4
+ fwupd_release_array_from_variant@LIBFWUPD_1.2.10 1.2.10
+ fwupd_release_flag_from_string@LIBFWUPD_1.2.6 1.2.6
+ fwupd_release_flag_to_string@LIBFWUPD_1.2.6 1.2.6
fwupd_release_from_variant@LIBFWUPD_1.0.0 1.0.0
fwupd_release_get_appstream_id@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_categories@LIBFWUPD_1.2.7 1.2.7
fwupd_release_get_checksums@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_description@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_details_url@LIBFWUPD_1.2.4 1.2.4
fwupd_release_get_filename@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_flags@LIBFWUPD_1.2.6 1.2.6
fwupd_release_get_homepage@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_install_duration@LIBFWUPD_1.2.1 1.2.4
fwupd_release_get_license@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_metadata@LIBFWUPD_1.0.4 1.0.4
fwupd_release_get_metadata_item@LIBFWUPD_1.0.4 1.0.4
fwupd_release_get_name@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_protocol@LIBFWUPD_1.2.2 1.2.4
fwupd_release_get_remote_id@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_size@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_source_url@LIBFWUPD_1.2.4 1.2.4
fwupd_release_get_summary@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_trust_flags@LIBFWUPD_0.9.8 1.0.0
fwupd_release_get_type@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_get_update_message@LIBFWUPD_1.2.4 1.2.4
fwupd_release_get_uri@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_vendor@LIBFWUPD_0.9.3 1.0.0
fwupd_release_get_version@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_has_category@LIBFWUPD_1.2.7 1.2.7
+ fwupd_release_has_checksum@LIBFWUPD_1.2.6 1.2.6
+ fwupd_release_has_flag@LIBFWUPD_1.2.6 1.2.6
fwupd_release_new@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_remove_flag@LIBFWUPD_1.2.6 1.2.6
fwupd_release_set_appstream_id@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_description@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_set_details_url@LIBFWUPD_1.2.4 1.2.4
fwupd_release_set_filename@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_set_flags@LIBFWUPD_1.2.6 1.2.6
fwupd_release_set_homepage@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_set_install_duration@LIBFWUPD_1.2.1 1.2.4
fwupd_release_set_license@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_name@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_set_protocol@LIBFWUPD_1.2.2 1.2.4
fwupd_release_set_remote_id@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_size@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_set_source_url@LIBFWUPD_1.2.4 1.2.4
fwupd_release_set_summary@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_trust_flags@LIBFWUPD_0.9.8 1.0.0
+ fwupd_release_set_update_message@LIBFWUPD_1.2.4 1.2.4
fwupd_release_set_uri@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_vendor@LIBFWUPD_0.9.3 1.0.0
fwupd_release_set_version@LIBFWUPD_0.9.3 1.0.0
+ fwupd_release_to_json@LIBFWUPD_1.2.6 1.2.6
fwupd_release_to_string@LIBFWUPD_0.9.3 1.0.0
fwupd_release_to_variant@LIBFWUPD_1.0.0 1.0.0
+ fwupd_remote_array_from_variant@LIBFWUPD_1.2.10 1.2.10
fwupd_remote_build_firmware_uri@LIBFWUPD_0.9.7 1.0.0
fwupd_remote_from_variant@LIBFWUPD_1.0.0 1.0.0
fwupd_remote_get_age@LIBFWUPD_0.9.5 1.0.0
+ fwupd_remote_get_agreement@LIBFWUPD_1.0.7 1.0.7
+ fwupd_remote_get_approval_required@LIBFWUPD_1.2.6 1.2.6
fwupd_remote_get_checksum@LIBFWUPD_1.0.0 1.0.0
fwupd_remote_get_enabled@LIBFWUPD_0.9.3 1.0.0
fwupd_remote_get_filename_cache@LIBFWUPD_0.9.6 1.0.0
@@ -166,6 +239,7 @@
fwupd_remote_kind_to_string@LIBFWUPD_0.9.6 1.0.0
fwupd_remote_load_from_filename@LIBFWUPD_0.9.3 1.0.0
fwupd_remote_new@LIBFWUPD_0.9.3 1.0.0
+ fwupd_remote_set_agreement@LIBFWUPD_1.0.7 1.0.7
fwupd_remote_set_mtime@LIBFWUPD_0.9.5 1.0.0
fwupd_remote_set_priority@LIBFWUPD_0.9.5 1.0.0
fwupd_remote_to_variant@LIBFWUPD_1.0.0 1.0.0
@@ -175,3 +249,5 @@
fwupd_trust_flag_to_string@LIBFWUPD_0.7.0 1.0.0
fwupd_update_state_from_string@LIBFWUPD_0.7.0 1.0.0
fwupd_update_state_to_string@LIBFWUPD_0.7.0 1.0.0
+ fwupd_version_format_from_string@LIBFWUPD_1.2.9 1.2.9
+ fwupd_version_format_to_string@LIBFWUPD_1.2.9 1.2.9
diff -Nru fwupd-1.0.6/debian/libfwupd-dev.install fwupd-1.2.10/debian/libfwupd-dev.install
--- fwupd-1.0.6/debian/libfwupd-dev.install 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/libfwupd-dev.install 2019-12-19 00:13:48.000000000 +0000
@@ -1,6 +1,5 @@
-usr/include/fwupd-1/fwupd.h
-usr/include/fwupd-1/libfwupd
-usr/lib/*/libfwupd*.so
-usr/lib/*/pkgconfig/fwupd.pc
-usr/share/gir-1.0/Fwupd*.gir
+usr/include/*
+usr/lib/*/*.so
+usr/lib/*/pkgconfig/*.pc
+usr/share/gir-1.0/*.gir
usr/share/vala/vapi
diff -Nru fwupd-1.0.6/debian/lintian/fwupd fwupd-1.2.10/debian/lintian/fwupd
--- fwupd-1.0.6/debian/lintian/fwupd 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/lintian/fwupd 2019-12-19 00:13:48.000000000 +0000
@@ -2,5 +2,9 @@
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/fwupd-offline-update.service
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/fwupd.service
fwupd binary: systemd-service-file-missing-install-key lib/systemd/system/system-update.target.wants/fwupd-offline-update.service
-#CAs is the right word, not Case
-fwupd binary: spelling-error-in-binary usr/lib/fwupd/fwupd CAs Case
+#see debian bug 896012
+fwupd: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_upower.so
+#EFI applications are PE executables
+fwupd: executable-not-elf-or-script usr/lib/fwupd/efi/*.efi
+fwupd: portable-executable-missing-security-features usr/lib/fwupd/efi/*.efi ASLR DEP/NX
+fwupd: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_modem_manager.so
diff -Nru fwupd-1.0.6/debian/lintian/fwupd-tests fwupd-1.2.10/debian/lintian/fwupd-tests
--- fwupd-1.0.6/debian/lintian/fwupd-tests 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/lintian/fwupd-tests 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,2 @@
+#see debian bug 896012
+fwupd-tests: library-not-linked-against-libc usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
diff -Nru fwupd-1.0.6/debian/patches/0001-dont-semver-conversion.patch fwupd-1.2.10/debian/patches/0001-dont-semver-conversion.patch
--- fwupd-1.0.6/debian/patches/0001-dont-semver-conversion.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-dont-semver-conversion.patch 2020-01-09 08:24:28.000000000 +0000
@@ -0,0 +1,94 @@
+commit dfa9edcc487cc174c475bdc712f3c1965bcdfac3
+Author: Richard Hughes
+Date: Wed Dec 4 15:05:12 2019 +0000
+
+ Do not do semver conversion in fu_common_vercmp()
+
+ We don't know the version format, and so it's impossible to do it reliably --
+ just do it in the caller where we *do* know the FuDevice version format.
+
+ Cherry-picked from 1fbcb1a1808adebbe80a9c45f156bb695b02fb43
+
+--- a/src/fu-common-version.c
++++ b/src/fu-common-version.c
+@@ -347,8 +347,8 @@
+
+ /**
+ * fu_common_vercmp:
+- * @version_a: the release version, e.g. 1.2.3
+- * @version_b: the release version, e.g. 1.2.3.1
++ * @version_a: the semver release version, e.g. 1.2.3
++ * @version_b: the semver release version, e.g. 1.2.3.1
+ *
+ * Compares version numbers for sorting.
+ *
+@@ -360,8 +360,6 @@
+ fu_common_vercmp (const gchar *version_a, const gchar *version_b)
+ {
+ guint longest_split;
+- g_autofree gchar *str_a = NULL;
+- g_autofree gchar *str_b = NULL;
+ g_auto(GStrv) split_a = NULL;
+ g_auto(GStrv) split_b = NULL;
+
+@@ -374,10 +372,8 @@
+ return 0;
+
+ /* split into sections, and try to parse */
+- str_a = fu_common_version_parse (version_a);
+- str_b = fu_common_version_parse (version_b);
+- split_a = g_strsplit (str_a, ".", -1);
+- split_b = g_strsplit (str_b, ".", -1);
++ split_a = g_strsplit (version_a, ".", -1);
++ split_b = g_strsplit (version_b, ".", -1);
+ longest_split = MAX (g_strv_length (split_a), g_strv_length (split_b));
+ for (guint i = 0; i < longest_split; i++) {
+ gchar *endptr_a = NULL;
+--- a/src/fu-install-task.c
++++ b/src/fu-install-task.c
+@@ -111,10 +111,11 @@
+ {
+ const gchar *tmp;
+ const gchar *version;
+- const gchar *version_release;
++ const gchar *version_release_raw;
+ const gchar *version_lowest;
+ gboolean matches_guid = FALSE;
+ gint vercmp;
++ g_autofree gchar *version_release = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autoptr(GPtrArray) provides = NULL;
+ g_autoptr(XbNode) release = NULL;
+@@ -209,8 +210,8 @@
+ }
+
+ /* is this a downgrade or re-install */
+- version_release = xb_node_get_attr (release, "version");
+- if (version_release == NULL) {
++ version_release_raw = xb_node_get_attr (release, "version");
++ if (version_release_raw == NULL) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INVALID_FILE,
+@@ -273,6 +274,8 @@
+ }
+
+ /* check semver */
++ version_release = fu_common_version_parse_from_format (version_release_raw,
++ fu_device_get_version_format (self->device));
+ vercmp = fu_common_vercmp (version, version_release);
+ if (vercmp == 0 && (flags & FWUPD_INSTALL_FLAG_ALLOW_REINSTALL) == 0) {
+ g_set_error (error,
+--- a/src/fu-self-test.c
++++ b/src/fu-self-test.c
+@@ -3620,10 +3620,6 @@
+ g_assert_cmpint (fu_common_vercmp ("1.2.3", "1.2.3"), ==, 0);
+ g_assert_cmpint (fu_common_vercmp ("001.002.003", "001.002.003"), ==, 0);
+
+- /* same, not dotted decimal */
+- g_assert_cmpint (fu_common_vercmp ("1.2.3", "0x1020003"), ==, 0);
+- g_assert_cmpint (fu_common_vercmp ("0x10203", "0x10203"), ==, 0);
+-
+ /* upgrade and downgrade */
+ g_assert_cmpint (fu_common_vercmp ("1.2.3", "1.2.4"), <, 0);
+ g_assert_cmpint (fu_common_vercmp ("001.002.000", "001.002.009"), <, 0);
diff -Nru fwupd-1.0.6/debian/patches/0001-Only-check-the-vendor-ID-if-the-device-has-one-set.patch fwupd-1.2.10/debian/patches/0001-Only-check-the-vendor-ID-if-the-device-has-one-set.patch
--- fwupd-1.0.6/debian/patches/0001-Only-check-the-vendor-ID-if-the-device-has-one-set.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-Only-check-the-vendor-ID-if-the-device-has-one-set.patch 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,28 @@
+From 004a0624d05211e8436060bb7af6b0c6f2d805a3 Mon Sep 17 00:00:00 2001
+From: Richard Hughes
+Date: Mon, 9 Dec 2019 10:30:19 +0000
+Subject: [PATCH] Only check the vendor ID if the device has one set
+
+This means we don't get a weird error if the metadata sets a vendor-id, but the
+device does not.
+---
+ src/fu-engine.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/fu-engine.c b/src/fu-engine.c
+index d07843c3..814d15a6 100644
+--- a/src/fu-engine.c
++++ b/src/fu-engine.c
+@@ -1058,7 +1058,8 @@ fu_engine_check_requirement_firmware (FuEngine *self, XbNode *req,
+ }
+
+ /* vendor ID */
+- if (g_strcmp0 (xb_node_get_text (req), "vendor-id") == 0) {
++ if (g_strcmp0 (xb_node_get_text (req), "vendor-id") == 0 &&
++ fu_device_get_vendor_id (device) != NULL) {
+ const gchar *version = fu_device_get_vendor_id (device);
+ if (!fu_engine_require_vercmp (req, version, &error_local)) {
+ if (g_strcmp0 (xb_node_get_attr (req, "compare"), "ge") == 0) {
+--
+2.20.1
+
diff -Nru fwupd-1.0.6/debian/patches/0001-plain_support_in_version.patch fwupd-1.2.10/debian/patches/0001-plain_support_in_version.patch
--- fwupd-1.0.6/debian/patches/0001-plain_support_in_version.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-plain_support_in_version.patch 2020-01-09 08:24:33.000000000 +0000
@@ -0,0 +1,32 @@
+commit a7434265e671ba330214aaab54a41ad1335015ad
+Author: Richard Hughes
+Date: Wed Dec 4 15:04:19 2019 +0000
+
+ trivial: Support 'plain' in fu_common_version_from_uintXX()
+
+ Cherry picked from f21add626
+
+diff --git a/src/fu-common-version.c b/src/fu-common-version.c
+index e4a11002..0ee73f2a 100644
+--- a/src/fu-common-version.c
++++ b/src/fu-common-version.c
+@@ -52,7 +52,8 @@ fu_common_version_from_uint32 (guint32 val, FwupdVersionFormat kind)
+ (val >> 16) & 0xffff,
+ val & 0xffff);
+ }
+- if (kind == FWUPD_VERSION_FORMAT_NUMBER) {
++ if (kind == FWUPD_VERSION_FORMAT_NUMBER ||
++ kind == FWUPD_VERSION_FORMAT_PLAIN) {
+ /* AABBCCDD */
+ return g_strdup_printf ("%" G_GUINT32_FORMAT, val);
+ }
+@@ -109,7 +110,8 @@ fu_common_version_from_uint16 (guint16 val, FwupdVersionFormat kind)
+ (guint) (val >> 8) & 0xff,
+ (guint) val & 0xff);
+ }
+- if (kind == FWUPD_VERSION_FORMAT_NUMBER) {
++ if (kind == FWUPD_VERSION_FORMAT_NUMBER ||
++ kind == FWUPD_VERSION_FORMAT_PLAIN) {
+ return g_strdup_printf ("%" G_GUINT16_FORMAT, val);
+ }
+ g_critical ("failed to convert version format %s: %u",
diff -Nru fwupd-1.0.6/debian/patches/0001-Relax-the-certificate-time-checks-in-the-self-tests-.patch fwupd-1.2.10/debian/patches/0001-Relax-the-certificate-time-checks-in-the-self-tests-.patch
--- fwupd-1.0.6/debian/patches/0001-Relax-the-certificate-time-checks-in-the-self-tests-.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-Relax-the-certificate-time-checks-in-the-self-tests-.patch 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,86 @@
+From b4627629cdaadd1a75d7c650b7c5973fcd18dfb0 Mon Sep 17 00:00:00 2001
+From: Richard Hughes
+Date: Thu, 1 Aug 2019 09:45:25 +0100
+Subject: [PATCH] Relax the certificate time checks in the self tests for the
+ legacy certificate
+
+One test verifies a firmware with a signature from the old LVFS which was
+hosted on secure-lvfs.rhcloud.com and used the original PKCS-7 key. This key
+had a two year validity (expiring today, ohh the naivety...) rather than the
+newer fwupd.org key which expires in the year 2058.
+
+For this specific test only, disable the certificate time checks to fix CI.
+
+Fixes https://github.com/hughsie/fwupd/issues/1264
+---
+ src/fu-keyring-pkcs7.c | 10 +++++++++-
+ src/fu-keyring.h | 6 ++++--
+ src/fu-self-test.c | 3 ++-
+ 3 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/src/fu-keyring-pkcs7.c b/src/fu-keyring-pkcs7.c
+index 6dc944ed..a42feaa7 100644
+--- a/src/fu-keyring-pkcs7.c
++++ b/src/fu-keyring-pkcs7.c
+@@ -642,6 +642,14 @@ fu_keyring_pkcs7_verify_data (FuKeyring *keyring,
+ for (gint i = 0; i < count; i++) {
+ gnutls_pkcs7_signature_info_st info;
+ gint64 signing_time = 0;
++ gnutls_certificate_verify_flags verify_flags = 0;
++
++ /* use with care */
++ if (flags & FU_KEYRING_VERIFY_FLAG_DISABLE_TIME_CHECKS) {
++ g_debug ("WARNING: disabling time checks");
++ verify_flags |= GNUTLS_VERIFY_DISABLE_TIME_CHECKS;
++ verify_flags |= GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS;
++ }
+
+ /* verify the data against the detached signature */
+ if (flags & FU_KEYRING_VERIFY_FLAG_USE_CLIENT_CERT) {
+@@ -652,7 +660,7 @@ fu_keyring_pkcs7_verify_data (FuKeyring *keyring,
+ 0, /* vdata_size */
+ i, /* index */
+ &datum, /* data */
+- 0); /* flags */
++ verify_flags);
+ }
+ if (rc < 0) {
+ g_set_error (error,
+diff --git a/src/fu-keyring.h b/src/fu-keyring.h
+index 39819ca4..2f20e35e 100644
+--- a/src/fu-keyring.h
++++ b/src/fu-keyring.h
+@@ -20,12 +20,14 @@ G_DECLARE_DERIVABLE_TYPE (FuKeyring, fu_keyring, FU, KEYRING, GObject)
+ * FuKeyringVerifyFlags:
+ * @FU_KEYRING_VERIFY_FLAG_NONE: No flags set
+ * @FU_KEYRING_VERIFY_FLAG_USE_CLIENT_CERT: Use client certificate to verify
++ * @FU_KEYRING_VERIFY_FLAG_DISABLE_TIME_CHECKS: Disable checking of validity periods
+ *
+ * The flags to use when interacting with a keyring
+ **/
+ typedef enum {
+- FU_KEYRING_VERIFY_FLAG_NONE = 0,
+- FU_KEYRING_VERIFY_FLAG_USE_CLIENT_CERT = 1 << 1,
++ FU_KEYRING_VERIFY_FLAG_NONE = 0,
++ FU_KEYRING_VERIFY_FLAG_USE_CLIENT_CERT = 1 << 1,
++ FU_KEYRING_VERIFY_FLAG_DISABLE_TIME_CHECKS = 1 << 2,
+ /*< private >*/
+ FU_KEYRING_VERIFY_FLAG_LAST
+ } FuKeyringVerifyFlags;
+diff --git a/src/fu-self-test.c b/src/fu-self-test.c
+index 363f644e..24b12110 100644
+--- a/src/fu-self-test.c
++++ b/src/fu-self-test.c
+@@ -2628,7 +2628,8 @@ fu_keyring_pkcs7_func (void)
+ g_assert_no_error (error);
+ g_assert_nonnull (blob_sig);
+ result_pass = fu_keyring_verify_data (keyring, blob_pass, blob_sig,
+- FU_KEYRING_VERIFY_FLAG_NONE, &error);
++ FU_KEYRING_VERIFY_FLAG_DISABLE_TIME_CHECKS,
++ &error);
+ g_assert_no_error (error);
+ g_assert_nonnull (result_pass);
+ g_assert_cmpint (fu_keyring_result_get_timestamp (result_pass), >= , 1502871248);
+--
+2.20.1
+
diff -Nru fwupd-1.0.6/debian/patches/0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch fwupd-1.2.10/debian/patches/0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch
--- fwupd-1.0.6/debian/patches/0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,38 @@
+From d0fd614bb9023ea7c8f831fc6bfe122a3dbc9032 Mon Sep 17 00:00:00 2001
+From: Mario Limonciello
+Date: Tue, 24 Sep 2019 10:29:22 -0500
+Subject: [PATCH] trivial: libfwupd: skip tests if machine-id is empty too
+
+Ubuntu's buildds seem to have changed and this is causing test suite
+failures.
+---
+ libfwupd/fwupd-self-test.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+Index: fwupd-1.2.10/libfwupd/fwupd-self-test.c
+===================================================================
+--- fwupd-1.2.10.orig/libfwupd/fwupd-self-test.c
++++ fwupd-1.2.10/libfwupd/fwupd-self-test.c
+@@ -504,6 +504,8 @@ fwupd_has_system_bus (void)
+ static void
+ fwupd_common_machine_hash_func (void)
+ {
++ gsize sz = 0;
++ g_autofree gchar *buf = NULL;
+ g_autofree gchar *mhash1 = NULL;
+ g_autofree gchar *mhash2 = NULL;
+ g_autoptr(GError) error = NULL;
+@@ -512,6 +514,13 @@ fwupd_common_machine_hash_func (void)
+ g_test_skip ("Missing /etc/machine-id");
+ return;
+ }
++ if (!g_file_get_contents ("/etc/machine-id", &buf, &sz, &error))
++ return;
++
++ if (sz == 0) {
++ g_test_skip ("Empty /etc/machine-id");
++ return;
++ }
+
+ mhash1 = fwupd_build_machine_id ("salt1", &error);
+ g_assert_no_error (error);
diff -Nru fwupd-1.0.6/debian/patches/0001-version-handling.patch fwupd-1.2.10/debian/patches/0001-version-handling.patch
--- fwupd-1.0.6/debian/patches/0001-version-handling.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/0001-version-handling.patch 2020-01-09 08:24:37.000000000 +0000
@@ -0,0 +1,103 @@
+commit a59d92fe11637d2a62f71bda9024481cbb9956c5
+Author: Mario Limonciello
+Date: Mon Oct 14 08:44:39 2019 -0500
+
+ fu-engine: Read all releases and convert versions when comparing
+
+ Fixes matching ESRT version to metadata version for UEFI
+
+ Cherry-picked from 91d36095e12f2486c774d38eeabcc5b0ddfb0685
+
+diff --git a/src/fu-common-version.c b/src/fu-common-version.c
+index cd732a38..e4a11002 100644
+--- a/src/fu-common-version.c
++++ b/src/fu-common-version.c
+@@ -214,6 +214,31 @@ fu_common_version_ensure_semver (const gchar *version)
+ */
+ gchar *
+ fu_common_version_parse (const gchar *version)
++{
++ return fu_common_version_parse_from_format (version, FWUPD_VERSION_FORMAT_TRIPLET);
++}
++
++/**
++ * fu_common_version_parse_from_format
++ * @version: A version number
++ * @fmt: A FwupdVersionFormat
++ *
++ * Returns a dotted decimal version string from a version string using fmt.
++ * The supported formats are:
++ *
++ * - Dotted decimal, e.g. "1.2.3"
++ * - Base 16, a hex number *with* a 0x prefix, e.g. "0x10203"
++ * - Base 10, a string containing just [0-9], e.g. "66051"
++ * - Date in YYYYMMDD format, e.g. 20150915
++ *
++ * Anything with a '.' or that doesn't match [0-9] or 0x[a-f,0-9] is considered
++ * a string and returned without modification.
++ *
++ * Returns: A version number, e.g. "1.0.3"
++ *
++ */
++gchar *
++fu_common_version_parse_from_format (const gchar *version, FwupdVersionFormat fmt)
+ {
+ const gchar *version_noprefix = version;
+ gchar *endptr = NULL;
+@@ -246,7 +271,7 @@ fu_common_version_parse (const gchar *version)
+ return g_strdup (version);
+ if (tmp == 0)
+ return g_strdup (version);
+- return fu_common_version_from_uint32 ((guint32) tmp, FWUPD_VERSION_FORMAT_TRIPLET);
++ return fu_common_version_from_uint32 ((guint32) tmp, fmt);
+ }
+
+ /**
+diff --git a/src/fu-common-version.h b/src/fu-common-version.h
+index 7899da2d..c25b37ac 100644
+--- a/src/fu-common-version.h
++++ b/src/fu-common-version.h
+@@ -18,6 +18,8 @@ gchar *fu_common_version_from_uint32 (guint32 val,
+ gchar *fu_common_version_from_uint16 (guint16 val,
+ FwupdVersionFormat kind);
+ gchar *fu_common_version_parse (const gchar *version);
++gchar *fu_common_version_parse_from_format (const gchar *version,
++ FwupdVersionFormat fmt);
+ gchar *fu_common_version_ensure_semver (const gchar *version);
+ FwupdVersionFormat fu_common_version_guess_format (const gchar *version);
+ gboolean fu_common_version_verify_format (const gchar *version,
+diff --git a/src/fu-engine.c b/src/fu-engine.c
+index 814d15a6..0139c8e5 100644
+--- a/src/fu-engine.c
++++ b/src/fu-engine.c
+@@ -842,14 +842,27 @@ fu_engine_verify (FuEngine *self, const gchar *device_id, GError **error)
+ /* try again with the system metadata */
+ if (release == NULL) {
+ GPtrArray *guids = fu_device_get_guids (device);
++ FwupdVersionFormat fmt = fu_device_get_version_format (device);
+ for (guint i = 0; i < guids->len; i++) {
+ const gchar *guid = g_ptr_array_index (guids, i);
+ g_autofree gchar *xpath2 = NULL;
++ g_autoptr(GPtrArray) releases = NULL;
+ xpath2 = g_strdup_printf ("components/component/"
+ "provides/firmware[@type='flashed'][text()='%s']/"
+- "../../releases/release[@version='%s']",
+- guid, version);
+- release = xb_silo_query_first (self->silo, xpath2, NULL);
++ "../../releases/release",
++ guid);
++ releases = xb_silo_query (self->silo, xpath2, 0, error);
++ if (releases == NULL)
++ return FALSE;
++ for (guint j = 0; j < releases->len; j++) {
++ XbNode *rel = g_ptr_array_index (releases, j);
++ const gchar *rel_ver = xb_node_get_attr (rel, "version");
++ g_autofree gchar *tmp_ver = fu_common_version_parse_from_format (rel_ver, fmt);
++ if (fu_common_vercmp (tmp_ver, version) == 0) {
++ release = g_object_ref (rel);
++ break;
++ }
++ }
+ if (release != NULL)
+ break;
+ }
diff -Nru fwupd-1.0.6/debian/patches/meson-0.45-bc.patch fwupd-1.2.10/debian/patches/meson-0.45-bc.patch
--- fwupd-1.0.6/debian/patches/meson-0.45-bc.patch 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/meson-0.45-bc.patch 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,47 @@
+Description: meson 0.45 backward compatibility patch
+
+ * meson 0.45 backward compatibility patch from Mario.
+
+Author: Yuan-Chen Cheng
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: ,
+Bug:
+Bug-Debian: https://bugs.debian.org/
+Bug-Ubuntu: https://launchpad.net/bugs/
+Forwarded:
+Reviewed-By:
+Last-Update: 2019-08-01
+
+--- fwupd-1.2.10.orig/meson.build
++++ fwupd-1.2.10/meson.build
+@@ -1,7 +1,7 @@
+ project('fwupd', 'c',
+ version : '1.2.10',
+ license : 'LGPL-2.1+',
+- meson_version : '>=0.47.0',
++ meson_version : '>=0.44.0',
+ default_options : ['warning_level=2', 'c_std=c99'],
+ )
+
+@@ -115,8 +115,14 @@ test_link_args = [
+ '-Wl,-z,now',
+ ]
+ foreach arg: test_link_args
+- if cc.has_link_argument(arg)
+- global_link_args += arg
++ if meson.version().version_compare('>=0.46.0')
++ if cc.has_link_argument(arg)
++ global_link_args += arg
++ endif
++ else
++ if cc.has_argument(arg)
++ global_link_args += arg
++ endif
+ endif
+ endforeach
+ add_global_link_arguments(
diff -Nru fwupd-1.0.6/debian/patches/series fwupd-1.2.10/debian/patches/series
--- fwupd-1.0.6/debian/patches/series 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/patches/series 2020-01-09 08:25:01.000000000 +0000
@@ -0,0 +1,8 @@
+0001-Relax-the-certificate-time-checks-in-the-self-tests-.patch
+0001-trivial-libfwupd-skip-tests-if-machine-id-is-empty-t.patch
+meson-0.45-bc.patch
+0001-Only-check-the-vendor-ID-if-the-device-has-one-set.patch
+0001-dont-semver-conversion.patch
+0001-version-handling.patch
+0001-plain_support_in_version.patch
+
diff -Nru fwupd-1.0.6/debian/README.Debian fwupd-1.2.10/debian/README.Debian
--- fwupd-1.0.6/debian/README.Debian 2018-03-12 11:53:58.000000000 +0000
+++ fwupd-1.2.10/debian/README.Debian 2019-12-19 00:13:48.000000000 +0000
@@ -1,7 +1,18 @@
-fwupd for Debian
-----------------
+signed vs unsigned fwupd programs
+------------------------------------
-fwupd is still heavily in development. As of this date, the functionality
-it provides is not yet available on most systems.
+fwupd 1.1.0 is configured to understand when to use a signed version
+of the EFI binary. If the signed version isn't installed but secure
+boot is turned on, it will avoid copying to the EFI system partition.
+
+This allows supporting secure boot even if not turned on at install, or
+changed later after install.
+
+In Ubuntu, both fwupd-signed and fwupd are seeded in the default
+installation. Nothing is installed to the ESP until it's needed.
+
+In Debian, the package name for the signed version is slightly
+different due to different infrastructure. fwupd-signed-$ARCH and
+fwupd should both be installed and then things will work similarly
+to what's described above.
- -- Daniel Jared Dominguez Wed, 20 May 2015 17:16:02 -0500
diff -Nru fwupd-1.0.6/debian/rules fwupd-1.2.10/debian/rules
--- fwupd-1.0.6/debian/rules 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/rules 2019-12-19 00:13:48.000000000 +0000
@@ -3,6 +3,7 @@
export LC_ALL := C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions
#GPGME needs this for proper building on 32 bit archs
ifeq "$(DEB_HOST_ARCH_BITS)" "32"
@@ -10,40 +11,84 @@
endif
ifneq ($(CI),)
- export CI=--werror
+ export CI=--werror --wrap-mode=default
endif
regenerate_control:
- OS=debian-x86_64 ./contrib/ci/generate_debian_control.py debian/control.in debian/control
+ OS=debian-x86_64 ./contrib/ci/generate_debian.py
+
+SB_STYLE := debian
+deb_version := $(shell dpkg-parsechangelog --show-field Version)
+ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
+ SB_STYLE := ubuntu
+ tar_name := fwupd_$(deb_version)_$(DEB_HOST_ARCH).tar.gz
+else
+ TMPLDIR := debian/fwupd-$(DEB_HOST_ARCH)-signed-template/usr/share/code-signing/fwupd-$(DEB_HOST_ARCH)-signed-template
+endif
%:
[ -f debian/control ] || debian/rules regenerate_control
- dh $@ --with gir,systemd
+ dh $@ --with gir
override_dh_auto_clean: regenerate_control
rm -fr debian/build
+ifeq (ubuntu,$(SB_STYLE))
+ rm -rf debian/fwupd-images
+endif
override_dh_auto_configure:
- if pkg-config --exists fwup; then \
- export UEFI="-Dplugin_uefi=true"; \
+ if pkg-config --exists libsmbios_c; then \
+ export DELL="-Dplugin_dell=true"; \
else \
- export UEFI="-Dplugin_uefi=false"; \
+ export DELL="-Dplugin_dell=false"; \
fi; \
- if pkg-config --exists libsmbios_c; then \
- export DELL="-Dplugin_dell=true -Dplugin_synaptics=true"; \
+ if pkg-config --exists efivar; then \
+ export UEFI="-Dplugin_uefi=true -Dplugin_redfish=true -Dplugin_nvme=true"; \
+ else \
+ export UEFI="-Dplugin_uefi=false -Dplugin_redfish=false -Dplugin_nvme=false"; \
+ fi; \
+ if [ ! -z "$$CI" ]; then \
+ export FLASHROM="-Dplugin_flashrom=true"; \
else \
- export DELL="-Dplugin_dell=false -Dplugin_synaptics=false"; \
+ export FLASHROM="-Dplugin_flashrom=false"; \
fi; \
- dh_auto_configure -- $$UEFI $$DELL $$CI -Dplugin_dummy=true --libexecdir=/usr/lib
+ dh_auto_configure -- $$UEFI $$DELL $$FLASHROM $$CI -Dplugin_dummy=true --libexecdir=/usr/lib
override_dh_install:
find debian/tmp/usr -type f -name "*a" -print | xargs rm -f
sed -i 's,wheel,sudo,' ./debian/tmp/usr/share/polkit-1/rules.d/org.freedesktop.fwupd.rules
dh_install
- dh_missing --fail-missing
+ #install the EFI binaries if needed
+ if [ -d debian/tmp/usr/lib/fwupd/efi/ ]; then \
+ dh_install -pfwupd usr/lib/fwupd/efi ;\
+ dh_install -pfwupd usr/lib/fwupd/fwupdate; \
+ fi
+ #if build with meson subproject in CI need to install this too
+ if [ ! -z "$$CI" ] && [ -f debian/tmp/usr/lib/xb-tool ]; then \
+ dh_install -pfwupd usr/lib/xb-tool ;\
+ fi
+ if [ ! -z "$$CI" ] && [ -f debian/tmp/usr/sbin/flashrom ]; then \
+ dh_install -pfwupd usr/sbin/flashrom ;\
+ fi
+ dh_missing -a --fail-missing
#this is placed in fwupd-tests
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
+ rm -f debian/fwupd/etc/fwupd/remotes.d/fwupd-tests.conf
+
+ifeq (debian,$(SB_STYLE))
+ # Generate the template source for the Debian signing service to use
+ mkdir -p $(TMPLDIR)/source-template/debian
+ cp -a debian/signing-template/* $(TMPLDIR)/source-template/debian
+ cp debian/README.Debian $(TMPLDIR)/source-template/debian
+ find $(TMPLDIR)/source-template/debian -type f | xargs sed -i "s,SIGNARCH,$(DEB_HOST_ARCH),"
+ find $(TMPLDIR)/source-template/debian -type f | xargs sed -i "s,SIGNVERSION,$(deb_version),"
+ for file in $$(find $(TMPLDIR)/source-template/debian -type f -name *SIGNARCH*); do file1=$$(echo $$file | sed "s,SIGNARCH,$(DEB_HOST_ARCH),"); mv -v $$file $$file1; done
+ install -m 0755 debian/fwupd.postinst $(TMPLDIR)/source-template/debian/fwupd-$(DEB_HOST_ARCH)-signed.postinst
+ install -m 0755 debian/fwupd.postrm $(TMPLDIR)/source-template/debian/fwupd-$(DEB_HOST_ARCH)-signed.postrm
+ ./debian/gen_signing_changelog $(TMPLDIR)/source-template/debian fwupd $(DEB_HOST_ARCH)
+ ./debian/gen_signing_json $(TMPLDIR) fwupd ${DEB_HOST_ARCH}
+endif
override_dh_strip_nondeterminism:
dh_strip_nondeterminism -Xfirmware-example.xml.gz
@@ -52,3 +97,18 @@
if [ -x /usr/bin/valgrind ] ; then \
dh_auto_test; \
fi
+
+override_dh_builddeb:
+ dh_builddeb
+ifeq (ubuntu,$(SB_STYLE))
+ if [ -d debian/tmp/usr/lib/fwupd/efi/ ]; then \
+ mkdir -p debian/fwupd-images/$(deb_version) ;\
+ cp debian/tmp/usr/lib/fwupd/efi/fwupd*.efi debian/fwupd-images/$(deb_version) ;\
+ echo $(deb_version) > debian/fwupd-images/$(deb_version)/version ;\
+ tar -C debian/fwupd-images -czvf ../$(tar_name) . ;\
+ dpkg-distaddfile $(tar_name) raw-uefi - ;\
+ fi
+endif
+
+override_dh_shlibdeps:
+ dh_shlibdeps $$DHSLIBS
diff -Nru fwupd-1.0.6/debian/signing-template/changelog.in fwupd-1.2.10/debian/signing-template/changelog.in
--- fwupd-1.0.6/debian/signing-template/changelog.in 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/changelog.in 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,5 @@
+fwupd-SIGNARCH-signed (1) unstable; urgency=medium
+
+ * Add template source package for signing
+
+ -- Steve McIntyre <93sam@debian.org> Sat, 07 Apr 2018 12:44:55 +0100
diff -Nru fwupd-1.0.6/debian/signing-template/compat fwupd-1.2.10/debian/signing-template/compat
--- fwupd-1.0.6/debian/signing-template/compat 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/compat 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1 @@
+9
diff -Nru fwupd-1.0.6/debian/signing-template/control fwupd-1.2.10/debian/signing-template/control
--- fwupd-1.0.6/debian/signing-template/control 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/control 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,24 @@
+Source: fwupd-SIGNARCH-signed
+Priority: optional
+Maintainer: Debian EFI
+Uploaders: Daniel Jared Dominguez , Steve McIntyre <93sam@debian.org>, Mario Limonciello
+Build-Depends: debhelper (>= 9.0.0), sbsigntool [amd64 arm64 armhf i386], fwupd (= SIGNVERSION) [SIGNARCH]
+Standards-Version: 4.1.3
+Section: libs
+Homepage: https://github.com/hughsie/fwupd
+Vcs-Git: https://salsa.debian.org/efi-team/fwupd.git
+Vcs-Browser: https://salsa.debian.org/efi-team/fwupd
+
+Package: fwupd-SIGNARCH-signed
+Section: admin
+Architecture: SIGNARCH
+Provides: fwupd-signed
+Depends: ${shlibs:Depends}, ${misc:Depends}, fwupd (= SIGNVERSION)
+Description: Tools to manage UEFI firmware updates (signed)
+ fwupd provides functionality to update system firmware. It has been
+ initially designed to update firmware using UEFI capsule updates, but
+ it is designed to be extensible to other firmware update standards.
+ .
+ This package contains just the signed version of the fwupd binary,
+ needed if your system has UEFI Secure Boot enabled. It depends on the
+ normal fwupd package for everything else.
diff -Nru fwupd-1.0.6/debian/signing-template/copyright fwupd-1.2.10/debian/signing-template/copyright
--- fwupd-1.0.6/debian/signing-template/copyright 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/copyright 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,33 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fwupd
+Source: https://github.com/hughsie/fwupd
+
+Files: *
+Copyright: 2015 Richard Hughes
+License: LGPL-2.1+
+
+Files: data/tests/colorhug/firmware.metainfo.xml
+Copyright: 2015 Richard Hughes
+License: CC0-1.0
+
+Files: debian/*
+Copyright: 2015 Daniel Jared Dominguez
+ 2015 Mario Limonciello
+License: LGPL-2.1+
+
+License: LGPL-2.1+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see
+ .
+ On Debian systems, the complete text of the GNU Lesser General
+ Public License version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1".
diff -Nru fwupd-1.0.6/debian/signing-template/fwupd-SIGNARCH-signed.install fwupd-1.2.10/debian/signing-template/fwupd-SIGNARCH-signed.install
--- fwupd-1.0.6/debian/signing-template/fwupd-SIGNARCH-signed.install 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/fwupd-SIGNARCH-signed.install 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1 @@
+*.efi.signed /usr/lib/fwupd/efi
diff -Nru fwupd-1.0.6/debian/signing-template/README.source fwupd-1.2.10/debian/signing-template/README.source
--- fwupd-1.0.6/debian/signing-template/README.source 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/README.source 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,4 @@
+This source package is generated by the Debian signing service from a
+template built by the fwupd package. It should never be updated directly.
+
+ -- Steve McIntyre <93sam@debian.org> Sat, 07 Apr 2018 12:44:55 +0100
diff -Nru fwupd-1.0.6/debian/signing-template/rules fwupd-1.2.10/debian/signing-template/rules
--- fwupd-1.0.6/debian/signing-template/rules 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/rules 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+PACKAGE_NAME := fwupd
+SIG_PKG_NAME := fwupd-SIGNARCH-signed
+SIGNATURE_DIR := debian/signatures/$(PACKAGE_NAME)
+BINARY := $(shell find /usr/lib/fwupd/efi -name '*.efi' | xargs basename)
+
+%:
+ dh $@
+
+override_dh_auto_build:
+ cp /usr/lib/fwupd/efi/$(BINARY) .
+ sbattach --attach $(SIGNATURE_DIR)/usr/lib/fwupd/efi/$(BINARY).sig $(BINARY)
+ mv $(BINARY) $(BINARY).signed
diff -Nru fwupd-1.0.6/debian/signing-template/source/format fwupd-1.2.10/debian/signing-template/source/format
--- fwupd-1.0.6/debian/signing-template/source/format 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/debian/signing-template/source/format 2019-12-19 00:13:48.000000000 +0000
@@ -0,0 +1 @@
+3.0 (native)
diff -Nru fwupd-1.0.6/debian/source/lintian-overrides fwupd-1.2.10/debian/source/lintian-overrides
--- fwupd-1.0.6/debian/source/lintian-overrides 2018-03-12 11:54:04.000000000 +0000
+++ fwupd-1.2.10/debian/source/lintian-overrides 2019-12-19 00:13:48.000000000 +0000
@@ -1,2 +1,4 @@
#github doesn't have these
-fwupd source: debian-watch-may-check-gpg-signature
+fwupd source: debian-watch-does-not-check-gpg-signature
+#to make CI happy until libxmlb lands
+fwupd source: source-is-missing
diff -Nru fwupd-1.0.6/docs/architecture-plan.svg fwupd-1.2.10/docs/architecture-plan.svg
--- fwupd-1.0.6/docs/architecture-plan.svg 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/docs/architecture-plan.svg 2019-07-15 18:25:54.000000000 +0000
@@ -13,7 +13,7 @@
height="744.09448"
id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="architecture-plan.svg"
inkscape:export-filename="/home/hughsie/Code/colord/doc/website/img/architecture-plan.png"
inkscape:export-xdpi="59.99197"
@@ -184,6 +184,34 @@
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
transform="matrix(-0.2,0,0,-0.2,-1.2,0)" />
+
+
+
+
+
+
+ ry="5"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
fwupd
+ x="540.91553"
+ y="710.87421"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:1.25;font-family:Cantarell;-inkscape-font-specification:Cantarell;text-align:center;text-anchor:middle">fwupd
+ style="fill:#fce94f;fill-opacity:1;stroke:#edd400;stroke-width:1.88976378;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
ESRT
+ style="fill:#fce94f;fill-opacity:1;stroke:#edd400;stroke-width:1.88976378;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
VendorcustomProvders
+ id="tspan1140">plugins
+ ry="5"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
Udev
+ x="269.30994"
+ y="810.13818"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:21.33333397px;line-height:1.25;font-family:Cantarell;-inkscape-font-specification:Cantarell;text-align:center;text-anchor:middle">udev
+ style="fill:#ad7fa8;fill-opacity:1;stroke:#75507b;stroke-width:1.88976378;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
systemd
+ ry="5"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
pending.db
+ x="809.0918"
+ y="807.82349"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:21.33333397px;line-height:1.25;font-family:Cantarell;-inkscape-font-specification:Cantarell;text-align:center;text-anchor:middle">pending.db
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="cc" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="ccc" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="cc" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
session
+ x="48.273308"
+ y="481.51367"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:1.25;font-family:Cantarell;-inkscape-font-specification:Cantarell">internet
system
- system
+
-
-
- fwupdmgr
+ style="fill:#729fcf;fill-opacity:1;stroke:#3465a4;stroke-width:1.88976383;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
+ style="fill:#d3d7cf;fill-opacity:1;stroke:#888a85;stroke-width:1.88976383;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
downloadcache
-
+ y="560.53821"
+ x="809.99036"
+ style="font-style:normal;font-weight:normal;line-height:0%;font-family:'Bitstream Vera Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
+ xml:space="preserve"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408">downloadcache
-
+ style="fill:#8ae234;fill-opacity:1;stroke:#73d216;stroke-width:1.88976383;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
Internet
+ sodipodi:role="line">CDN
- Gudev + rules
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="cc" />
sqlite$home
- gnome-softwaregnome-software
+ id="tspan1643">fwupdmgr
+
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="cc" />
UpdateMetadata()GetDevices()
+ height="60"
+ x="720"
+ y="872.36218"
+ ry="5" />
sysfs
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408"
+ sodipodi:nodetypes="ccc" />
metadata
+ sodipodi:role="line">only metadata
firmware
- firmware
+
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
+ inkscape:export-filename="/home/hughsie/Documents/Presentations/LVFS/010-architecture-plan.png"
+ inkscape:export-xdpi="119.94408"
+ inkscape:export-ydpi="119.94408" />
AppStream XML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LVFS
+
+
+
+
+ session
+ embargoed metadata
+
+
+
diff -Nru fwupd-1.0.6/docs/libfwupd/libfwupd-docs.xml fwupd-1.2.10/docs/libfwupd/libfwupd-docs.xml
--- fwupd-1.0.6/docs/libfwupd/libfwupd-docs.xml 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/docs/libfwupd/libfwupd-docs.xml 2019-07-15 18:25:54.000000000 +0000
@@ -41,13 +41,15 @@
Functionality available to plugins.
-
-
-
-
+
-
+
+
+
+
+
+
@@ -153,7 +155,7 @@
- Creating an abstact device
+ Creating an abstract device
This section shows how you would create a device which is exported
to the daemon and thus can be queried and updated by the client software.
@@ -292,7 +294,7 @@
For some hardware, we might want to do an action before or after
the actual firmware is squirted into the device.
This could be something as simple as checking the system battery
- level is over a certain theshold, or it could be as complicated as
+ level is over a certain threshold, or it could be as complicated as
ensuring a vendor-specific GPIO is asserted when specific types
of hardware are updated.
@@ -332,7 +334,7 @@
Detaching to bootloader mode
Some hardware can only be updated in a special bootloader mode, which
- for most devices can be switched to automaticaly.
+ for most devices can be switched to automatically.
In some cases the user to do something manually, for instance
re-inserting the hardware with a secret button pressed.
diff -Nru fwupd-1.0.6/docs/meson.build fwupd-1.2.10/docs/meson.build
--- fwupd-1.0.6/docs/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/docs/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,3 +1 @@
-if get_option('gtkdoc')
- subdir('libfwupd')
-endif
+subdir('libfwupd')
diff -Nru fwupd-1.0.6/docs/version-format.md fwupd-1.2.10/docs/version-format.md
--- fwupd-1.0.6/docs/version-format.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/docs/version-format.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,58 @@
+Version Formats
+===============
+
+In some circumstances fwupd has to convert from a unsigned integer version
+number into something that has either been used in documentation or has been
+defined in some specification.
+A good example here is the UEFI ESRT table, which specifies a `uint32_t` for
+the version but does not specify how this should be formatted for the user.
+
+As is typical in underspecified specifications, vendors have converted the
+integer in different ways. For instance, Dell uses version strings like 1.2.3
+and Microsoft use versions like 1.2.3.4.
+
+The fwudp daemon can match specific devices and apply the correct version style
+using quirk files. The version format can also be specified in the firmware
+`metainfo.xml` file so that the new version is correctly shown, and so that it
+matches on the LVFS website.
+
+The current version formats supported by fwupd and the LVFS are:
+
+ * `plain`: Use plain integer version numbers with no dots, e.g. `AABBCCDD`
+ * `quad`: Use Dell-style `AA.BB.CC.DD` version numbers
+ * `triplet`: Use Microsoft-style `AA.BB.CCDD` version numbers
+ * `pair`: Use two `AABB.CCDD` version numbers
+ * `bcd`: Use binary coded decimal notation
+ * `intel-me`: Use Intel ME-style notation (`aaa+11.bbbbb.CC.DDDD`)
+ * `intel-me2`: Use alternate Intel ME-style-style `A.B.CC.DDDD` notation
+
+These can be specified in quirk files like this:
+
+ # Vendor Modelname
+ [Guid=5b92717b-2cad-4a96-a13b-9d65781df8bf]
+ VersionFormat = intel-me2
+
+...or in metainfo.xml files like this:
+
+
+ intel-me2
+
+
+Runtime requirements
+--------------------
+
+Versions of fwupd `< 1.2.0` can only support firmware updates with key values
+`LVFS::VersionFormat` of `quad` and `triplet`. Additionally, on older versions
+no quirk `VersionFormat` device fixups are supported.
+
+If want to use one of the additional version formats you should depend on a
+specific version of fwupd in the firmware file:
+
+
+ org.freedesktop.fwupd
+
+
+This is not *strictly* required, as the integer value can be used for update
+calculations if the version is specified in hex (e.g. `0x12345678`) in the
+`` tag, although the user might get a bit confused if the update
+version does not match the update description.
diff -Nru fwupd-1.0.6/.github/pull_request_template.md fwupd-1.2.10/.github/pull_request_template.md
--- fwupd-1.0.6/.github/pull_request_template.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/.github/pull_request_template.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,5 @@
+Type of pull request:
+- [ ] New plugin (Please include [new plugin checklist](https://github.com/hughsie/fwupd/wiki/New-plugin-checklist))
+- [ ] Code fix
+- [ ] Feature
+- [ ] Documentation
diff -Nru fwupd-1.0.6/.gitignore fwupd-1.2.10/.gitignore
--- fwupd-1.0.6/.gitignore 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/.gitignore 2019-07-15 18:25:54.000000000 +0000
@@ -1,2 +1,23 @@
/build
/dist
+/.vscode
+/build-dir
+/.flatpak-builder
+/repo
+*.flatpak
+*.snap
+/fwupd_source.tar.bz2
+/parts
+/prime
+/stage
+/snap/.snapcraft
+/libxmlb
+/*.deb
+/*.ddeb
+/*.changes
+/*.buildinfo
+/fwupd*.build
+/*.dsc
+/*.xz
+/*.gz
+__pycache__
diff -Nru fwupd-1.0.6/.gitmodules fwupd-1.2.10/.gitmodules
--- fwupd-1.0.6/.gitmodules 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/.gitmodules 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,3 @@
+[submodule "contrib/flatpak"]
+ path = contrib/flatpak
+ url = https://github.com/flathub/org.freedesktop.fwupd
diff -Nru fwupd-1.0.6/.lgtm.yml fwupd-1.2.10/.lgtm.yml
--- fwupd-1.0.6/.lgtm.yml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/.lgtm.yml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,23 @@
+extraction:
+ python:
+ python_setup:
+ version: "3"
+ cpp:
+ prepare:
+ packages:
+ - bsdtar
+ - python3-gi
+ - libcogl-pango-dev
+ - python3-pil
+ - python3-cairo
+ after_prepare:
+ - "wget -O libxmlb.zip https://github.com/hughsie/libxmlb/archive/0.1.7.zip"
+ - "mkdir -p subprojects/libxmlb"
+ - "bsdtar --strip-components=1 -xvf libxmlb.zip -C subprojects/libxmlb"
+ - "wget -O flashrom.zip https://github.com/hughsie/flashrom/archive/wip/hughsie/fwupd.zip"
+ - "mkdir -p subprojects/flashrom"
+ - "bsdtar --strip-components=1 -xvf flashrom.zip -C subprojects/flashrom"
+ index:
+ build_command:
+ - "meson setup build"
+ - "ninja -C build"
diff -Nru fwupd-1.0.6/libfwupd/fwupd-client.c fwupd-1.2.10/libfwupd/fwupd-client.c
--- fwupd-1.0.6/libfwupd/fwupd-client.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-client.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -52,6 +37,7 @@
typedef struct {
FwupdStatus status;
+ gboolean tainted;
guint percentage;
gchar *daemon_version;
GDBusConnection *conn;
@@ -72,6 +58,7 @@
PROP_STATUS,
PROP_PERCENTAGE,
PROP_DAEMON_VERSION,
+ PROP_TAINTED,
PROP_LAST
};
@@ -110,7 +97,10 @@
return helper;
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FwupdClientHelper, fwupd_client_helper_free)
+#pragma clang diagnostic pop
static void
fwupd_client_set_daemon_version (FwupdClient *client, const gchar *daemon_version)
@@ -143,6 +133,14 @@
g_object_notify (G_OBJECT (client), "status");
}
}
+ if (g_variant_dict_contains (dict, "Tainted")) {
+ g_autoptr(GVariant) val = NULL;
+ val = g_dbus_proxy_get_cached_property (proxy, "Tainted");
+ if (val != NULL) {
+ priv->tainted = g_variant_get_boolean (val);
+ g_object_notify (G_OBJECT (client), "tainted");
+ }
+ }
if (g_variant_dict_contains (dict, "Percentage")) {
g_autoptr(GVariant) val = NULL;
val = g_dbus_proxy_get_cached_property (proxy, "Percentage");
@@ -215,6 +213,7 @@
{
FwupdClientPrivate *priv = GET_PRIVATE (client);
g_autoptr(GVariant) val = NULL;
+ g_autoptr(GVariant) val2 = NULL;
g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
@@ -247,72 +246,12 @@
val = g_dbus_proxy_get_cached_property (priv->proxy, "DaemonVersion");
if (val != NULL)
fwupd_client_set_daemon_version (client, g_variant_get_string (val, NULL));
+ val2 = g_dbus_proxy_get_cached_property (priv->proxy, "Tainted");
+ if (val2 != NULL)
+ priv->tainted = g_variant_get_boolean (val2);
return TRUE;
}
-static GPtrArray *
-fwupd_client_parse_releases_from_variant (GVariant *val)
-{
- GPtrArray *array = NULL;
- gsize sz;
- g_autoptr(GVariant) untuple = NULL;
-
- array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- untuple = g_variant_get_child_value (val, 0);
- sz = g_variant_n_children (untuple);
- for (guint i = 0; i < sz; i++) {
- FwupdRelease *rel;
- g_autoptr(GVariant) data = NULL;
- data = g_variant_get_child_value (untuple, i);
- rel = fwupd_release_from_variant (data);
- if (rel == NULL)
- continue;
- g_ptr_array_add (array, rel);
- }
- return array;
-}
-
-static GPtrArray *
-fwupd_client_parse_devices_from_variant (GVariant *val)
-{
- GPtrArray *array = NULL;
- gsize sz;
- g_autoptr(GVariant) untuple = NULL;
-
- array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- untuple = g_variant_get_child_value (val, 0);
- sz = g_variant_n_children (untuple);
- for (guint i = 0; i < sz; i++) {
- FwupdDevice *dev;
- g_autoptr(GVariant) data = NULL;
- data = g_variant_get_child_value (untuple, i);
- dev = fwupd_device_from_variant (data);
- if (dev == NULL)
- continue;
- g_ptr_array_add (array, dev);
- }
- return array;
-}
-
-static GPtrArray *
-fwupd_client_parse_remotes_from_data (GVariant *devices)
-{
- GPtrArray *remotes = NULL;
- gsize sz;
- g_autoptr(GVariant) untuple = NULL;
-
- remotes = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- untuple = g_variant_get_child_value (devices, 0);
- sz = g_variant_n_children (untuple);
- for (guint i = 0; i < sz; i++) {
- g_autoptr(GVariant) data = g_variant_get_child_value (untuple, i);
- FwupdRemote *remote = fwupd_remote_from_variant (data);
- g_ptr_array_add (remotes, remote);
- }
-
- return remotes;
-}
-
static void
fwupd_client_fixup_dbus_error (GError *error)
{
@@ -385,7 +324,7 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_devices_from_variant (val);
+ return fwupd_device_array_from_variant (val);
}
/**
@@ -427,7 +366,7 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_devices_from_variant (val);
+ return fwupd_device_array_from_variant (val);
}
/**
@@ -516,7 +455,7 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_releases_from_variant (val);
+ return fwupd_release_array_from_variant (val);
}
/**
@@ -561,7 +500,7 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_releases_from_variant (val);
+ return fwupd_release_array_from_variant (val);
}
/**
@@ -606,7 +545,7 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_releases_from_variant (val);
+ return fwupd_release_array_from_variant (val);
}
static void
@@ -623,6 +562,104 @@
}
/**
+ * fwupd_client_modify_config
+ * @client: A #FwupdClient
+ * @key: key, e.g. `BlacklistPlugins`
+ * @value: value, e.g. `*`
+ * @cancellable: the #GCancellable, or %NULL
+ * @error: the #GError, or %NULL
+ *
+ * Modifies a daemon config option.
+ * The daemon will only respond to this request with proper permissions
+ *
+ * Returns: %TRUE for success
+ *
+ * Since: 1.2.8
+ **/
+gboolean
+fwupd_client_modify_config (FwupdClient *client, const gchar *key, const gchar *value,
+ GCancellable *cancellable, GError **error)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ g_autoptr(FwupdClientHelper) helper = NULL;
+
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* connect */
+ if (!fwupd_client_connect (client, cancellable, error))
+ return FALSE;
+
+ /* call into daemon */
+ helper = fwupd_client_helper_new ();
+ g_dbus_proxy_call (priv->proxy,
+ "ModifyConfig",
+ g_variant_new ("(ss)", key, value),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ fwupd_client_proxy_call_cb,
+ helper);
+ g_main_loop_run (helper->loop);
+ if (!helper->ret) {
+ g_propagate_error (error, helper->error);
+ helper->error = NULL;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * fwupd_client_activate:
+ * @client: A #FwupdClient
+ * @cancellable: the #GCancellable, or %NULL
+ * @device_id: a device
+ * @error: the #GError, or %NULL
+ *
+ * Activates up a device, which normally means the device switches to a new
+ * firmware version. This should only be called when data loss cannot occur.
+ *
+ * Returns: %TRUE for success
+ *
+ * Since: 1.2.6
+ **/
+gboolean
+fwupd_client_activate (FwupdClient *client, GCancellable *cancellable,
+ const gchar *device_id, GError **error)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ g_autoptr(FwupdClientHelper) helper = NULL;
+
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (device_id != NULL, FALSE);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* connect */
+ if (!fwupd_client_connect (client, cancellable, error))
+ return FALSE;
+
+ /* call into daemon */
+ helper = fwupd_client_helper_new ();
+ g_dbus_proxy_call (priv->proxy,
+ "Activate",
+ g_variant_new ("(s)", device_id),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ fwupd_client_proxy_call_cb,
+ helper);
+ g_main_loop_run (helper->loop);
+ if (!helper->ret) {
+ g_propagate_error (error, helper->error);
+ helper->error = NULL;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
* fwupd_client_verify:
* @client: A #FwupdClient
* @device_id: the device ID
@@ -924,7 +961,7 @@
return FALSE;
/* set options */
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&builder, "{sv}",
"reason", g_variant_new_string ("user-action"));
g_variant_builder_add (&builder, "{sv}",
@@ -945,6 +982,10 @@
g_variant_builder_add (&builder, "{sv}",
"force", g_variant_new_boolean (TRUE));
}
+ if (install_flags & FWUPD_INSTALL_FLAG_NO_HISTORY) {
+ g_variant_builder_add (&builder, "{sv}",
+ "no-history", g_variant_new_boolean (TRUE));
+ }
/* open file */
fd = open (filename, O_RDONLY);
@@ -1070,7 +1111,7 @@
}
/* return results */
- return fwupd_client_parse_devices_from_variant (helper->val);
+ return fwupd_device_array_from_variant (helper->val);
}
/**
@@ -1128,6 +1169,24 @@
}
/**
+ * fwupd_client_get_tainted:
+ * @client: A #FwupdClient
+ *
+ * Gets if the daemon has been tainted by 3rd party code.
+ *
+ * Returns: %TRUE if the daemon is unsupported
+ *
+ * Since: 1.2.4
+ **/
+gboolean
+fwupd_client_get_tainted (FwupdClient *client)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
+ return priv->tainted;
+}
+
+/**
* fwupd_client_update_metadata:
* @client: A #FwupdClient
* @remote_id: the remote ID, e.g. `lvfs-testing`
@@ -1269,7 +1328,161 @@
fwupd_client_fixup_dbus_error (*error);
return NULL;
}
- return fwupd_client_parse_remotes_from_data (val);
+ return fwupd_remote_array_from_variant (val);
+}
+
+/**
+ * fwupd_client_get_approved_firmware:
+ * @client: A #FwupdClient
+ * @cancellable: the #GCancellable, or %NULL
+ * @error: the #GError, or %NULL
+ *
+ * Gets the list of approved firmware.
+ *
+ * Returns: (transfer full): list of remotes, or %NULL
+ *
+ * Since: 1.2.6
+ **/
+gchar **
+fwupd_client_get_approved_firmware (FwupdClient *client,
+ GCancellable *cancellable,
+ GError **error)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ g_autoptr(GVariant) val = NULL;
+ gchar **retval = NULL;
+
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ /* connect */
+ if (!fwupd_client_connect (client, cancellable, error))
+ return NULL;
+
+ /* call into daemon */
+ val = g_dbus_proxy_call_sync (priv->proxy,
+ "GetApprovedFirmware",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ error);
+ if (val == NULL) {
+ if (error != NULL)
+ fwupd_client_fixup_dbus_error (*error);
+ return NULL;
+ }
+ g_variant_get (val, "(^as)", &retval);
+ return retval;
+}
+
+/**
+ * fwupd_client_set_approved_firmware:
+ * @client: A #FwupdClient
+ * @checksums: Array of checksums
+ * @cancellable: the #GCancellable, or %NULL
+ * @error: the #GError, or %NULL
+ *
+ * Sets the list of approved firmware.
+ *
+ * Returns: %TRUE for success
+ *
+ * Since: 1.2.6
+ **/
+gboolean
+fwupd_client_set_approved_firmware (FwupdClient *client,
+ gchar **checksums,
+ GCancellable *cancellable,
+ GError **error)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ g_autoptr(GVariant) val = NULL;
+
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* connect */
+ if (!fwupd_client_connect (client, cancellable, error))
+ return FALSE;
+
+ /* call into daemon */
+ val = g_dbus_proxy_call_sync (priv->proxy,
+ "SetApprovedFirmware",
+ g_variant_new ("(^as)", checksums),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ error);
+ if (val == NULL) {
+ if (error != NULL)
+ fwupd_client_fixup_dbus_error (*error);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * fwupd_client_self_sign:
+ * @client: A #FwupdClient
+ * @value: A string to sign, typically a JSON blob
+ * @flags: #FwupdSelfSignFlags, e.g. %FWUPD_SELF_SIGN_FLAG_ADD_TIMESTAMP
+ * @cancellable: the #GCancellable, or %NULL
+ * @error: the #GError, or %NULL
+ *
+ * Signs the data using the client self-signed certificate.
+ *
+ * Returns: %TRUE for success
+ *
+ * Since: 1.2.6
+ **/
+gchar *
+fwupd_client_self_sign (FwupdClient *client,
+ const gchar *value,
+ FwupdSelfSignFlags flags,
+ GCancellable *cancellable,
+ GError **error)
+{
+ FwupdClientPrivate *priv = GET_PRIVATE (client);
+ GVariantBuilder builder;
+ g_autoptr(GVariant) val = NULL;
+ gchar *retval = NULL;
+
+ g_return_val_if_fail (FWUPD_IS_CLIENT (client), NULL);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ /* connect */
+ if (!fwupd_client_connect (client, cancellable, error))
+ return NULL;
+
+ /* set options */
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+ if (flags & FWUPD_SELF_SIGN_FLAG_ADD_TIMESTAMP) {
+ g_variant_builder_add (&builder, "{sv}",
+ "add-timestamp", g_variant_new_boolean (TRUE));
+ }
+ if (flags & FWUPD_SELF_SIGN_FLAG_ADD_CERT) {
+ g_variant_builder_add (&builder, "{sv}",
+ "add-cert", g_variant_new_boolean (TRUE));
+ }
+
+ /* call into daemon */
+ val = g_dbus_proxy_call_sync (priv->proxy,
+ "SelfSign",
+ g_variant_new ("(sa{sv})", value, &builder),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ cancellable,
+ error);
+ if (val == NULL) {
+ if (error != NULL)
+ fwupd_client_fixup_dbus_error (*error);
+ return NULL;
+ }
+ g_variant_get (val, "(s)", &retval);
+ return retval;
}
/**
@@ -1450,6 +1663,9 @@
case PROP_STATUS:
g_value_set_uint (value, priv->status);
break;
+ case PROP_TAINTED:
+ g_value_set_boolean (value, priv->tainted);
+ break;
case PROP_PERCENTAGE:
g_value_set_uint (value, priv->percentage);
break;
@@ -1584,10 +1800,21 @@
*/
pspec = g_param_spec_uint ("status", NULL, NULL,
0, FWUPD_STATUS_LAST, FWUPD_STATUS_UNKNOWN,
- G_PARAM_READWRITE);
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_STATUS, pspec);
/**
+ * FwupdClient:tainted:
+ *
+ * If the daemon is tainted by 3rd party code.
+ *
+ * Since: 1.2.4
+ */
+ pspec = g_param_spec_boolean ("tainted", NULL, NULL, FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_NAME);
+ g_object_class_install_property (object_class, PROP_TAINTED, pspec);
+
+ /**
* FwupdClient:percentage:
*
* The last-reported percentage of the daemon.
@@ -1596,7 +1823,7 @@
*/
pspec = g_param_spec_uint ("percentage", NULL, NULL,
0, 100, 0,
- G_PARAM_READWRITE);
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_PERCENTAGE, pspec);
/**
@@ -1607,7 +1834,7 @@
* Since: 0.9.6
*/
pspec = g_param_spec_string ("daemon-version", NULL, NULL,
- NULL, G_PARAM_READABLE);
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_DAEMON_VERSION, pspec);
}
diff -Nru fwupd-1.0.6/libfwupd/fwupd-client.h fwupd-1.2.10/libfwupd/fwupd-client.h
--- fwupd-1.0.6/libfwupd/fwupd-client.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-client.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_CLIENT_H
-#define __FWUPD_CLIENT_H
+#pragma once
#include
#include
@@ -94,6 +78,15 @@
const gchar *device_id,
GCancellable *cancellable,
GError **error);
+gboolean fwupd_client_modify_config (FwupdClient *client,
+ const gchar *key,
+ const gchar *value,
+ GCancellable *cancellable,
+ GError **error);
+gboolean fwupd_client_activate (FwupdClient *client,
+ GCancellable *cancellable,
+ const gchar *device_id,
+ GError **error);
gboolean fwupd_client_clear_results (FwupdClient *client,
const gchar *device_id,
GCancellable *cancellable,
@@ -131,6 +124,7 @@
GCancellable *cancellable,
GError **error);
FwupdStatus fwupd_client_get_status (FwupdClient *client);
+gboolean fwupd_client_get_tainted (FwupdClient *client);
guint fwupd_client_get_percentage (FwupdClient *client);
const gchar *fwupd_client_get_daemon_version (FwupdClient *client);
@@ -142,7 +136,17 @@
GCancellable *cancellable,
GError **error);
-G_END_DECLS
-
-#endif /* __FWUPD_CLIENT_H */
+gchar **fwupd_client_get_approved_firmware (FwupdClient *client,
+ GCancellable *cancellable,
+ GError **error);
+gboolean fwupd_client_set_approved_firmware (FwupdClient *client,
+ gchar **checksums,
+ GCancellable *cancellable,
+ GError **error);
+gchar *fwupd_client_self_sign (FwupdClient *client,
+ const gchar *value,
+ FwupdSelfSignFlags flags,
+ GCancellable *cancellable,
+ GError **error);
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-common.c fwupd-1.2.10/libfwupd/fwupd-common.c
--- fwupd-1.0.6/libfwupd/fwupd-common.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-common.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -31,6 +16,10 @@
#include
#include
+#if !GLIB_CHECK_VERSION(2,54,0)
+#include
+#endif
+
/**
* fwupd_checksum_guess_kind:
* @checksum: A checksum
@@ -60,7 +49,7 @@
}
static const gchar *
-_g_checksum_type_to_string (GChecksumType checksum_type)
+fwupd_checksum_type_to_string_display (GChecksumType checksum_type)
{
if (checksum_type == G_CHECKSUM_MD5)
return "MD5";
@@ -87,7 +76,9 @@
fwupd_checksum_format_for_display (const gchar *checksum)
{
GChecksumType kind = fwupd_checksum_guess_kind (checksum);
- return g_strdup_printf ("%s(%s)", _g_checksum_type_to_string (kind), checksum);
+ return g_strdup_printf ("%s(%s)",
+ fwupd_checksum_type_to_string_display (kind),
+ checksum);
}
/**
@@ -141,13 +132,17 @@
}
/**
- * fwupd_build_distro_hash:
+ * fwupd_get_os_release:
* @error: A #GError or %NULL
*
* Loads information from the system os-release file.
+ *
+ * Returns: (transfer container) (element-type utf8 utf8): keys from os-release
+ *
+ * Since: 1.0.7
**/
-static GHashTable *
-fwupd_build_distro_hash (GError **error)
+GHashTable *
+fwupd_get_os_release (GError **error)
{
GHashTable *hash;
const gchar *filename = NULL;
@@ -208,7 +203,7 @@
g_autoptr(GPtrArray) ids_os = g_ptr_array_new ();
/* get all keys */
- hash = fwupd_build_distro_hash (NULL);
+ hash = fwupd_get_os_release (NULL);
if (hash == NULL)
return NULL;
@@ -227,12 +222,13 @@
static gchar *
fwupd_build_user_agent_system (void)
{
- struct utsname name_tmp = { 0 };
+ struct utsname name_tmp;
g_autofree gchar *locale = NULL;
g_autofree gchar *os_release = NULL;
g_autoptr(GPtrArray) ids = g_ptr_array_new_with_free_func (g_free);
/* system, architecture and kernel, e.g. "Linux i686 4.14.5" */
+ memset (&name_tmp, 0, sizeof(struct utsname));
if (uname (&name_tmp) >= 0) {
g_ptr_array_add (ids, g_strdup_printf ("%s %s %s",
name_tmp.sysname,
@@ -366,6 +362,24 @@
checksums = fwupd_release_get_checksums (rel);
json_builder_add_string_value (builder, fwupd_checksum_get_by_kind (checksums, G_CHECKSUM_SHA1));
+ /* identify the firmware written */
+ checksums = fwupd_device_get_checksums (dev);
+ if (checksums->len > 0) {
+ json_builder_set_member_name (builder, "ChecksumDevice");
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < checksums->len; i++) {
+ const gchar *checksum = g_ptr_array_index (checksums, i);
+ json_builder_add_string_value (builder, checksum);
+ }
+ json_builder_end_array (builder);
+ }
+
+ /* include the protocol used */
+ if (fwupd_release_get_protocol (rel) != NULL) {
+ json_builder_set_member_name (builder, "Protocol");
+ json_builder_add_string_value (builder, fwupd_release_get_protocol (rel));
+ }
+
/* set the error state of the report */
json_builder_set_member_name (builder, "UpdateState");
json_builder_add_int_value (builder, fwupd_device_get_update_state (dev));
@@ -373,6 +387,10 @@
json_builder_set_member_name (builder, "UpdateError");
json_builder_add_string_value (builder, fwupd_device_get_update_error (dev));
}
+ if (fwupd_release_get_update_message (rel) != NULL) {
+ json_builder_set_member_name (builder, "UpdateMessage");
+ json_builder_add_string_value (builder, fwupd_release_get_update_message (rel));
+ }
/* map back to the dev type on the LVFS */
json_builder_set_member_name (builder, "Guid");
@@ -419,7 +437,7 @@
};
/* get all required os-release keys */
- hash = fwupd_build_distro_hash (error);
+ hash = fwupd_get_os_release (error);
if (hash == NULL)
return FALSE;
for (guint i = 0; distro_kv[i].key != NULL; i++) {
@@ -457,7 +475,7 @@
/* get a hash that represents the machine */
machine_id = fwupd_build_machine_id ("fwupd", error);
if (machine_id == NULL)
- return FALSE;
+ return NULL;
/* create header */
builder = json_builder_new ();
@@ -471,7 +489,7 @@
json_builder_set_member_name (builder, "Metadata");
json_builder_begin_object (builder);
if (!fwupd_build_history_report_json_metadata (builder, error))
- return FALSE;
+ return NULL;
json_builder_end_object (builder);
/* add each device */
@@ -501,3 +519,305 @@
}
return data;
}
+
+#define FWUPD_GUID_NAMESPACE_DEFAULT "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
+#define FWUPD_GUID_NAMESPACE_MICROSOFT "70ffd812-4c7f-4c7d-0000-000000000000"
+
+typedef struct __attribute__((packed)) {
+ guint32 a;
+ guint16 b;
+ guint16 c;
+ guint16 d;
+ guint8 e[6];
+} fwupd_guid_native_t;
+
+/**
+ * fwupd_guid_to_string:
+ * @guid: a #fwupd_guid_t to read
+ * @flags: some %FwupdGuidFlags, e.g. %FWUPD_GUID_FLAG_MIXED_ENDIAN
+ *
+ * Returns a text GUID of mixed or BE endian for a packed buffer.
+ *
+ * Returns: A new GUID
+ *
+ * Since: 1.2.5
+ **/
+gchar *
+fwupd_guid_to_string (const fwupd_guid_t *guid, FwupdGuidFlags flags)
+{
+ fwupd_guid_native_t gnat;
+
+ g_return_val_if_fail (guid != NULL, NULL);
+
+ /* copy to avoid issues with aligning */
+ memcpy (&gnat, guid, sizeof(gnat));
+
+ /* mixed is bizaar, but specified as the DCE encoding */
+ if (flags & FWUPD_GUID_FLAG_MIXED_ENDIAN) {
+ return g_strdup_printf ("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ GUINT32_FROM_LE(gnat.a),
+ GUINT16_FROM_LE(gnat.b),
+ GUINT16_FROM_LE(gnat.c),
+ GUINT16_FROM_BE(gnat.d),
+ gnat.e[0], gnat.e[1],
+ gnat.e[2], gnat.e[3],
+ gnat.e[4], gnat.e[5]);
+ }
+ return g_strdup_printf ("%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ GUINT32_FROM_BE(gnat.a),
+ GUINT16_FROM_BE(gnat.b),
+ GUINT16_FROM_BE(gnat.c),
+ GUINT16_FROM_BE(gnat.d),
+ gnat.e[0], gnat.e[1],
+ gnat.e[2], gnat.e[3],
+ gnat.e[4], gnat.e[5]);
+}
+
+#if !GLIB_CHECK_VERSION(2,54,0)
+static gboolean
+str_has_sign (const gchar *str)
+{
+ return str[0] == '-' || str[0] == '+';
+}
+
+static gboolean
+str_has_hex_prefix (const gchar *str)
+{
+ return str[0] == '0' && g_ascii_tolower (str[1]) == 'x';
+}
+
+static gboolean
+g_ascii_string_to_unsigned (const gchar *str,
+ guint base,
+ guint64 min,
+ guint64 max,
+ guint64 *out_num,
+ GError **error)
+{
+ const gchar *end_ptr = NULL;
+ gint saved_errno = 0;
+ guint64 number;
+
+ g_return_val_if_fail (str != NULL, FALSE);
+ g_return_val_if_fail (base >= 2 && base <= 36, FALSE);
+ g_return_val_if_fail (min <= max, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (str[0] == '\0') {
+ g_set_error_literal (error,
+ G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "Empty string is not a number");
+ return FALSE;
+ }
+
+ errno = 0;
+ number = g_ascii_strtoull (str, (gchar **)&end_ptr, base);
+ saved_errno = errno;
+
+ if (g_ascii_isspace (str[0]) || str_has_sign (str) ||
+ (base == 16 && str_has_hex_prefix (str)) ||
+ (saved_errno != 0 && saved_errno != ERANGE) ||
+ end_ptr == NULL ||
+ *end_ptr != '\0') {
+ g_set_error (error,
+ G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "“%s” is not an unsigned number", str);
+ return FALSE;
+ }
+ if (saved_errno == ERANGE || number < min || number > max) {
+ g_autofree gchar *min_str = g_strdup_printf ("%" G_GUINT64_FORMAT, min);
+ g_autofree gchar *max_str = g_strdup_printf ("%" G_GUINT64_FORMAT, max);
+ g_set_error (error,
+ G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "Number “%s” is out of bounds [%s, %s]",
+ str, min_str, max_str);
+ return FALSE;
+ }
+ if (out_num != NULL)
+ *out_num = number;
+ return TRUE;
+}
+#endif /* GLIB_CHECK_VERSION(2,54,0) */
+
+/**
+ * fwupd_guid_from_string:
+ * @guidstr: (nullable): a GUID, e.g. `00112233-4455-6677-8899-aabbccddeeff`
+ * @guid: a #fwupd_guid_t, or NULL to just check the GUID
+ * @flags: some %FwupdGuidFlags, e.g. %FWUPD_GUID_FLAG_MIXED_ENDIAN
+ * @error: A #GError or %NULL
+ *
+ * Converts a string GUID into its binary encoding. All string GUIDs are
+ * formatted as big endian but on-disk can be encoded in different ways.
+ *
+ * Returns: %TRUE for success
+ *
+ * Since: 1.2.5
+ **/
+gboolean
+fwupd_guid_from_string (const gchar *guidstr,
+ fwupd_guid_t *guid,
+ FwupdGuidFlags flags,
+ GError **error)
+{
+ fwupd_guid_native_t gu = { 0x0 };
+ gboolean mixed_endian = flags & FWUPD_GUID_FLAG_MIXED_ENDIAN;
+ guint64 tmp;
+ g_auto(GStrv) split = NULL;
+
+ g_return_val_if_fail (guidstr != NULL, FALSE);
+
+ /* split into sections */
+ if (strlen (guidstr) != 36) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "is not valid format");
+ return FALSE;
+ }
+ split = g_strsplit (guidstr, "-", 5);
+ if (g_strv_length (split) != 5) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "is not valid format, no dashes");
+ return FALSE;
+ }
+ if (strlen (split[0]) != 8 && strlen (split[1]) != 4 &&
+ strlen (split[2]) != 4 && strlen (split[3]) != 4 &&
+ strlen (split[4]) != 12) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "is not valid format, not GUID");
+ return FALSE;
+ }
+
+ /* parse */
+ if (!g_ascii_string_to_unsigned (split[0], 16, 0, 0xffffffff, &tmp, error))
+ return FALSE;
+ gu.a = mixed_endian ? GUINT32_TO_LE(tmp) : GUINT32_TO_BE(tmp);
+ if (!g_ascii_string_to_unsigned (split[1], 16, 0, 0xffff, &tmp, error))
+ return FALSE;
+ gu.b = mixed_endian ? GUINT16_TO_LE(tmp) : GUINT16_TO_BE(tmp);
+ if (!g_ascii_string_to_unsigned (split[2], 16, 0, 0xffff, &tmp, error))
+ return FALSE;
+ gu.c = mixed_endian ? GUINT16_TO_LE(tmp) : GUINT16_TO_BE(tmp);
+ if (!g_ascii_string_to_unsigned (split[3], 16, 0, 0xffff, &tmp, error))
+ return FALSE;
+ gu.d = GUINT16_TO_BE(tmp);
+ for (guint i = 0; i < 6; i++) {
+ gchar buffer[3] = { 0x0 };
+ memcpy (buffer, split[4] + (i * 2), 2);
+ if (!g_ascii_string_to_unsigned (buffer, 16, 0, 0xff, &tmp, error))
+ return FALSE;
+ gu.e[i] = tmp;
+ }
+ if (guid != NULL)
+ memcpy (guid, &gu, sizeof(gu));
+
+ /* success */
+ return TRUE;
+}
+
+/**
+ * fwupd_guid_hash_data:
+ * @data: data to hash
+ * @datasz: length of @data
+ * @flags: some %FwupdGuidFlags, e.g. %FWUPD_GUID_FLAG_NAMESPACE_MICROSOFT
+ *
+ * Returns a GUID for some data. This uses a hash and so even small
+ * differences in the @data will produce radically different return values.
+ *
+ * The implementation is taken from RFC4122, Section 4.1.3; specifically
+ * using a type-5 SHA-1 hash.
+ *
+ * Returns: A new GUID, or %NULL for internal error
+ *
+ * Since: 1.2.5
+ **/
+gchar *
+fwupd_guid_hash_data (const guint8 *data, gsize datasz, FwupdGuidFlags flags)
+{
+ const gchar *namespace_id = FWUPD_GUID_NAMESPACE_DEFAULT;
+ gsize digestlen = 20;
+ guint8 hash[20];
+ fwupd_guid_t uu_namespace;
+ fwupd_guid_t uu_new;
+ g_autoptr(GChecksum) csum = NULL;
+
+ g_return_val_if_fail (namespace_id != NULL, NULL);
+ g_return_val_if_fail (data != NULL, NULL);
+ g_return_val_if_fail (datasz != 0, NULL);
+
+ /* old MS GUID */
+ if (flags & FWUPD_GUID_FLAG_NAMESPACE_MICROSOFT)
+ namespace_id = FWUPD_GUID_NAMESPACE_MICROSOFT;
+
+ /* convert the namespace to binary: hardcoded BE, not @flags */
+ if (!fwupd_guid_from_string (namespace_id, &uu_namespace, FWUPD_GUID_FLAG_NONE, NULL))
+ return NULL;
+
+ /* hash the namespace and then the string */
+ csum = g_checksum_new (G_CHECKSUM_SHA1);
+ g_checksum_update (csum, (guchar *) &uu_namespace, sizeof(uu_namespace));
+ g_checksum_update (csum, (guchar *) data, (gssize) datasz);
+ g_checksum_get_digest (csum, hash, &digestlen);
+
+ /* copy most parts of the hash 1:1 */
+ memcpy (uu_new, hash, sizeof(uu_new));
+
+ /* set specific bits according to Section 4.1.3 */
+ uu_new[6] = (guint8) ((uu_new[6] & 0x0f) | (5 << 4));
+ uu_new[8] = (guint8) ((uu_new[8] & 0x3f) | 0x80);
+ return fwupd_guid_to_string ((const fwupd_guid_t *) &uu_new, flags);
+}
+
+/**
+ * fwupd_guid_is_valid:
+ * @guid: string to check, e.g. `00112233-4455-6677-8899-aabbccddeeff`
+ *
+ * Checks the string is a valid GUID.
+ *
+ * Returns: %TRUE if @guid was a valid GUID, %FALSE otherwise
+ *
+ * Since: 1.2.5
+ **/
+gboolean
+fwupd_guid_is_valid (const gchar *guid)
+{
+ if (guid == NULL)
+ return FALSE;
+ if (!fwupd_guid_from_string (guid, NULL, FWUPD_GUID_FLAG_NONE, NULL))
+ return FALSE;
+ if (g_strcmp0 (guid, "00000000-0000-0000-0000-000000000000") == 0)
+ return FALSE;
+ return TRUE;
+}
+
+/**
+ * fwupd_guid_hash_string:
+ * @str: A source string to use as a key
+ *
+ * Returns a GUID for a given string. This uses a hash and so even small
+ * differences in the @str will produce radically different return values.
+ *
+ * The default implementation is taken from RFC4122, Section 4.1.3; specifically
+ * using a type-5 SHA-1 hash with a DNS namespace.
+ * The same result can be obtained with this simple python program:
+ *
+ * #!/usr/bin/python
+ * import uuid
+ * print uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
+ *
+ * Returns: A new GUID, or %NULL if the string was invalid
+ *
+ * Since: 1.2.5
+ **/
+gchar *
+fwupd_guid_hash_string (const gchar *str)
+{
+ if (str == NULL || str[0] == '\0')
+ return NULL;
+ return fwupd_guid_hash_data ((const guint8 *) str, strlen (str),
+ FWUPD_GUID_FLAG_NONE);
+}
diff -Nru fwupd-1.0.6/libfwupd/fwupd-common.h fwupd-1.2.10/libfwupd/fwupd-common.h
--- fwupd-1.0.6/libfwupd/fwupd-common.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-common.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,35 +1,42 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_COMMON_H
-#define __FWUPD_COMMON_H
+#pragma once
#include
+G_BEGIN_DECLS
+
#define FWUPD_DBUS_PATH "/"
#define FWUPD_DBUS_SERVICE "org.freedesktop.fwupd"
#define FWUPD_DBUS_INTERFACE "org.freedesktop.fwupd"
#define FWUPD_DEVICE_ID_ANY "*"
+/**
+ * FwupdGuidFlags:
+ * @FWUPD_GUID_FLAG_NONE: No trust
+ * @FWUPD_GUID_FLAG_NAMESPACE_MICROSOFT: Use the Microsoft-compatible namespace
+ * @FWUPD_GUID_FLAG_MIXED_ENDIAN: Use EFI mixed endian representation
+ *
+ * The flags to show how the data should be converted.
+ **/
+typedef enum {
+ FWUPD_GUID_FLAG_NONE = 0, /* Since: 1.2.5 */
+ FWUPD_GUID_FLAG_NAMESPACE_MICROSOFT = 1 << 0, /* Since: 1.2.5 */
+ FWUPD_GUID_FLAG_MIXED_ENDIAN = 1 << 1, /* Since: 1.2.5 */
+ /*< private >*/
+ FWUPD_GUID_FLAG_LAST
+} FwupdGuidFlags;
+
+/* GObject Introspection does not understand typedefs with sizes */
+#ifndef __GI_SCANNER__
+typedef guint8 fwupd_guid_t[16];
+#endif
+
const gchar *fwupd_checksum_get_best (GPtrArray *checksums);
const gchar *fwupd_checksum_get_by_kind (GPtrArray *checksums,
GChecksumType kind);
@@ -38,7 +45,28 @@
const gchar *package_version);
gchar *fwupd_build_machine_id (const gchar *salt,
GError **error);
+GHashTable *fwupd_get_os_release (GError **error);
gchar *fwupd_build_history_report_json (GPtrArray *devices,
GError **error);
+#ifndef __GI_SCANNER__
+gchar *fwupd_guid_to_string (const fwupd_guid_t *guid,
+ FwupdGuidFlags flags);
+gboolean fwupd_guid_from_string (const gchar *guidstr,
+ fwupd_guid_t *guid,
+ FwupdGuidFlags flags,
+ GError **error);
+#else
+gchar *fwupd_guid_to_string (const guint8 guid[16],
+ FwupdGuidFlags flags);
+gboolean fwupd_guid_from_string (const gchar *guidstr,
+ guint8 guid[16],
+ FwupdGuidFlags flags,
+ GError **error);
+#endif
+gboolean fwupd_guid_is_valid (const gchar *guid);
+gchar *fwupd_guid_hash_string (const gchar *str);
+gchar *fwupd_guid_hash_data (const guint8 *data,
+ gsize datasz,
+ FwupdGuidFlags flags);
-#endif /* __FWUPD_COMMON_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-common-private.h fwupd-1.2.10/libfwupd/fwupd-common-private.h
--- fwupd-1.0.6/libfwupd/fwupd-common-private.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-common-private.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,31 +1,17 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_COMMON_PRIVATE_H
-#define __FWUPD_COMMON_PRIVATE_H
+#pragma once
#include
#include "fwupd-common.h"
+G_BEGIN_DECLS
+
gchar *fwupd_checksum_format_for_display (const gchar *checksum);
-#endif /* __FWUPD_COMMON_PRIVATE_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-deprecated.h fwupd-1.2.10/libfwupd/fwupd-deprecated.h
--- fwupd-1.0.6/libfwupd/fwupd-deprecated.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-deprecated.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,27 +1,13 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_DEPRECATED_H
-#define __FWUPD_DEPRECATED_H
+#pragma once
+
+G_BEGIN_DECLS
/* indeed, nothing */
-#endif /* __FWUPD_DEPRECATED_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-device.c fwupd-1.2.10/libfwupd/fwupd-device.c
--- fwupd-1.0.6/libfwupd/fwupd-device.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-device.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -44,13 +29,15 @@
typedef struct {
gchar *id;
+ gchar *parent_id;
guint64 created;
guint64 modified;
guint64 flags;
- gchar *appstream_id;
GPtrArray *guids;
+ GPtrArray *instance_ids;
GPtrArray *icons;
gchar *name;
+ gchar *serial;
gchar *summary;
gchar *description;
gchar *vendor;
@@ -60,13 +47,23 @@
gchar *version;
gchar *version_lowest;
gchar *version_bootloader;
+ FwupdVersionFormat version_format;
GPtrArray *checksums;
guint32 flashes_left;
+ guint32 install_duration;
FwupdUpdateState update_state;
gchar *update_error;
+ gchar *update_message;
GPtrArray *releases;
+ FwupdDevice *parent;
} FwupdDevicePrivate;
+enum {
+ PROP_0,
+ PROP_VERSION_FORMAT,
+ PROP_LAST
+};
+
G_DEFINE_TYPE_WITH_PRIVATE (FwupdDevice, fwupd_device, G_TYPE_OBJECT)
#define GET_PRIVATE(o) (fwupd_device_get_instance_private (o))
@@ -148,6 +145,42 @@
}
/**
+ * fwupd_device_get_serial:
+ * @device: A #FwupdDevice
+ *
+ * Gets the serial number for the device.
+ *
+ * Returns: a string value, or %NULL if never set.
+ *
+ * Since: 1.1.2
+ **/
+const gchar *
+fwupd_device_get_serial (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
+ return priv->serial;
+}
+
+/**
+ * fwupd_device_set_serial:
+ * @device: A #FwupdDevice
+ * @serial: the device serial number
+ *
+ * Sets the serial number for the device.
+ *
+ * Since: 1.1.2
+ **/
+void
+fwupd_device_set_serial (FwupdDevice *device, const gchar *serial)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ g_free (priv->serial);
+ priv->serial = g_strdup (serial);
+}
+
+/**
* fwupd_device_get_id:
* @device: A #FwupdDevice
*
@@ -184,6 +217,77 @@
}
/**
+ * fwupd_device_get_parent_id:
+ * @device: A #FwupdDevice
+ *
+ * Gets the ID.
+ *
+ * Returns: the parent ID, or %NULL if unset
+ *
+ * Since: 1.0.8
+ **/
+const gchar *
+fwupd_device_get_parent_id (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
+ return priv->parent_id;
+}
+
+/**
+ * fwupd_device_set_parent_id:
+ * @device: A #FwupdDevice
+ * @parent_id: the device ID, e.g. `USB:foo`
+ *
+ * Sets the parent ID.
+ *
+ * Since: 1.0.8
+ **/
+void
+fwupd_device_set_parent_id (FwupdDevice *device, const gchar *parent_id)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ g_free (priv->parent_id);
+ priv->parent_id = g_strdup (parent_id);
+}
+
+/**
+ * fwupd_device_get_parent:
+ * @device: A #FwupdDevice
+ *
+ * Gets the parent.
+ *
+ * Returns: (transfer none): the parent device, or %NULL if unset
+ *
+ * Since: 1.0.8
+ **/
+FwupdDevice *
+fwupd_device_get_parent (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
+ return priv->parent;
+}
+
+/**
+ * fwupd_device_set_parent:
+ * @device: A #FwupdDevice
+ * @parent: another #FwupdDevice, or %NULL
+ *
+ * Sets the parent. Only used internally.
+ *
+ * Since: 1.0.8
+ **/
+void
+fwupd_device_set_parent (FwupdDevice *device, FwupdDevice *parent)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ g_set_object (&priv->parent, parent);
+}
+
+/**
* fwupd_device_get_guids:
* @device: A #FwupdDevice
*
@@ -267,6 +371,69 @@
}
/**
+ * fwupd_device_get_instance_ids:
+ * @device: A #FwupdDevice
+ *
+ * Gets the InstanceIDs.
+ *
+ * Returns: (element-type utf8) (transfer none): the InstanceID
+ *
+ * Since: 1.2.5
+ **/
+GPtrArray *
+fwupd_device_get_instance_ids (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
+ return priv->instance_ids;
+}
+
+/**
+ * fwupd_device_has_instance_id:
+ * @device: A #FwupdDevice
+ * @instance_id: the InstanceID, e.g. `PCI\VEN_10EC&DEV_525A`
+ *
+ * Finds out if the device has this specific InstanceID.
+ *
+ * Returns: %TRUE if the InstanceID is found
+ *
+ * Since: 1.2.5
+ **/
+gboolean
+fwupd_device_has_instance_id (FwupdDevice *device, const gchar *instance_id)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), FALSE);
+
+ for (guint i = 0; i < priv->instance_ids->len; i++) {
+ const gchar *instance_id_tmp = g_ptr_array_index (priv->instance_ids, i);
+ if (g_strcmp0 (instance_id, instance_id_tmp) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * fwupd_device_add_instance_id:
+ * @device: A #FwupdDevice
+ * @instance_id: the GUID, e.g. `PCI\VEN_10EC&DEV_525A`
+ *
+ * Adds the InstanceID if it does not already exist.
+ *
+ * Since: 1.2.5
+ **/
+void
+fwupd_device_add_instance_id (FwupdDevice *device, const gchar *instance_id)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ if (fwupd_device_has_instance_id (device, instance_id))
+ return;
+ g_ptr_array_add (priv->instance_ids, g_strdup (instance_id));
+}
+
+/**
* fwupd_device_get_icons:
* @device: A #FwupdDevice
*
@@ -606,6 +773,41 @@
}
/**
+ * fwupd_device_get_install_duration:
+ * @device: A #FwupdDevice
+ *
+ * Gets the time estimate for firmware installation (in seconds)
+ *
+ * Returns: the estimated time to flash this device (or 0 if unset)
+ *
+ * Since: 1.1.3
+ **/
+guint32
+fwupd_device_get_install_duration (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), 0);
+ return priv->install_duration;
+}
+
+/**
+ * fwupd_device_set_install_duration:
+ * @device: A #FwupdDevice
+ * @duration: The amount of time
+ *
+ * Sets the time estimate for firmware installation (in seconds)
+ *
+ * Since: 1.1.3
+ **/
+void
+fwupd_device_set_install_duration (FwupdDevice *device, guint32 duration)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ priv->install_duration = duration;
+}
+
+/**
* fwupd_device_get_plugin:
* @device: A #FwupdDevice
*
@@ -801,17 +1003,98 @@
}
/**
- * fwupd_device_to_variant:
+ * fwupd_device_incorporate:
+ * @self: A #FwupdDevice
+ * @donor: Another #FwupdDevice
+ *
+ * Copy all properties from the donor object if they have not already been set.
+ *
+ * Since: 1.1.0
+ **/
+void
+fwupd_device_incorporate (FwupdDevice *self, FwupdDevice *donor)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (self);
+ FwupdDevicePrivate *priv_donor = GET_PRIVATE (donor);
+
+ if (priv->flags == 0)
+ fwupd_device_add_flag (self, priv_donor->flags);
+ if (priv->created == 0)
+ fwupd_device_set_created (self, priv_donor->created);
+ if (priv->modified == 0)
+ fwupd_device_set_modified (self, priv_donor->modified);
+ if (priv->flashes_left == 0)
+ fwupd_device_set_flashes_left (self, priv_donor->flashes_left);
+ if (priv->install_duration == 0)
+ fwupd_device_set_install_duration (self, priv_donor->install_duration);
+ if (priv->update_state == 0)
+ fwupd_device_set_update_state (self, priv_donor->update_state);
+ if (priv->description == NULL)
+ fwupd_device_set_description (self, priv_donor->description);
+ if (priv->id == NULL)
+ fwupd_device_set_id (self, priv_donor->id);
+ if (priv->parent_id == NULL)
+ fwupd_device_set_parent_id (self, priv_donor->parent_id);
+ if (priv->name == NULL)
+ fwupd_device_set_name (self, priv_donor->name);
+ if (priv->serial == NULL)
+ fwupd_device_set_serial (self, priv_donor->serial);
+ if (priv->summary == NULL)
+ fwupd_device_set_summary (self, priv_donor->summary);
+ if (priv->vendor == NULL)
+ fwupd_device_set_vendor (self, priv_donor->vendor);
+ if (priv->vendor_id == NULL)
+ fwupd_device_set_vendor_id (self, priv_donor->vendor_id);
+ if (priv->plugin == NULL)
+ fwupd_device_set_plugin (self, priv_donor->plugin);
+ if (priv->update_error == NULL)
+ fwupd_device_set_update_error (self, priv_donor->update_error);
+ if (priv->update_message == NULL)
+ fwupd_device_set_update_message (self, priv_donor->update_message);
+ if (priv->version == NULL)
+ fwupd_device_set_version (self, priv_donor->version);
+ if (priv->version_lowest == NULL)
+ fwupd_device_set_version_lowest (self, priv_donor->version_lowest);
+ if (priv->version_bootloader == NULL)
+ fwupd_device_set_version_bootloader (self, priv_donor->version_bootloader);
+ if (priv->version_format == FWUPD_VERSION_FORMAT_UNKNOWN)
+ fwupd_device_set_version_format (self, priv_donor->version_format);
+ for (guint i = 0; i < priv_donor->guids->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv_donor->guids, i);
+ fwupd_device_add_guid (self, tmp);
+ }
+ for (guint i = 0; i < priv_donor->instance_ids->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv_donor->instance_ids, i);
+ fwupd_device_add_instance_id (self, tmp);
+ }
+ for (guint i = 0; i < priv_donor->icons->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv_donor->icons, i);
+ fwupd_device_add_icon (self, tmp);
+ }
+ for (guint i = 0; i < priv_donor->checksums->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv_donor->checksums, i);
+ fwupd_device_add_checksum (self, tmp);
+ }
+ for (guint i = 0; i < priv_donor->releases->len; i++) {
+ FwupdRelease *tmp = g_ptr_array_index (priv_donor->releases, i);
+ fwupd_device_add_release (self, tmp);
+ }
+}
+
+/**
+ * fwupd_device_to_variant_full:
* @device: A #FwupdDevice
+ * @flags: #FwupdDeviceFlags for the call
*
* Creates a GVariant from the device data.
+ * Optionally provides additional data based upon flags
*
* Returns: the GVariant, or %NULL for error
*
- * Since: 1.0.0
+ * Since: 1.1.2
**/
GVariant *
-fwupd_device_to_variant (FwupdDevice *device)
+fwupd_device_to_variant_full (FwupdDevice *device, FwupdDeviceFlags flags)
{
FwupdDevicePrivate *priv = GET_PRIVATE (device);
GVariantBuilder builder;
@@ -819,12 +1102,17 @@
g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
/* create an array with all the metadata in */
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
if (priv->id != NULL) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_DEVICE_ID,
g_variant_new_string (priv->id));
}
+ if (priv->parent_id != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_PARENT_DEVICE_ID,
+ g_variant_new_string (priv->parent_id));
+ }
if (priv->guids->len > 0) {
const gchar * const *tmp = (const gchar * const *) priv->guids->pdata;
g_variant_builder_add (&builder, "{sv}",
@@ -915,16 +1203,44 @@
FWUPD_RESULT_KEY_FLASHES_LEFT,
g_variant_new_uint32 (priv->flashes_left));
}
+ if (priv->install_duration > 0) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_INSTALL_DURATION,
+ g_variant_new_uint32 (priv->install_duration));
+ }
if (priv->update_error != NULL) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_UPDATE_ERROR,
g_variant_new_string (priv->update_error));
}
+ if (priv->update_message != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_UPDATE_MESSAGE,
+ g_variant_new_string (priv->update_message));
+ }
if (priv->update_state != FWUPD_UPDATE_STATE_UNKNOWN) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_UPDATE_STATE,
g_variant_new_uint32 (priv->update_state));
}
+ if (priv->version_format != FWUPD_VERSION_FORMAT_UNKNOWN) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_VERSION_FORMAT,
+ g_variant_new_uint32 (priv->version_format));
+ }
+ if (flags & FWUPD_DEVICE_FLAG_TRUSTED) {
+ if (priv->serial != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_SERIAL,
+ g_variant_new_string (priv->serial));
+ }
+ if (priv->instance_ids->len > 0) {
+ const gchar * const *tmp = (const gchar * const *) priv->instance_ids->pdata;
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_INSTANCE_IDS,
+ g_variant_new_strv (tmp, priv->instance_ids->len));
+ }
+ }
/* create an array with all the metadata in */
if (priv->releases->len > 0) {
@@ -943,6 +1259,22 @@
return g_variant_new ("a{sv}", &builder);
}
+/**
+ * fwupd_device_to_variant:
+ * @device: A #FwupdDevice
+ *
+ * Creates a GVariant from the device data omitting sensitive fields
+ *
+ * Returns: the GVariant, or %NULL for error
+ *
+ * Since: 1.0.0
+ **/
+GVariant *
+fwupd_device_to_variant (FwupdDevice *device)
+{
+ return fwupd_device_to_variant_full (device, FWUPD_DEVICE_FLAG_NONE);
+}
+
static void
fwupd_device_from_key_value (FwupdDevice *device, const gchar *key, GVariant *value)
{
@@ -962,6 +1294,10 @@
fwupd_device_set_id (device, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_PARENT_DEVICE_ID) == 0) {
+ fwupd_device_set_parent_id (device, g_variant_get_string (value, NULL));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_FLAGS) == 0) {
fwupd_device_set_flags (device, g_variant_get_uint64 (value));
return;
@@ -976,13 +1312,19 @@
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_GUID) == 0) {
g_autofree const gchar **guids = g_variant_get_strv (value, NULL);
- for (guint i = 0; guids[i] != NULL; i++)
+ for (guint i = 0; guids != NULL && guids[i] != NULL; i++)
fwupd_device_add_guid (device, guids[i]);
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_INSTANCE_IDS) == 0) {
+ g_autofree const gchar **instance_ids = g_variant_get_strv (value, NULL);
+ for (guint i = 0; instance_ids != NULL && instance_ids[i] != NULL; i++)
+ fwupd_device_add_instance_id (device, instance_ids[i]);
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_ICON) == 0) {
g_autofree const gchar **icons = g_variant_get_strv (value, NULL);
- for (guint i = 0; icons[i] != NULL; i++)
+ for (guint i = 0; icons != NULL && icons[i] != NULL; i++)
fwupd_device_add_icon (device, icons[i]);
return;
}
@@ -998,6 +1340,10 @@
fwupd_device_set_vendor_id (device, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_SERIAL) == 0) {
+ fwupd_device_set_serial (device, g_variant_get_string (value, NULL));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_SUMMARY) == 0) {
fwupd_device_set_summary (device, g_variant_get_string (value, NULL));
return;
@@ -1008,9 +1354,11 @@
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_CHECKSUM) == 0) {
const gchar *checksums = g_variant_get_string (value, NULL);
- g_auto(GStrv) split = g_strsplit (checksums, ",", -1);
- for (guint i = 0; split[i] != NULL; i++)
- fwupd_device_add_checksum (device, split[i]);
+ if (checksums != NULL) {
+ g_auto(GStrv) split = g_strsplit (checksums, ",", -1);
+ for (guint i = 0; split[i] != NULL; i++)
+ fwupd_device_add_checksum (device, split[i]);
+ }
return;
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_PLUGIN) == 0) {
@@ -1033,14 +1381,26 @@
fwupd_device_set_flashes_left (device, g_variant_get_uint32 (value));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_INSTALL_DURATION) == 0) {
+ fwupd_device_set_install_duration (device, g_variant_get_uint32 (value));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_UPDATE_ERROR) == 0) {
fwupd_device_set_update_error (device, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_UPDATE_MESSAGE) == 0) {
+ fwupd_device_set_update_message (device, g_variant_get_string (value, NULL));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_UPDATE_STATE) == 0) {
fwupd_device_set_update_state (device, g_variant_get_uint32 (value));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_VERSION_FORMAT) == 0) {
+ fwupd_device_set_version_format (device, g_variant_get_uint32 (value));
+ return;
+ }
}
static void
@@ -1136,6 +1496,77 @@
}
/**
+ * fwupd_device_get_version_format:
+ * @device: A #FwupdDevice
+ *
+ * Gets the update state.
+ *
+ * Returns: the update state, or %FWUPD_VERSION_FORMAT_UNKNOWN if unset
+ *
+ * Since: 1.2.9
+ **/
+FwupdVersionFormat
+fwupd_device_get_version_format (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), FWUPD_VERSION_FORMAT_UNKNOWN);
+ return priv->version_format;
+}
+
+/**
+ * fwupd_device_set_version_format:
+ * @device: A #FwupdDevice
+ * @version_format: the state, e.g. %FWUPD_VERSION_FORMAT_PENDING
+ *
+ * Sets the update state.
+ *
+ * Since: 1.2.9
+ **/
+void
+fwupd_device_set_version_format (FwupdDevice *device, FwupdVersionFormat version_format)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ priv->version_format = version_format;
+}
+
+/**
+ * fwupd_device_get_update_message:
+ * @device: A #FwupdDevice
+ *
+ * Gets the update message.
+ *
+ * Returns: the update message, or %NULL if unset
+ *
+ * Since: 1.2.4
+ **/
+const gchar *
+fwupd_device_get_update_message (FwupdDevice *device)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
+ return priv->update_message;
+}
+
+/**
+ * fwupd_device_set_update_message:
+ * @device: A #FwupdDevice
+ * @update_message: the update message string
+ *
+ * Sets the update message.
+ *
+ * Since: 1.2.4
+ **/
+void
+fwupd_device_set_update_message (FwupdDevice *device, const gchar *update_message)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ g_free (priv->update_message);
+ priv->update_message = g_strdup (update_message);
+}
+
+/**
* fwupd_device_get_update_error:
* @device: A #FwupdDevice
*
@@ -1234,6 +1665,115 @@
fwupd_pad_kv_str (str, key, fwupd_update_state_to_string (value));
}
+static void
+fwupd_device_json_add_string (JsonBuilder *builder, const gchar *key, const gchar *str)
+{
+ if (str == NULL)
+ return;
+ json_builder_set_member_name (builder, key);
+ json_builder_add_string_value (builder, str);
+}
+
+static void
+fwupd_device_json_add_int (JsonBuilder *builder, const gchar *key, guint64 num)
+{
+ if (num == 0)
+ return;
+ json_builder_set_member_name (builder, key);
+ json_builder_add_int_value (builder, num);
+}
+
+/**
+ * fwupd_device_to_json:
+ * @device: A #FwupdDevice
+ * @builder: A #JsonBuilder
+ *
+ * Adds a fwupd device to a JSON builder
+ *
+ * Since: 1.2.6
+ **/
+void
+fwupd_device_to_json (FwupdDevice *device, JsonBuilder *builder)
+{
+ FwupdDevicePrivate *priv = GET_PRIVATE (device);
+
+ g_return_if_fail (FWUPD_IS_DEVICE (device));
+ g_return_if_fail (builder != NULL);
+
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_NAME, priv->name);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_DEVICE_ID, priv->id);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_PARENT_DEVICE_ID,
+ priv->parent_id);
+ if (priv->guids->len > 0) {
+ json_builder_set_member_name (builder, FWUPD_RESULT_KEY_GUID);
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->guids->len; i++) {
+ const gchar *guid = g_ptr_array_index (priv->guids, i);
+ json_builder_add_string_value (builder, guid);
+ }
+ json_builder_end_array (builder);
+ }
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_SERIAL, priv->serial);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_SUMMARY, priv->summary);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_DESCRIPTION, priv->description);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_PLUGIN, priv->plugin);
+ if (priv->flags != FWUPD_DEVICE_FLAG_NONE) {
+ json_builder_set_member_name (builder, FWUPD_RESULT_KEY_FLAGS);
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < 64; i++) {
+ const gchar *tmp;
+ if ((priv->flags & ((guint64) 1 << i)) == 0)
+ continue;
+ tmp = fwupd_device_flag_to_string ((guint64) 1 << i);
+ json_builder_add_string_value (builder, tmp);
+ }
+ json_builder_end_array (builder);
+ }
+ if (priv->checksums->len > 0) {
+ json_builder_set_member_name (builder, "Checksums");
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->checksums->len; i++) {
+ const gchar *checksum = g_ptr_array_index (priv->checksums, i);
+ json_builder_add_string_value (builder, checksum);
+ }
+ json_builder_end_array (builder);
+ }
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VENDOR, priv->vendor);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VENDOR_ID, priv->vendor_id);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VERSION, priv->version);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VERSION_LOWEST, priv->version_lowest);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VERSION_BOOTLOADER, priv->version_bootloader);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_VERSION_FORMAT,
+ fwupd_version_format_to_string (priv->version_format));
+ fwupd_device_json_add_int (builder, FWUPD_RESULT_KEY_FLASHES_LEFT, priv->flashes_left);
+ if (priv->icons->len > 0) {
+ json_builder_set_member_name (builder, "Icons");
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->icons->len; i++) {
+ const gchar *icon = g_ptr_array_index (priv->icons, i);
+ json_builder_add_string_value (builder, icon);
+ }
+ json_builder_end_array (builder);
+ }
+ fwupd_device_json_add_int (builder, FWUPD_RESULT_KEY_INSTALL_DURATION, priv->install_duration);
+ fwupd_device_json_add_int (builder, FWUPD_RESULT_KEY_CREATED, priv->created);
+ fwupd_device_json_add_int (builder, FWUPD_RESULT_KEY_MODIFIED, priv->modified);
+ fwupd_device_json_add_int (builder, FWUPD_RESULT_KEY_UPDATE_STATE, priv->update_state);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_UPDATE_ERROR, priv->update_error);
+ fwupd_device_json_add_string (builder, FWUPD_RESULT_KEY_UPDATE_MESSAGE, priv->update_message);
+ if (priv->releases->len > 0) {
+ json_builder_set_member_name (builder, "Releases");
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->releases->len; i++) {
+ FwupdRelease *release = g_ptr_array_index (priv->releases, i);
+ json_builder_begin_object (builder);
+ fwupd_release_to_json (release, builder);
+ json_builder_end_object (builder);
+ }
+ json_builder_end_array (builder);
+ }
+}
+
/**
* fwupd_device_to_string:
* @device: A #FwupdDevice
@@ -1249,6 +1789,7 @@
{
FwupdDevicePrivate *priv = GET_PRIVATE (device);
GString *str;
+ g_autoptr(GHashTable) ids = NULL;
g_return_val_if_fail (FWUPD_IS_DEVICE (device), NULL);
@@ -1258,10 +1799,26 @@
else
str = g_string_append (str, "Unknown Device\n");
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DEVICE_ID, priv->id);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_PARENT_DEVICE_ID, priv->parent_id);
+ ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ for (guint i = 0; i < priv->instance_ids->len; i++) {
+ const gchar *instance_id = g_ptr_array_index (priv->instance_ids, i);
+ g_hash_table_insert (ids,
+ fwupd_guid_hash_string (instance_id),
+ g_strdup (instance_id));
+ }
for (guint i = 0; i < priv->guids->len; i++) {
const gchar *guid = g_ptr_array_index (priv->guids, i);
- fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, guid);
+ const gchar *instance_id = g_hash_table_lookup (ids, guid);
+ if (instance_id == NULL) {
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, guid);
+ } else {
+ g_autofree gchar *tmp = NULL;
+ tmp = g_strdup_printf ("%s <- %s", guid, instance_id);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_GUID, tmp);
+ }
}
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_SERIAL, priv->serial);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_SUMMARY, priv->summary);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DESCRIPTION, priv->description);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_PLUGIN, priv->plugin);
@@ -1276,6 +1833,8 @@
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VERSION, priv->version);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VERSION_LOWEST, priv->version_lowest);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VERSION_BOOTLOADER, priv->version_bootloader);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VERSION_FORMAT,
+ fwupd_version_format_to_string (priv->version_format));
if (priv->flashes_left < 2)
fwupd_pad_kv_int (str, FWUPD_RESULT_KEY_FLASHES_LEFT, priv->flashes_left);
if (priv->icons->len > 0) {
@@ -1288,10 +1847,12 @@
g_string_truncate (tmp, tmp->len - 1);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_ICON, tmp->str);
}
+ fwupd_pad_kv_int (str, FWUPD_RESULT_KEY_INSTALL_DURATION, priv->install_duration);
fwupd_pad_kv_unx (str, FWUPD_RESULT_KEY_CREATED, priv->created);
fwupd_pad_kv_unx (str, FWUPD_RESULT_KEY_MODIFIED, priv->modified);
fwupd_pad_kv_ups (str, FWUPD_RESULT_KEY_UPDATE_STATE, priv->update_state);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_UPDATE_ERROR, priv->update_error);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_UPDATE_MESSAGE, priv->update_message);
for (guint i = 0; i < priv->releases->len; i++) {
FwupdRelease *release = g_ptr_array_index (priv->releases, i);
g_autofree gchar *tmp = fwupd_release_to_string (release);
@@ -1303,10 +1864,53 @@
}
static void
+fwupd_device_get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ FwupdDevice *self = FWUPD_DEVICE (object);
+ FwupdDevicePrivate *priv = GET_PRIVATE (self);
+ switch (prop_id) {
+ case PROP_VERSION_FORMAT:
+ g_value_set_uint (value, priv->version_format);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+fwupd_device_set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ FwupdDevice *self = FWUPD_DEVICE (object);
+ switch (prop_id) {
+ case PROP_VERSION_FORMAT:
+ fwupd_device_set_version_format (self, g_value_get_uint (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
fwupd_device_class_init (FwupdDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GParamSpec *pspec;
+
object_class->finalize = fwupd_device_finalize;
+ object_class->get_property = fwupd_device_get_property;
+ object_class->set_property = fwupd_device_set_property;
+
+ pspec = g_param_spec_uint ("version-format", NULL, NULL,
+ FWUPD_VERSION_FORMAT_UNKNOWN,
+ FWUPD_VERSION_FORMAT_LAST,
+ FWUPD_VERSION_FORMAT_UNKNOWN,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME);
+ g_object_class_install_property (object_class, PROP_VERSION_FORMAT, pspec);
}
static void
@@ -1314,6 +1918,7 @@
{
FwupdDevicePrivate *priv = GET_PRIVATE (device);
priv->guids = g_ptr_array_new_with_free_func (g_free);
+ priv->instance_ids = g_ptr_array_new_with_free_func (g_free);
priv->icons = g_ptr_array_new_with_free_func (g_free);
priv->checksums = g_ptr_array_new_with_free_func (g_free);
priv->releases = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
@@ -1325,18 +1930,24 @@
FwupdDevice *device = FWUPD_DEVICE (object);
FwupdDevicePrivate *priv = GET_PRIVATE (device);
+ if (priv->parent != NULL)
+ g_object_unref (priv->parent);
g_free (priv->description);
g_free (priv->id);
+ g_free (priv->parent_id);
g_free (priv->name);
+ g_free (priv->serial);
g_free (priv->summary);
g_free (priv->vendor);
g_free (priv->vendor_id);
g_free (priv->plugin);
g_free (priv->update_error);
+ g_free (priv->update_message);
g_free (priv->version);
g_free (priv->version_lowest);
g_free (priv->version_bootloader);
g_ptr_array_unref (priv->guids);
+ g_ptr_array_unref (priv->instance_ids);
g_ptr_array_unref (priv->icons);
g_ptr_array_unref (priv->checksums);
g_ptr_array_unref (priv->releases);
@@ -1357,30 +1968,30 @@
/**
* fwupd_device_from_variant:
- * @data: a #GVariant
+ * @value: a #GVariant
*
* Creates a new device using packed data.
*
- * Returns: (transfer full): a new #FwupdDevice, or %NULL if @data was invalid
+ * Returns: (transfer full): a new #FwupdDevice, or %NULL if @value was invalid
*
* Since: 1.0.0
**/
FwupdDevice *
-fwupd_device_from_variant (GVariant *data)
+fwupd_device_from_variant (GVariant *value)
{
FwupdDevice *dev = NULL;
const gchar *type_string;
g_autoptr(GVariantIter) iter = NULL;
/* format from GetDetails */
- type_string = g_variant_get_type_string (data);
+ type_string = g_variant_get_type_string (value);
if (g_strcmp0 (type_string, "(a{sv})") == 0) {
dev = fwupd_device_new ();
- g_variant_get (data, "(a{sv})", &iter);
+ g_variant_get (value, "(a{sv})", &iter);
fwupd_device_set_from_variant_iter (dev, iter);
} else if (g_strcmp0 (type_string, "a{sv}") == 0) {
dev = fwupd_device_new ();
- g_variant_get (data, "a{sv}", &iter);
+ g_variant_get (value, "a{sv}", &iter);
fwupd_device_set_from_variant_iter (dev, iter);
} else {
g_warning ("type %s not known", type_string);
@@ -1389,6 +2000,78 @@
}
/**
+ * fwupd_device_array_from_variant:
+ * @value: a #GVariant
+ *
+ * Creates an array of new devices using packed data.
+ *
+ * Returns: (transfer container) (element-type FwupdDevice): devices, or %NULL if @value was invalid
+ *
+ * Since: 1.2.10
+ **/
+GPtrArray *
+fwupd_device_array_from_variant (GVariant *value)
+{
+ GPtrArray *array = NULL;
+ gsize sz;
+ g_autoptr(GVariant) untuple = NULL;
+ g_autoptr(GHashTable) devices_by_id = NULL;
+
+ array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ devices_by_id = g_hash_table_new (g_str_hash, g_str_equal);
+ untuple = g_variant_get_child_value (value, 0);
+ sz = g_variant_n_children (untuple);
+ for (guint i = 0; i < sz; i++) {
+ FwupdDevice *dev;
+ g_autoptr(GVariant) data = NULL;
+ data = g_variant_get_child_value (untuple, i);
+ dev = fwupd_device_from_variant (data);
+ if (dev == NULL)
+ continue;
+ g_ptr_array_add (array, dev);
+ if (fwupd_device_get_id (dev) != NULL) {
+ g_hash_table_insert (devices_by_id,
+ (gpointer) fwupd_device_get_id (dev),
+ (gpointer) dev);
+ }
+ }
+
+ /* set the parent on each child */
+ for (guint i = 0; i < array->len; i++) {
+ FwupdDevice *dev = g_ptr_array_index (array, i);
+ const gchar *parent_id = fwupd_device_get_parent_id (dev);
+ if (parent_id != NULL) {
+ FwupdDevice *dev_tmp;
+ dev_tmp = g_hash_table_lookup (devices_by_id, parent_id);
+ fwupd_device_set_parent (dev, dev_tmp);
+ }
+ }
+
+ return array;
+}
+
+/**
+ * fwupd_device_compare:
+ * @device1: a #FwupdDevice
+ * @device2: a #FwupdDevice
+ *
+ * Comparison function for comparing two FwupdDevice objects.
+ *
+ * Returns: negative, 0 or positive
+ *
+ * Since: 1.1.1
+ **/
+gint
+fwupd_device_compare (FwupdDevice *device1, FwupdDevice *device2)
+{
+ FwupdDevicePrivate *priv1 = GET_PRIVATE (device1);
+ FwupdDevicePrivate *priv2 = GET_PRIVATE (device2);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device1), 0);
+ g_return_val_if_fail (FWUPD_IS_DEVICE (device2), 0);
+ return g_strcmp0 (priv1->id, priv2->id);
+}
+
+/**
* fwupd_device_new:
*
* Creates a new device.
diff -Nru fwupd-1.0.6/libfwupd/fwupd-device.h fwupd-1.2.10/libfwupd/fwupd-device.h
--- fwupd-1.0.6/libfwupd/fwupd-device.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-device.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_DEVICE_H
-#define __FWUPD_DEVICE_H
+#pragma once
#include
@@ -51,9 +35,18 @@
const gchar *fwupd_device_get_id (FwupdDevice *device);
void fwupd_device_set_id (FwupdDevice *device,
const gchar *id);
+const gchar *fwupd_device_get_parent_id (FwupdDevice *device);
+void fwupd_device_set_parent_id (FwupdDevice *device,
+ const gchar *parent_id);
+FwupdDevice *fwupd_device_get_parent (FwupdDevice *device);
+void fwupd_device_set_parent (FwupdDevice *device,
+ FwupdDevice *parent);
const gchar *fwupd_device_get_name (FwupdDevice *device);
void fwupd_device_set_name (FwupdDevice *device,
const gchar *name);
+const gchar *fwupd_device_get_serial (FwupdDevice *device);
+void fwupd_device_set_serial (FwupdDevice *device,
+ const gchar *serial);
const gchar *fwupd_device_get_summary (FwupdDevice *device);
void fwupd_device_set_summary (FwupdDevice *device,
const gchar *summary);
@@ -69,9 +62,15 @@
const gchar *fwupd_device_get_version_bootloader (FwupdDevice *device);
void fwupd_device_set_version_bootloader (FwupdDevice *device,
const gchar *version_bootloader);
+FwupdVersionFormat fwupd_device_get_version_format (FwupdDevice *device);
+void fwupd_device_set_version_format (FwupdDevice *device,
+ FwupdVersionFormat version_format);
guint32 fwupd_device_get_flashes_left (FwupdDevice *device);
void fwupd_device_set_flashes_left (FwupdDevice *device,
guint32 flashes_left);
+guint32 fwupd_device_get_install_duration (FwupdDevice *device);
+void fwupd_device_set_install_duration (FwupdDevice *device,
+ guint32 duration);
guint64 fwupd_device_get_flags (FwupdDevice *device);
void fwupd_device_set_flags (FwupdDevice *device,
guint64 flags);
@@ -105,6 +104,11 @@
const gchar *guid);
GPtrArray *fwupd_device_get_guids (FwupdDevice *device);
const gchar *fwupd_device_get_guid_default (FwupdDevice *device);
+void fwupd_device_add_instance_id (FwupdDevice *device,
+ const gchar *instance_id);
+gboolean fwupd_device_has_instance_id (FwupdDevice *device,
+ const gchar *instance_id);
+GPtrArray *fwupd_device_get_instance_ids (FwupdDevice *device);
void fwupd_device_add_icon (FwupdDevice *device,
const gchar *icon);
GPtrArray *fwupd_device_get_icons (FwupdDevice *device);
@@ -115,12 +119,17 @@
const gchar *fwupd_device_get_update_error (FwupdDevice *device);
void fwupd_device_set_update_error (FwupdDevice *device,
const gchar *update_error);
+const gchar *fwupd_device_get_update_message (FwupdDevice *device);
+void fwupd_device_set_update_message (FwupdDevice *device,
+ const gchar *update_message);
void fwupd_device_add_release (FwupdDevice *device,
FwupdRelease *release);
GPtrArray *fwupd_device_get_releases (FwupdDevice *device);
FwupdRelease *fwupd_device_get_release_default (FwupdDevice *device);
+gint fwupd_device_compare (FwupdDevice *device1,
+ FwupdDevice *device2);
-G_END_DECLS
-
-#endif /* __FWUPD_DEVICE_H */
+FwupdDevice *fwupd_device_from_variant (GVariant *value);
+GPtrArray *fwupd_device_array_from_variant (GVariant *value);
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-device-private.h fwupd-1.2.10/libfwupd/fwupd-device-private.h
--- fwupd-1.0.6/libfwupd/fwupd-device-private.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-device-private.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,37 +1,25 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_DEVICE_PRIVATE_H
-#define __FWUPD_DEVICE_PRIVATE_H
+#pragma once
#include
+#include
#include "fwupd-device.h"
G_BEGIN_DECLS
-FwupdDevice *fwupd_device_from_variant (GVariant *data);
GVariant *fwupd_device_to_variant (FwupdDevice *device);
+GVariant *fwupd_device_to_variant_full (FwupdDevice *device,
+ FwupdDeviceFlags flags);
+void fwupd_device_incorporate (FwupdDevice *self,
+ FwupdDevice *donor);
+void fwupd_device_to_json (FwupdDevice *device,
+ JsonBuilder *builder);
G_END_DECLS
-#endif /* __FWUPD_DEVICE_PRIVATE_H */
-
diff -Nru fwupd-1.0.6/libfwupd/fwupd-enums.c fwupd-1.2.10/libfwupd/fwupd-enums.c
--- fwupd-1.0.6/libfwupd/fwupd-enums.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-enums.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -72,6 +57,8 @@
return "downloading";
if (status == FWUPD_STATUS_WAITING_FOR_AUTH)
return "waiting-for-auth";
+ if (status == FWUPD_STATUS_SHUTDOWN)
+ return "shutdown";
return NULL;
}
@@ -114,6 +101,8 @@
return FWUPD_STATUS_DEVICE_BUSY;
if (g_strcmp0 (status, "waiting-for-auth") == 0)
return FWUPD_STATUS_WAITING_FOR_AUTH;
+ if (g_strcmp0 (status, "shutdown") == 0)
+ return FWUPD_STATUS_SHUTDOWN;
return FWUPD_STATUS_LAST;
}
@@ -150,12 +139,30 @@
return "registered";
if (device_flag == FWUPD_DEVICE_FLAG_NEEDS_REBOOT)
return "needs-reboot";
+ if (device_flag == FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN)
+ return "needs-shutdown";
if (device_flag == FWUPD_DEVICE_FLAG_REPORTED)
return "reported";
if (device_flag == FWUPD_DEVICE_FLAG_NOTIFIED)
return "notified";
if (device_flag == FWUPD_DEVICE_FLAG_USE_RUNTIME_VERSION)
return "use-runtime-version";
+ if (device_flag == FWUPD_DEVICE_FLAG_INSTALL_PARENT_FIRST)
+ return "install-parent-first";
+ if (device_flag == FWUPD_DEVICE_FLAG_IS_BOOTLOADER)
+ return "is-bootloader";
+ if (device_flag == FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG)
+ return "wait-for-replug";
+ if (device_flag == FWUPD_DEVICE_FLAG_IGNORE_VALIDATION)
+ return "ignore-validation";
+ if (device_flag == FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED)
+ return "another-write-required";
+ if (device_flag == FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS)
+ return "no-auto-instance-ids";
+ if (device_flag == FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
+ return "needs-activation";
+ if (device_flag == FWUPD_DEVICE_FLAG_ENSURE_SEMVER)
+ return "ensure-semver";
if (device_flag == FWUPD_DEVICE_FLAG_UNKNOWN)
return "unknown";
return NULL;
@@ -196,12 +203,30 @@
return FWUPD_DEVICE_FLAG_REGISTERED;
if (g_strcmp0 (device_flag, "needs-reboot") == 0)
return FWUPD_DEVICE_FLAG_NEEDS_REBOOT;
+ if (g_strcmp0 (device_flag, "needs-shutdown") == 0)
+ return FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN;
if (g_strcmp0 (device_flag, "reported") == 0)
return FWUPD_DEVICE_FLAG_REPORTED;
if (g_strcmp0 (device_flag, "notified") == 0)
return FWUPD_DEVICE_FLAG_NOTIFIED;
if (g_strcmp0 (device_flag, "use-runtime-version") == 0)
return FWUPD_DEVICE_FLAG_USE_RUNTIME_VERSION;
+ if (g_strcmp0 (device_flag, "install-parent-first") == 0)
+ return FWUPD_DEVICE_FLAG_INSTALL_PARENT_FIRST;
+ if (g_strcmp0 (device_flag, "is-bootloader") == 0)
+ return FWUPD_DEVICE_FLAG_IS_BOOTLOADER;
+ if (g_strcmp0 (device_flag, "wait-for-replug") == 0)
+ return FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG;
+ if (g_strcmp0 (device_flag, "ignore-validation") == 0)
+ return FWUPD_DEVICE_FLAG_IGNORE_VALIDATION;
+ if (g_strcmp0 (device_flag, "another-write-required") == 0)
+ return FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED;
+ if (g_strcmp0 (device_flag, "no-auto-instance-ids") == 0)
+ return FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS;
+ if (g_strcmp0 (device_flag, "needs-activation") == 0)
+ return FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION;
+ if (g_strcmp0 (device_flag, "ensure-semver") == 0)
+ return FWUPD_DEVICE_FLAG_ENSURE_SEMVER;
return FWUPD_DEVICE_FLAG_UNKNOWN;
}
@@ -226,6 +251,8 @@
return "success";
if (update_state == FWUPD_UPDATE_STATE_FAILED)
return "failed";
+ if (update_state == FWUPD_UPDATE_STATE_FAILED_TRANSIENT)
+ return "failed-transient";
if (update_state == FWUPD_UPDATE_STATE_NEEDS_REBOOT)
return "needs-reboot";
return NULL;
@@ -252,6 +279,8 @@
return FWUPD_UPDATE_STATE_SUCCESS;
if (g_strcmp0 (update_state, "failed") == 0)
return FWUPD_UPDATE_STATE_FAILED;
+ if (g_strcmp0 (update_state, "failed-transient") == 0)
+ return FWUPD_UPDATE_STATE_FAILED_TRANSIENT;
if (g_strcmp0 (update_state, "needs-reboot") == 0)
return FWUPD_UPDATE_STATE_NEEDS_REBOOT;
return FWUPD_UPDATE_STATE_UNKNOWN;
@@ -344,3 +373,125 @@
return "pkcs7";
return NULL;
}
+
+/**
+ * fwupd_release_flag_to_string:
+ * @release_flag: A #FwupdReleaseFlags, e.g. %FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD
+ *
+ * Converts a #FwupdReleaseFlags to a string.
+ *
+ * Return value: identifier string
+ *
+ * Since: 1.2.6
+ **/
+const gchar *
+fwupd_release_flag_to_string (FwupdReleaseFlags release_flag)
+{
+ if (release_flag == FWUPD_RELEASE_FLAG_NONE)
+ return "none";
+ if (release_flag == FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD)
+ return "trusted-payload";
+ if (release_flag == FWUPD_RELEASE_FLAG_TRUSTED_METADATA)
+ return "trusted-metadata";
+ if (release_flag == FWUPD_RELEASE_FLAG_IS_UPGRADE)
+ return "is-upgrade";
+ if (release_flag == FWUPD_RELEASE_FLAG_IS_DOWNGRADE)
+ return "is-downgrade";
+ if (release_flag == FWUPD_RELEASE_FLAG_BLOCKED_VERSION)
+ return "blocked-version";
+ if (release_flag == FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL)
+ return "blocked-approval";
+ return NULL;
+}
+
+/**
+ * fwupd_release_flag_from_string:
+ * @release_flag: A string, e.g. `trusted-payload`
+ *
+ * Converts a string to a #FwupdReleaseFlags.
+ *
+ * Return value: enumerated value
+ *
+ * Since: 1.2.6
+ **/
+FwupdReleaseFlags
+fwupd_release_flag_from_string (const gchar *release_flag)
+{
+ if (g_strcmp0 (release_flag, "trusted-payload") == 0)
+ return FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD;
+ if (g_strcmp0 (release_flag, "trusted-metadata") == 0)
+ return FWUPD_RELEASE_FLAG_TRUSTED_METADATA;
+ if (g_strcmp0 (release_flag, "is-upgrade") == 0)
+ return FWUPD_RELEASE_FLAG_IS_UPGRADE;
+ if (g_strcmp0 (release_flag, "is-downgrade") == 0)
+ return FWUPD_RELEASE_FLAG_IS_DOWNGRADE;
+ if (g_strcmp0 (release_flag, "blocked-version") == 0)
+ return FWUPD_RELEASE_FLAG_BLOCKED_VERSION;
+ if (g_strcmp0 (release_flag, "blocked-approval") == 0)
+ return FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL;
+ return FWUPD_RELEASE_FLAG_NONE;
+}
+
+/**
+ * fwupd_version_format_from_string:
+ * @str: A string, e.g. `quad`
+ *
+ * Converts text to a display version type.
+ *
+ * Returns: A #FwupdVersionFormat, e.g. %FWUPD_VERSION_FORMAT_TRIPLET
+ *
+ * Since: 1.2.9
+ **/
+FwupdVersionFormat
+fwupd_version_format_from_string (const gchar *str)
+{
+ if (g_strcmp0 (str, "plain") == 0)
+ return FWUPD_VERSION_FORMAT_PLAIN;
+ if (g_strcmp0 (str, "pair") == 0)
+ return FWUPD_VERSION_FORMAT_PAIR;
+ if (g_strcmp0 (str, "number") == 0)
+ return FWUPD_VERSION_FORMAT_NUMBER;
+ if (g_strcmp0 (str, "triplet") == 0)
+ return FWUPD_VERSION_FORMAT_TRIPLET;
+ if (g_strcmp0 (str, "quad") == 0)
+ return FWUPD_VERSION_FORMAT_QUAD;
+ if (g_strcmp0 (str, "bcd") == 0)
+ return FWUPD_VERSION_FORMAT_BCD;
+ if (g_strcmp0 (str, "intel-me") == 0)
+ return FWUPD_VERSION_FORMAT_INTEL_ME;
+ if (g_strcmp0 (str, "intel-me2") == 0)
+ return FWUPD_VERSION_FORMAT_INTEL_ME2;
+ return FWUPD_VERSION_FORMAT_UNKNOWN;
+}
+
+/**
+ * fwupd_version_format_to_string:
+ * @kind: A #FwupdVersionFormat, e.g. %FWUPD_VERSION_FORMAT_TRIPLET
+ *
+ * Converts a display version type to text.
+ *
+ * Returns: A string, e.g. `quad`, or %NULL if not known
+ *
+ * Since: 1.2.9
+ **/
+const gchar *
+fwupd_version_format_to_string (FwupdVersionFormat kind)
+{
+ if (kind == FWUPD_VERSION_FORMAT_PLAIN)
+ return "plain";
+ if (kind == FWUPD_VERSION_FORMAT_NUMBER)
+ return "number";
+ if (kind == FWUPD_VERSION_FORMAT_PAIR)
+ return "pair";
+ if (kind == FWUPD_VERSION_FORMAT_TRIPLET)
+ return "triplet";
+ if (kind == FWUPD_VERSION_FORMAT_QUAD)
+ return "quad";
+ if (kind == FWUPD_VERSION_FORMAT_BCD)
+ return "bcd";
+ if (kind == FWUPD_VERSION_FORMAT_INTEL_ME)
+ return "intel-me";
+ if (kind == FWUPD_VERSION_FORMAT_INTEL_ME2)
+ return "intel-me2";
+ return NULL;
+}
diff -Nru fwupd-1.0.6/libfwupd/fwupd-enums.h fwupd-1.2.10/libfwupd/fwupd-enums.h
--- fwupd-1.0.6/libfwupd/fwupd-enums.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-enums.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,29 +1,15 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_ENUMS_H
-#define __FWUPD_ENUMS_H
+#pragma once
#include
+G_BEGIN_DECLS
+
/**
* FwupdStatus:
* @FWUPD_STATUS_UNKNOWN: Unknown state
@@ -39,6 +25,7 @@
* @FWUPD_STATUS_DEVICE_ERASE: Erasing a device
* @FWUPD_STATUS_WAITING_FOR_AUTH: Waiting for authentication
* @FWUPD_STATUS_DEVICE_BUSY: The device is busy
+ * @FWUPD_STATUS_SHUTDOWN: The daemon is shutting down
*
* The flags to show daemon status.
**/
@@ -56,6 +43,7 @@
FWUPD_STATUS_DEVICE_ERASE, /* Since: 1.0.0 */
FWUPD_STATUS_WAITING_FOR_AUTH, /* Since: 1.0.0 */
FWUPD_STATUS_DEVICE_BUSY, /* Since: 1.0.1 */
+ FWUPD_STATUS_SHUTDOWN, /* Since: 1.2.1 */
/*< private >*/
FWUPD_STATUS_LAST
} FwupdStatus;
@@ -91,6 +79,16 @@
* @FWUPD_DEVICE_FLAG_REPORTED: Has been reported to a metadata server
* @FWUPD_DEVICE_FLAG_NOTIFIED: User has been notified
* @FWUPD_DEVICE_FLAG_USE_RUNTIME_VERSION: Always use the runtime version rather than the bootloader
+ * @FWUPD_DEVICE_FLAG_INSTALL_PARENT_FIRST: Install composite firmware on the parent before the child
+ * @FWUPD_DEVICE_FLAG_IS_BOOTLOADER: Is currently in bootloader mode
+ * @FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG: The hardware is waiting to be replugged
+ * @FWUPD_DEVICE_FLAG_IGNORE_VALIDATION: Ignore validation safety checks when flashing this device
+ * @FWUPD_DEVICE_FLAG_TRUSTED: Extra metadata can be exposed about this device
+ * @FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN: Requires system shutdown to apply firmware
+ * @FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED: Requires the update to be retried with a new plugin
+ * @FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS: Do not add instance IDs from the device baseclass
+ * @FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION: Device update needs to be separately activated
+ * @FWUPD_DEVICE_FLAG_ENSURE_SEMVER: Ensure the version is a valid semantic version, e.g. numbers separated with dots
*
* The device flags.
**/
@@ -107,36 +105,87 @@
#define FWUPD_DEVICE_FLAG_REPORTED (1u << 9) /* Since: 1.0.4 */
#define FWUPD_DEVICE_FLAG_NOTIFIED (1u << 10) /* Since: 1.0.5 */
#define FWUPD_DEVICE_FLAG_USE_RUNTIME_VERSION (1u << 11) /* Since: 1.0.6 */
+#define FWUPD_DEVICE_FLAG_INSTALL_PARENT_FIRST (1u << 12) /* Since: 1.0.8 */
+#define FWUPD_DEVICE_FLAG_IS_BOOTLOADER (1u << 13) /* Since: 1.0.8 */
+#define FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG (1u << 14) /* Since: 1.1.2 */
+#define FWUPD_DEVICE_FLAG_IGNORE_VALIDATION (1u << 15) /* Since: 1.1.2 */
+#define FWUPD_DEVICE_FLAG_TRUSTED (1u << 16) /* Since: 1.1.2 */
+#define FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN (1u << 17) /* Since: 1.2.4 */
+#define FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED (1u << 18) /* Since: 1.2.5 */
+#define FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS (1u << 19) /* Since: 1.2.5 */
+#define FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION (1u << 20) /* Since: 1.2.6 */
+#define FWUPD_DEVICE_FLAG_ENSURE_SEMVER (1u << 21) /* Since: 1.2.9 */
#define FWUPD_DEVICE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 0.7.3 */
typedef guint64 FwupdDeviceFlags;
/**
+ * FwupdReleaseFlags:
+ * @FWUPD_RELEASE_FLAG_NONE: No flags set
+ * @FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD: The payload binary is trusted
+ * @FWUPD_RELEASE_FLAG_TRUSTED_METADATA: The payload metadata is trusted
+ * @FWUPD_RELEASE_FLAG_IS_UPGRADE: Is newer than the device version
+ * @FWUPD_RELEASE_FLAG_IS_DOWNGRADE: Is older than the device version
+ * @FWUPD_RELEASE_FLAG_BLOCKED_VERSION: Blocked as below device version-lowest
+ * @FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL: Blocked as release not approved
+ *
+ * The release flags.
+ **/
+#define FWUPD_RELEASE_FLAG_NONE (0u) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD (1u << 0) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_TRUSTED_METADATA (1u << 1) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_IS_UPGRADE (1u << 2) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_IS_DOWNGRADE (1u << 3) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_BLOCKED_VERSION (1u << 4) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL (1u << 5) /* Since: 1.2.6 */
+#define FWUPD_RELEASE_FLAG_UNKNOWN G_MAXUINT64 /* Since: 1.2.6 */
+typedef guint64 FwupdReleaseFlags;
+
+/**
* FwupdInstallFlags:
* @FWUPD_INSTALL_FLAG_NONE: No flags set
* @FWUPD_INSTALL_FLAG_OFFLINE: Schedule this for next boot
* @FWUPD_INSTALL_FLAG_ALLOW_REINSTALL: Allow reinstalling the same version
* @FWUPD_INSTALL_FLAG_ALLOW_OLDER: Allow downgrading firmware
* @FWUPD_INSTALL_FLAG_FORCE: Force the update even if not a good idea
+ * @FWUPD_INSTALL_FLAG_NO_HISTORY: Do not write to the history database
*
* Flags to set when performing the firwmare update or install.
**/
typedef enum {
- FWUPD_INSTALL_FLAG_NONE = 0, /* Since: 0.7.0 */
- FWUPD_INSTALL_FLAG_OFFLINE = 1, /* Since: 0.7.0 */
- FWUPD_INSTALL_FLAG_ALLOW_REINSTALL = 2, /* Since: 0.7.0 */
- FWUPD_INSTALL_FLAG_ALLOW_OLDER = 4, /* Since: 0.7.0 */
- FWUPD_INSTALL_FLAG_FORCE = 8, /* Since: 0.7.1 */
+ FWUPD_INSTALL_FLAG_NONE = 0, /* Since: 0.7.0 */
+ FWUPD_INSTALL_FLAG_OFFLINE = 1 << 0, /* Since: 0.7.0 */
+ FWUPD_INSTALL_FLAG_ALLOW_REINSTALL = 1 << 1, /* Since: 0.7.0 */
+ FWUPD_INSTALL_FLAG_ALLOW_OLDER = 1 << 2, /* Since: 0.7.0 */
+ FWUPD_INSTALL_FLAG_FORCE = 1 << 3, /* Since: 0.7.1 */
+ FWUPD_INSTALL_FLAG_NO_HISTORY = 1 << 4, /* Since: 1.0.8 */
/*< private >*/
FWUPD_INSTALL_FLAG_LAST
} FwupdInstallFlags;
/**
+ * FwupdSelfSignFlags:
+ * @FWUPD_SELF_SIGN_FLAG_NONE: No flags set
+ * @FWUPD_SELF_SIGN_FLAG_ADD_TIMESTAMP: Add the timestamp to the detached signature
+ * @FWUPD_SELF_SIGN_FLAG_ADD_CERT: Add the certificate to the detached signature
+ *
+ * Flags to set when performing the firwmare update or install.
+ **/
+typedef enum {
+ FWUPD_SELF_SIGN_FLAG_NONE = 0, /* Since: 1.2.6 */
+ FWUPD_SELF_SIGN_FLAG_ADD_TIMESTAMP = 1 << 0, /* Since: 1.2.6 */
+ FWUPD_SELF_SIGN_FLAG_ADD_CERT = 1 << 1, /* Since: 1.2.6 */
+ /*< private >*/
+ FWUPD_SELF_SIGN_FLAG_LAST
+} FwupdSelfSignFlags;
+
+/**
* FwupdUpdateState:
* @FWUPD_UPDATE_STATE_UNKNOWN: Unknown
* @FWUPD_UPDATE_STATE_PENDING: Update is pending
- * @FWUPD_UPDATE_STATE_SUCCESS: Update was successfull
+ * @FWUPD_UPDATE_STATE_SUCCESS: Update was successful
* @FWUPD_UPDATE_STATE_FAILED: Update failed
* @FWUPD_UPDATE_STATE_NEEDS_REBOOT: Waiting for a reboot to apply
+ * @FWUPD_UPDATE_STATE_FAILED_TRANSIENT: Update failed due to transient issue, e.g. AC power required
*
* The update state.
**/
@@ -146,6 +195,7 @@
FWUPD_UPDATE_STATE_SUCCESS, /* Since: 0.7.0 */
FWUPD_UPDATE_STATE_FAILED, /* Since: 0.7.0 */
FWUPD_UPDATE_STATE_NEEDS_REBOOT, /* Since: 1.0.4 */
+ FWUPD_UPDATE_STATE_FAILED_TRANSIENT, /* Since: 1.2.7 */
/*< private >*/
FWUPD_UPDATE_STATE_LAST
} FwupdUpdateState;
@@ -168,15 +218,50 @@
FWUPD_KEYRING_KIND_LAST
} FwupdKeyringKind;
+/**
+ * FwupdVersionFormat:
+ * @FWUPD_VERSION_FORMAT_UNKNOWN: Unknown version format
+ * @FWUPD_VERSION_FORMAT_PLAIN: An unidentified format text string
+ * @FWUPD_VERSION_FORMAT_NUMBER: A single integer version number
+ * @FWUPD_VERSION_FORMAT_PAIR: Two AABB.CCDD version numbers
+ * @FWUPD_VERSION_FORMAT_TRIPLET: Microsoft-style AA.BB.CCDD version numbers
+ * @FWUPD_VERSION_FORMAT_QUAD: Dell-style AA.BB.CC.DD version numbers
+ * @FWUPD_VERSION_FORMAT_BCD: Binary coded decimal notation
+ * @FWUPD_VERSION_FORMAT_INTEL_ME: Intel ME-style bitshifted notation
+ * @FWUPD_VERSION_FORMAT_INTEL_ME2: Intel ME-style A.B.CC.DDDD notation notation
+ *
+ * The flags used when parsing version numbers.
+ *
+ * If no verification is required then %FWUPD_VERSION_FORMAT_PLAIN should
+ * be used to signify an unparsable text string.
+ **/
+typedef enum {
+ FWUPD_VERSION_FORMAT_UNKNOWN, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_PLAIN, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_NUMBER, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_PAIR, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_TRIPLET, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_QUAD, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_BCD, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_INTEL_ME, /* Since: 1.2.9 */
+ FWUPD_VERSION_FORMAT_INTEL_ME2, /* Since: 1.2.9 */
+ /*< private >*/
+ FWUPD_VERSION_FORMAT_LAST
+} FwupdVersionFormat;
+
const gchar *fwupd_status_to_string (FwupdStatus status);
FwupdStatus fwupd_status_from_string (const gchar *status);
const gchar *fwupd_device_flag_to_string (FwupdDeviceFlags device_flag);
FwupdDeviceFlags fwupd_device_flag_from_string (const gchar *device_flag);
+const gchar *fwupd_release_flag_to_string (FwupdReleaseFlags release_flag);
+FwupdReleaseFlags fwupd_release_flag_from_string (const gchar *release_flag);
const gchar *fwupd_update_state_to_string (FwupdUpdateState update_state);
FwupdUpdateState fwupd_update_state_from_string (const gchar *update_state);
const gchar *fwupd_trust_flag_to_string (FwupdTrustFlags trust_flag);
FwupdTrustFlags fwupd_trust_flag_from_string (const gchar *trust_flag);
FwupdKeyringKind fwupd_keyring_kind_from_string (const gchar *keyring_kind);
const gchar *fwupd_keyring_kind_to_string (FwupdKeyringKind keyring_kind);
+FwupdVersionFormat fwupd_version_format_from_string (const gchar *str);
+const gchar *fwupd_version_format_to_string (FwupdVersionFormat kind);
-#endif /* __FWUPD_ENUMS_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-enums-private.h fwupd-1.2.10/libfwupd/fwupd-enums-private.h
--- fwupd-1.0.6/libfwupd/fwupd-enums-private.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-enums-private.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,37 +1,30 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2016-2018 Richard Hughes
*
- * Copyright (C) 2016-2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_ENUMS_PRIVATE_H
-#define __FWUPD_ENUMS_PRIVATE_H
+#pragma once
+
+G_BEGIN_DECLS
#define FWUPD_RESULT_KEY_APPSTREAM_ID "AppstreamId" /* s */
#define FWUPD_RESULT_KEY_CHECKSUM "Checksum" /* as */
#define FWUPD_RESULT_KEY_CREATED "Created" /* t */
#define FWUPD_RESULT_KEY_DESCRIPTION "Description" /* s */
#define FWUPD_RESULT_KEY_DEVICE_ID "DeviceId" /* s */
+#define FWUPD_RESULT_KEY_PARENT_DEVICE_ID "ParentDeviceId"/* s */
#define FWUPD_RESULT_KEY_FILENAME "Filename" /* s */
+#define FWUPD_RESULT_KEY_PROTOCOL "Protocol" /* s */
+#define FWUPD_RESULT_KEY_CATEGORIES "Categories" /* as */
#define FWUPD_RESULT_KEY_FLAGS "Flags" /* t */
#define FWUPD_RESULT_KEY_FLASHES_LEFT "FlashesLeft" /* u */
+#define FWUPD_RESULT_KEY_INSTALL_DURATION "InstallDuration" /* u */
#define FWUPD_RESULT_KEY_GUID "Guid" /* as */
+#define FWUPD_RESULT_KEY_INSTANCE_IDS "InstanceIds" /* as */
#define FWUPD_RESULT_KEY_HOMEPAGE "Homepage" /* s */
+#define FWUPD_RESULT_KEY_DETAILS_URL "DetailsUrl" /* s */
+#define FWUPD_RESULT_KEY_SOURCE_URL "SourceUrl" /* s */
#define FWUPD_RESULT_KEY_ICON "Icon" /* as */
#define FWUPD_RESULT_KEY_LICENSE "License" /* s */
#define FWUPD_RESULT_KEY_MODIFIED "Modified" /* t */
@@ -40,9 +33,11 @@
#define FWUPD_RESULT_KEY_PLUGIN "Plugin" /* s */
#define FWUPD_RESULT_KEY_RELEASE "Release" /* a{sv} */
#define FWUPD_RESULT_KEY_REMOTE_ID "RemoteId" /* s */
+#define FWUPD_RESULT_KEY_SERIAL "Serial" /* s */
#define FWUPD_RESULT_KEY_SIZE "Size" /* t */
#define FWUPD_RESULT_KEY_SUMMARY "Summary" /* s */
#define FWUPD_RESULT_KEY_TRUST_FLAGS "TrustFlags" /* t */
+#define FWUPD_RESULT_KEY_UPDATE_MESSAGE "UpdateMessage" /* s */
#define FWUPD_RESULT_KEY_UPDATE_ERROR "UpdateError" /* s */
#define FWUPD_RESULT_KEY_UPDATE_STATE "UpdateState" /* u */
#define FWUPD_RESULT_KEY_URI "Uri" /* s */
@@ -50,7 +45,8 @@
#define FWUPD_RESULT_KEY_VENDOR "Vendor" /* s */
#define FWUPD_RESULT_KEY_VENDOR "Vendor" /* s */
#define FWUPD_RESULT_KEY_VERSION_BOOTLOADER "VersionBootloader" /* s */
+#define FWUPD_RESULT_KEY_VERSION_FORMAT "VersionFormat" /* u */
#define FWUPD_RESULT_KEY_VERSION_LOWEST "VersionLowest" /* s */
#define FWUPD_RESULT_KEY_VERSION "Version" /* s */
-#endif /* __FWUPD_ENUMS_PRIVATE_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-error.c fwupd-1.2.10/libfwupd/fwupd-error.c
--- fwupd-1.0.6/libfwupd/fwupd-error.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-error.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2016 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -78,6 +63,10 @@
return FWUPD_DBUS_INTERFACE ".AcPowerRequired";
if (error == FWUPD_ERROR_PERMISSION_DENIED)
return FWUPD_DBUS_INTERFACE ".PermissionDenied";
+ if (error == FWUPD_ERROR_BROKEN_SYSTEM)
+ return FWUPD_DBUS_INTERFACE ".BrokenSystem";
+ if (error == FWUPD_ERROR_BATTERY_LEVEL_TOO_LOW)
+ return FWUPD_DBUS_INTERFACE ".BatteryLevelTooLow";
return NULL;
}
@@ -122,6 +111,10 @@
return FWUPD_ERROR_AC_POWER_REQUIRED;
if (g_strcmp0 (error, FWUPD_DBUS_INTERFACE ".PermissionDenied") == 0)
return FWUPD_ERROR_PERMISSION_DENIED;
+ if (g_strcmp0 (error, FWUPD_DBUS_INTERFACE ".BrokenSystem") == 0)
+ return FWUPD_ERROR_BROKEN_SYSTEM;
+ if (g_strcmp0 (error, FWUPD_DBUS_INTERFACE ".BatteryLevelTooLow") == 0)
+ return FWUPD_ERROR_BATTERY_LEVEL_TOO_LOW;
return FWUPD_ERROR_LAST;
}
diff -Nru fwupd-1.0.6/libfwupd/fwupd-error.h fwupd-1.2.10/libfwupd/fwupd-error.h
--- fwupd-1.0.6/libfwupd/fwupd-error.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-error.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,29 +1,15 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2016 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_ERROR_H
-#define __FWUPD_ERROR_H
+#pragma once
#include
+G_BEGIN_DECLS
+
#define FWUPD_ERROR fwupd_error_quark()
/**
@@ -42,6 +28,8 @@
* @FWUPD_ERROR_SIGNATURE_INVALID: Signature was invalid
* @FWUPD_ERROR_AC_POWER_REQUIRED: AC power was required
* @FWUPD_ERROR_PERMISSION_DENIED: Permission was denied
+ * @FWUPD_ERROR_BROKEN_SYSTEM: User has configured their system in a broken way
+ * @FWUPD_ERROR_BATTERY_LEVEL_TOO_LOW: The system battery level is too low
*
* The error code.
**/
@@ -60,6 +48,8 @@
FWUPD_ERROR_SIGNATURE_INVALID, /* Since: 0.1.2 */
FWUPD_ERROR_AC_POWER_REQUIRED, /* Since: 0.8.0 */
FWUPD_ERROR_PERMISSION_DENIED, /* Since: 0.9.8 */
+ FWUPD_ERROR_BROKEN_SYSTEM, /* Since: 1.2.8 */
+ FWUPD_ERROR_BATTERY_LEVEL_TOO_LOW, /* Since: 1.2.10 */
/*< private >*/
FWUPD_ERROR_LAST
} FwupdError;
@@ -68,4 +58,4 @@
const gchar *fwupd_error_to_string (FwupdError error);
FwupdError fwupd_error_from_string (const gchar *error);
-#endif /* __FWUPD_ERROR_H */
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd.h fwupd-1.2.10/libfwupd/fwupd.h
--- fwupd-1.0.6/libfwupd/fwupd.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,32 +1,16 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
+#pragma once
+
/**
* SECTION:fwupd
* @short_description: Helper objects for accessing fwupd
*/
-#ifndef __FWUPD_H__
-#define __FWUPD_H__
-
#define __FWUPD_H_INSIDE__
#include
@@ -43,6 +27,3 @@
#endif
#undef __FWUPD_H_INSIDE__
-
-#endif /* __FWUPD_H__ */
-
diff -Nru fwupd-1.0.6/libfwupd/fwupd.map fwupd-1.2.10/libfwupd/fwupd.map
--- fwupd-1.0.6/libfwupd/fwupd.map 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd.map 2019-07-15 18:25:54.000000000 +0000
@@ -235,3 +235,139 @@
fwupd_remote_get_report_uri;
local: *;
} LIBFWUPD_1.0.3;
+
+LIBFWUPD_1.0.7 {
+ global:
+ fwupd_get_os_release;
+ fwupd_remote_get_agreement;
+ fwupd_remote_set_agreement;
+ local: *;
+} LIBFWUPD_1.0.4;
+
+LIBFWUPD_1.0.8 {
+ global:
+ fwupd_device_get_parent;
+ fwupd_device_get_parent_id;
+ fwupd_device_set_parent;
+ fwupd_device_set_parent_id;
+ local: *;
+} LIBFWUPD_1.0.7;
+
+LIBFWUPD_1.1.0 {
+ global:
+ fwupd_device_incorporate;
+ local: *;
+} LIBFWUPD_1.0.8;
+
+LIBFWUPD_1.1.1 {
+ global:
+ fwupd_device_compare;
+ local: *;
+} LIBFWUPD_1.1.0;
+
+LIBFWUPD_1.1.2 {
+ global:
+ fwupd_device_get_serial;
+ fwupd_device_set_serial;
+ fwupd_device_to_variant_full;
+ local: *;
+} LIBFWUPD_1.1.1;
+
+LIBFWUPD_1.1.3 {
+ global:
+ fwupd_device_get_install_duration;
+ fwupd_device_set_install_duration;
+ local: *;
+} LIBFWUPD_1.1.2;
+
+LIBFWUPD_1.2.1 {
+ global:
+ fwupd_release_get_install_duration;
+ fwupd_release_set_install_duration;
+ local: *;
+} LIBFWUPD_1.1.3;
+
+LIBFWUPD_1.2.2 {
+ global:
+ fwupd_release_get_protocol;
+ fwupd_release_set_protocol;
+ local: *;
+} LIBFWUPD_1.2.1;
+
+LIBFWUPD_1.2.4 {
+ global:
+ fwupd_client_get_tainted;
+ fwupd_device_get_update_message;
+ fwupd_device_set_update_message;
+ fwupd_release_get_details_url;
+ fwupd_release_get_source_url;
+ fwupd_release_get_update_message;
+ fwupd_release_set_details_url;
+ fwupd_release_set_source_url;
+ fwupd_release_set_update_message;
+ local: *;
+} LIBFWUPD_1.2.2;
+
+LIBFWUPD_1.2.5 {
+ global:
+ fwupd_device_add_instance_id;
+ fwupd_device_get_instance_ids;
+ fwupd_device_has_instance_id;
+ fwupd_guid_from_string;
+ fwupd_guid_hash_data;
+ fwupd_guid_hash_string;
+ fwupd_guid_is_valid;
+ fwupd_guid_to_string;
+ local: *;
+} LIBFWUPD_1.2.4;
+
+LIBFWUPD_1.2.6 {
+ global:
+ fwupd_client_activate;
+ fwupd_client_get_approved_firmware;
+ fwupd_client_self_sign;
+ fwupd_client_set_approved_firmware;
+ fwupd_device_to_json;
+ fwupd_release_add_flag;
+ fwupd_release_flag_from_string;
+ fwupd_release_flag_to_string;
+ fwupd_release_get_flags;
+ fwupd_release_has_checksum;
+ fwupd_release_has_flag;
+ fwupd_release_remove_flag;
+ fwupd_release_set_flags;
+ fwupd_release_to_json;
+ fwupd_remote_get_approval_required;
+ local: *;
+} LIBFWUPD_1.2.5;
+
+LIBFWUPD_1.2.7 {
+ global:
+ fwupd_release_add_category;
+ fwupd_release_get_categories;
+ fwupd_release_has_category;
+ local: *;
+} LIBFWUPD_1.2.6;
+
+LIBFWUPD_1.2.8 {
+ global:
+ fwupd_client_modify_config;
+ local: *;
+} LIBFWUPD_1.2.7;
+
+LIBFWUPD_1.2.9 {
+ global:
+ fwupd_device_get_version_format;
+ fwupd_device_set_version_format;
+ fwupd_version_format_from_string;
+ fwupd_version_format_to_string;
+ local: *;
+} LIBFWUPD_1.2.8;
+
+LIBFWUPD_1.2.10 {
+ global:
+ fwupd_device_array_from_variant;
+ fwupd_release_array_from_variant;
+ fwupd_remote_array_from_variant;
+ local: *;
+} LIBFWUPD_1.2.9;
diff -Nru fwupd-1.0.6/libfwupd/fwupd-release.c fwupd-1.2.10/libfwupd/fwupd-release.c
--- fwupd-1.0.6/libfwupd/fwupd-release.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-release.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2015-2018 Richard Hughes
*
- * Copyright (C) 2015-2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -45,10 +30,14 @@
typedef struct {
GPtrArray *checksums;
+ GPtrArray *categories;
GHashTable *metadata;
gchar *description;
gchar *filename;
+ gchar *protocol;
gchar *homepage;
+ gchar *details_url;
+ gchar *source_url;
gchar *appstream_id;
gchar *license;
gchar *name;
@@ -58,12 +47,18 @@
gchar *version;
gchar *remote_id;
guint64 size;
- FwupdTrustFlags trust_flags;
+ guint32 install_duration;
+ FwupdReleaseFlags flags;
+ gchar *update_message;
} FwupdReleasePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (FwupdRelease, fwupd_release, G_TYPE_OBJECT)
#define GET_PRIVATE(o) (fwupd_release_get_instance_private (o))
+/* the deprecated fwupd_release_get_trust_flags() function should only
+ * return the last two bits of the #FwupdReleaseFlags */
+#define FWUPD_RELEASE_TRUST_FLAGS_MASK 0x3
+
/**
* fwupd_release_get_remote_id:
* @release: A #FwupdRelease
@@ -173,6 +168,144 @@
}
/**
+ * fwupd_release_get_update_message:
+ * @release: A #FwupdRelease
+ *
+ * Gets the update message.
+ *
+ * Returns: the update message, or %NULL if unset
+ *
+ * Since: 1.2.4
+ **/
+const gchar *
+fwupd_release_get_update_message (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
+ return priv->update_message;
+}
+
+/**
+ * fwupd_release_set_update_message:
+ * @release: A #FwupdRelease
+ * @update_message: the update message string
+ *
+ * Sets the update message.
+ *
+ * Since: 1.2.4
+ **/
+void
+fwupd_release_set_update_message (FwupdRelease *release, const gchar *update_message)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_free (priv->update_message);
+ priv->update_message = g_strdup (update_message);
+}
+
+/**
+ * fwupd_release_get_protocol:
+ * @release: A #FwupdRelease
+ *
+ * Gets the update protocol.
+ *
+ * Returns: the update protocol, or %NULL if unset
+ *
+ * Since: 1.2.2
+ **/
+const gchar *
+fwupd_release_get_protocol (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
+ return priv->protocol;
+}
+
+/**
+ * fwupd_release_set_protocol:
+ * @release: A #FwupdRelease
+ * @protocol: the update protocol, e.g. `org.usb.dfu`
+ *
+ * Sets the update protocol.
+ *
+ * Since: 1.2.2
+ **/
+void
+fwupd_release_set_protocol (FwupdRelease *release, const gchar *protocol)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_free (priv->protocol);
+ priv->protocol = g_strdup (protocol);
+}
+
+/**
+ * fwupd_release_get_categories:
+ * @release: A #FwupdRelease
+ *
+ * Gets the release categories.
+ *
+ * Returns: (element-type utf8) (transfer none): the categories, which may be empty
+ *
+ * Since: 1.2.7
+ **/
+GPtrArray *
+fwupd_release_get_categories (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
+ return priv->categories;
+}
+
+/**
+ * fwupd_release_add_category:
+ * @release: A #FwupdRelease
+ * @category: the update category, e.g. `X-EmbeddedController`
+ *
+ * Adds the update category.
+ *
+ * Since: 1.2.7
+ **/
+void
+fwupd_release_add_category (FwupdRelease *release, const gchar *category)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_return_if_fail (category != NULL);
+ for (guint i = 0; i < priv->categories->len; i++) {
+ const gchar *category_tmp = g_ptr_array_index (priv->categories, i);
+ if (g_strcmp0 (category_tmp, category) == 0)
+ return;
+ }
+ g_ptr_array_add (priv->categories, g_strdup (category));
+}
+
+/**
+ * fwupd_release_has_category:
+ * @release: A #FwupdRelease
+ * @category: the update category, e.g. `X-EmbeddedController`
+ *
+ * Finds out if the release has the update category.
+ *
+ * Returns: %TRUE if the release matches
+ *
+ * Since: 1.2.7
+ **/
+gboolean
+fwupd_release_has_category (FwupdRelease *release, const gchar *category)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), FALSE);
+ g_return_val_if_fail (category != NULL, FALSE);
+ for (guint i = 0; i < priv->categories->len; i++) {
+ const gchar *category_tmp = g_ptr_array_index (priv->categories, i);
+ if (g_strcmp0 (category_tmp, category) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
* fwupd_release_get_checksums:
* @release: A #FwupdRelease
*
@@ -214,6 +347,31 @@
}
/**
+ * fwupd_release_has_checksum:
+ * @release: A #FwupdRelease
+ * @checksum: the update checksum
+ *
+ * Finds out if the release has the update checksum.
+ *
+ * Returns: %TRUE if the release matches
+ *
+ * Since: 1.2.6
+ **/
+gboolean
+fwupd_release_has_checksum (FwupdRelease *release, const gchar *checksum)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), FALSE);
+ g_return_val_if_fail (checksum != NULL, FALSE);
+ for (guint i = 0; i < priv->checksums->len; i++) {
+ const gchar *checksum_tmp = g_ptr_array_index (priv->checksums, i);
+ if (g_strcmp0 (checksum_tmp, checksum) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
* fwupd_release_get_metadata:
* @release: A #FwupdRelease
*
@@ -371,6 +529,78 @@
}
/**
+ * fwupd_release_get_details_url:
+ * @release: A #FwupdRelease
+ *
+ * Gets the URL for the online update notes.
+ *
+ * Returns: the update URL, or %NULL if unset
+ *
+ * Since: 1.2.4
+ **/
+const gchar *
+fwupd_release_get_details_url (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
+ return priv->details_url;
+}
+
+/**
+ * fwupd_release_set_details_url:
+ * @release: A #FwupdRelease
+ * @details_url: the URL
+ *
+ * Sets the URL for the online update notes.
+ *
+ * Since: 1.2.4
+ **/
+void
+fwupd_release_set_details_url (FwupdRelease *release, const gchar *details_url)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_free (priv->details_url);
+ priv->details_url = g_strdup (details_url);
+}
+
+/**
+ * fwupd_release_get_source_url:
+ * @release: A #FwupdRelease
+ *
+ * Gets the URL of the source code used to build this release.
+ *
+ * Returns: the update source_url, or %NULL if unset
+ *
+ * Since: 1.2.4
+ **/
+const gchar *
+fwupd_release_get_source_url (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
+ return priv->source_url;
+}
+
+/**
+ * fwupd_release_set_source_url:
+ * @release: A #FwupdRelease
+ * @source_url: the URL
+ *
+ * Sets the URL of the source code used to build this release.
+ *
+ * Since: 1.2.4
+ **/
+void
+fwupd_release_set_source_url (FwupdRelease *release, const gchar *source_url)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_free (priv->source_url);
+ priv->source_url = g_strdup (source_url);
+}
+
+/**
* fwupd_release_get_description:
* @release: A #FwupdRelease
*
@@ -636,7 +866,7 @@
{
FwupdReleasePrivate *priv = GET_PRIVATE (release);
g_return_val_if_fail (FWUPD_IS_RELEASE (release), 0);
- return priv->trust_flags;
+ return priv->flags & FWUPD_RELEASE_TRUST_FLAGS_MASK;
}
/**
@@ -653,7 +883,133 @@
{
FwupdReleasePrivate *priv = GET_PRIVATE (release);
g_return_if_fail (FWUPD_IS_RELEASE (release));
- priv->trust_flags = trust_flags;
+
+ /* only overwrite the last two bits of the flags */
+ priv->flags &= ~FWUPD_RELEASE_TRUST_FLAGS_MASK;
+ priv->flags |= trust_flags;
+}
+
+/**
+ * fwupd_release_get_flags:
+ * @release: A #FwupdRelease
+ *
+ * Gets the release flags.
+ *
+ * Returns: the release flags, or 0 if unset
+ *
+ * Since: 1.2.6
+ **/
+FwupdReleaseFlags
+fwupd_release_get_flags (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), 0);
+ return priv->flags;
+}
+
+/**
+ * fwupd_release_set_flags:
+ * @release: A #FwupdRelease
+ * @flags: the release flags, e.g. %FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD
+ *
+ * Sets the release flags.
+ *
+ * Since: 1.2.6
+ **/
+void
+fwupd_release_set_flags (FwupdRelease *release, FwupdReleaseFlags flags)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ priv->flags = flags;
+}
+
+/**
+ * fwupd_release_add_flag:
+ * @release: A #FwupdRelease
+ * @flag: the #FwupdReleaseFlags
+ *
+ * Adds a specific release flag to the release.
+ *
+ * Since: 1.2.6
+ **/
+void
+fwupd_release_add_flag (FwupdRelease *release, FwupdReleaseFlags flag)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ priv->flags |= flag;
+}
+
+/**
+ * fwupd_release_remove_flag:
+ * @release: A #FwupdRelease
+ * @flag: the #FwupdReleaseFlags
+ *
+ * Removes a specific release flag from the release.
+ *
+ * Since: 1.2.6
+ **/
+void
+fwupd_release_remove_flag (FwupdRelease *release, FwupdReleaseFlags flag)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ priv->flags &= ~flag;
+}
+
+/**
+ * fwupd_release_has_flag:
+ * @release: A #FwupdRelease
+ * @flag: the #FwupdReleaseFlags
+ *
+ * Finds if the release has a specific release flag.
+ *
+ * Returns: %TRUE if the flag is set
+ *
+ * Since: 1.2.6
+ **/
+gboolean
+fwupd_release_has_flag (FwupdRelease *release, FwupdReleaseFlags flag)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), FALSE);
+ return (priv->flags & flag) > 0;
+}
+
+/**
+ * fwupd_release_get_install_duration:
+ * @release: A #FwupdRelease
+ *
+ * Gets the time estimate for firmware installation (in seconds)
+ *
+ * Returns: the estimated time to flash this release (or 0 if unset)
+ *
+ * Since: 1.2.1
+ **/
+guint32
+fwupd_release_get_install_duration (FwupdRelease *release)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_val_if_fail (FWUPD_IS_RELEASE (release), 0);
+ return priv->install_duration;
+}
+
+/**
+ * fwupd_release_set_install_duration:
+ * @release: A #FwupdRelease
+ * @duration: The amount of time
+ *
+ * Sets the time estimate for firmware installation (in seconds)
+ *
+ * Since: 1.2.1
+ **/
+void
+fwupd_release_set_install_duration (FwupdRelease *release, guint32 duration)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ priv->install_duration = duration;
}
static GVariant *
@@ -702,7 +1058,7 @@
g_return_val_if_fail (FWUPD_IS_RELEASE (release), NULL);
/* create an array with all the metadata in */
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
if (priv->remote_id != NULL) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_REMOTE_ID,
@@ -718,6 +1074,11 @@
FWUPD_RESULT_KEY_FILENAME,
g_variant_new_string (priv->filename));
}
+ if (priv->protocol != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_PROTOCOL,
+ g_variant_new_string (priv->protocol));
+ }
if (priv->license != NULL) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_LICENSE,
@@ -743,6 +1104,14 @@
FWUPD_RESULT_KEY_DESCRIPTION,
g_variant_new_string (priv->description));
}
+ if (priv->categories->len > 0) {
+ g_autofree const gchar **strv = g_new0 (const gchar *, priv->categories->len + 1);
+ for (guint i = 0; i < priv->categories->len; i++)
+ strv[i] = (const gchar *) g_ptr_array_index (priv->categories, i);
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_CATEGORIES,
+ g_variant_new_strv (strv, -1));
+ }
if (priv->checksums->len > 0) {
g_autoptr(GString) str = g_string_new ("");
for (guint i = 0; i < priv->checksums->len; i++) {
@@ -765,6 +1134,16 @@
FWUPD_RESULT_KEY_HOMEPAGE,
g_variant_new_string (priv->homepage));
}
+ if (priv->details_url != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_DETAILS_URL,
+ g_variant_new_string (priv->details_url));
+ }
+ if (priv->source_url != NULL) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_SOURCE_URL,
+ g_variant_new_string (priv->source_url));
+ }
if (priv->version != NULL) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_VERSION,
@@ -775,16 +1154,21 @@
FWUPD_RESULT_KEY_VENDOR,
g_variant_new_string (priv->vendor));
}
- if (priv->trust_flags != 0) {
+ if (priv->flags != 0) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_TRUST_FLAGS,
- g_variant_new_uint64 (priv->trust_flags));
+ g_variant_new_uint64 (priv->flags));
}
if (g_hash_table_size (priv->metadata) > 0) {
g_variant_builder_add (&builder, "{sv}",
FWUPD_RESULT_KEY_METADATA,
_hash_kv_to_variant (priv->metadata));
}
+ if (priv->install_duration > 0) {
+ g_variant_builder_add (&builder, "{sv}",
+ FWUPD_RESULT_KEY_INSTALL_DURATION,
+ g_variant_new_uint32 (priv->install_duration));
+ }
return g_variant_new ("a{sv}", &builder);
}
@@ -804,6 +1188,10 @@
fwupd_release_set_filename (release, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_PROTOCOL) == 0) {
+ fwupd_release_set_protocol (release, g_variant_get_string (value, NULL));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_LICENSE) == 0) {
fwupd_release_set_license (release, g_variant_get_string (value, NULL));
return;
@@ -824,6 +1212,12 @@
fwupd_release_set_description (release, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_CATEGORIES) == 0) {
+ g_autofree const gchar **strv = g_variant_get_strv (value, NULL);
+ for (guint i = 0; strv[i] != NULL; i++)
+ fwupd_release_add_category (release, strv[i]);
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_CHECKSUM) == 0) {
const gchar *checksums = g_variant_get_string (value, NULL);
g_auto(GStrv) split = g_strsplit (checksums, ",", -1);
@@ -839,6 +1233,14 @@
fwupd_release_set_homepage (release, g_variant_get_string (value, NULL));
return;
}
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_DETAILS_URL) == 0) {
+ fwupd_release_set_details_url (release, g_variant_get_string (value, NULL));
+ return;
+ }
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_SOURCE_URL) == 0) {
+ fwupd_release_set_source_url (release, g_variant_get_string (value, NULL));
+ return;
+ }
if (g_strcmp0 (key, FWUPD_RESULT_KEY_VERSION) == 0) {
fwupd_release_set_version (release, g_variant_get_string (value, NULL));
return;
@@ -848,7 +1250,15 @@
return;
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_TRUST_FLAGS) == 0) {
- fwupd_release_set_trust_flags (release, g_variant_get_uint64 (value));
+ fwupd_release_set_flags (release, g_variant_get_uint64 (value));
+ return;
+ }
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_INSTALL_DURATION) == 0) {
+ fwupd_release_set_install_duration (release, g_variant_get_uint32 (value));
+ return;
+ }
+ if (g_strcmp0 (key, FWUPD_RESULT_KEY_UPDATE_MESSAGE) == 0) {
+ fwupd_release_set_update_message (release, g_variant_get_string (value, NULL));
return;
}
if (g_strcmp0 (key, FWUPD_RESULT_KEY_METADATA) == 0) {
@@ -883,23 +1293,127 @@
}
static void
-fwupd_pad_kv_tfl (GString *str, const gchar *key, FwupdTrustFlags trust_flags)
+fwupd_pad_kv_tfl (GString *str, const gchar *key, FwupdReleaseFlags release_flags)
{
g_autoptr(GString) tmp = g_string_new ("");
- for (guint i = 1; i < FWUPD_TRUST_FLAG_LAST; i *= 2) {
- if ((trust_flags & i) == 0)
+ for (guint i = 0; i < 64; i++) {
+ if ((release_flags & ((guint64) 1 << i)) == 0)
continue;
g_string_append_printf (tmp, "%s|",
- fwupd_trust_flag_to_string (i));
+ fwupd_release_flag_to_string ((guint64) 1 << i));
}
if (tmp->len == 0) {
- g_string_append (tmp, fwupd_trust_flag_to_string (0));
+ g_string_append (tmp, fwupd_release_flag_to_string (0));
} else {
g_string_truncate (tmp, tmp->len - 1);
}
fwupd_pad_kv_str (str, key, tmp->str);
}
+static void
+fwupd_pad_kv_int (GString *str, const gchar *key, guint32 value)
+{
+ g_autofree gchar *tmp = NULL;
+
+ /* ignore */
+ if (value == 0)
+ return;
+ tmp = g_strdup_printf("%" G_GUINT32_FORMAT, value);
+ fwupd_pad_kv_str (str, key, tmp);
+}
+
+static void
+fwupd_release_json_add_string (JsonBuilder *builder, const gchar *key, const gchar *str)
+{
+ if (str == NULL)
+ return;
+ json_builder_set_member_name (builder, key);
+ json_builder_add_string_value (builder, str);
+}
+
+static void
+fwupd_release_json_add_int (JsonBuilder *builder, const gchar *key, guint64 num)
+{
+ if (num == 0)
+ return;
+ json_builder_set_member_name (builder, key);
+ json_builder_add_int_value (builder, num);
+}
+
+/**
+ * fwupd_release_to_json:
+ * @release: A #FwupdRelease
+ * @builder: A #JsonBuilder
+ *
+ * Adds a fwupd release to a JSON builder
+ *
+ * Since: 1.2.6
+ **/
+void
+fwupd_release_to_json (FwupdRelease *release, JsonBuilder *builder)
+{
+ FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ g_autoptr(GList) keys = NULL;
+
+ g_return_if_fail (FWUPD_IS_RELEASE (release));
+ g_return_if_fail (builder != NULL);
+
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_APPSTREAM_ID, priv->appstream_id);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_REMOTE_ID, priv->remote_id);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_SUMMARY, priv->summary);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_DESCRIPTION, priv->description);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_VERSION, priv->version);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_FILENAME, priv->filename);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_PROTOCOL, priv->protocol);
+ if (priv->categories->len > 0) {
+ json_builder_set_member_name (builder, FWUPD_RESULT_KEY_CATEGORIES);
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->categories->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv->categories, i);
+ json_builder_add_string_value (builder, tmp);
+ }
+ json_builder_end_array (builder);
+ }
+ if (priv->checksums->len > 0) {
+ json_builder_set_member_name (builder, FWUPD_RESULT_KEY_CHECKSUM);
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < priv->checksums->len; i++) {
+ const gchar *checksum = g_ptr_array_index (priv->checksums, i);
+ json_builder_add_string_value (builder, checksum);
+ }
+ json_builder_end_array (builder);
+ }
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_LICENSE, priv->license);
+ fwupd_release_json_add_int (builder, FWUPD_RESULT_KEY_SIZE, priv->size);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_URI, priv->uri);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_HOMEPAGE, priv->homepage);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_DETAILS_URL, priv->details_url);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_SOURCE_URL, priv->source_url);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_VENDOR, priv->vendor);
+ if (priv->flags != FWUPD_RELEASE_FLAG_NONE) {
+ json_builder_set_member_name (builder, FWUPD_RESULT_KEY_FLAGS);
+ json_builder_begin_array (builder);
+ for (guint i = 0; i < 64; i++) {
+ const gchar *tmp;
+ if ((priv->flags & ((guint64) 1 << i)) == 0)
+ continue;
+ tmp = fwupd_release_flag_to_string ((guint64) 1 << i);
+ json_builder_add_string_value (builder, tmp);
+ }
+ json_builder_end_array (builder);
+ }
+ fwupd_release_json_add_int (builder, FWUPD_RESULT_KEY_INSTALL_DURATION, priv->install_duration);
+ fwupd_release_json_add_string (builder, FWUPD_RESULT_KEY_UPDATE_MESSAGE, priv->update_message);
+
+ /* metadata */
+ keys = g_hash_table_get_keys (priv->metadata);
+ for (GList *l = keys; l != NULL; l = l->next) {
+ const gchar *key = l->data;
+ const gchar *value = g_hash_table_lookup (priv->metadata, key);
+ fwupd_release_json_add_string (builder, key, value);
+ }
+}
+
/**
* fwupd_release_to_string:
* @release: A #FwupdRelease
@@ -926,6 +1440,11 @@
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DESCRIPTION, priv->description);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VERSION, priv->version);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_FILENAME, priv->filename);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_PROTOCOL, priv->protocol);
+ for (guint i = 0; i < priv->categories->len; i++) {
+ const gchar *tmp = g_ptr_array_index (priv->categories, i);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_CATEGORIES, tmp);
+ }
for (guint i = 0; i < priv->checksums->len; i++) {
const gchar *checksum = g_ptr_array_index (priv->checksums, i);
g_autofree gchar *checksum_display = fwupd_checksum_format_for_display (checksum);
@@ -935,9 +1454,13 @@
fwupd_pad_kv_siz (str, FWUPD_RESULT_KEY_SIZE, priv->size);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_URI, priv->uri);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_HOMEPAGE, priv->homepage);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_DETAILS_URL, priv->details_url);
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_SOURCE_URL, priv->source_url);
fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_VENDOR, priv->vendor);
- fwupd_pad_kv_tfl (str, FWUPD_RESULT_KEY_TRUST_FLAGS, priv->trust_flags);
-
+ fwupd_pad_kv_tfl (str, FWUPD_RESULT_KEY_FLAGS, priv->flags);
+ fwupd_pad_kv_int (str, FWUPD_RESULT_KEY_INSTALL_DURATION, priv->install_duration);
+ if (priv->update_message != NULL)
+ fwupd_pad_kv_str (str, FWUPD_RESULT_KEY_UPDATE_MESSAGE, priv->update_message);
/* metadata */
keys = g_hash_table_get_keys (priv->metadata);
for (GList *l = keys; l != NULL; l = l->next) {
@@ -960,6 +1483,7 @@
fwupd_release_init (FwupdRelease *release)
{
FwupdReleasePrivate *priv = GET_PRIVATE (release);
+ priv->categories = g_ptr_array_new_with_free_func (g_free);
priv->checksums = g_ptr_array_new_with_free_func (g_free);
priv->metadata = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
}
@@ -972,15 +1496,20 @@
g_free (priv->description);
g_free (priv->filename);
+ g_free (priv->protocol);
g_free (priv->appstream_id);
g_free (priv->license);
g_free (priv->name);
g_free (priv->summary);
g_free (priv->uri);
g_free (priv->homepage);
+ g_free (priv->details_url);
+ g_free (priv->source_url);
g_free (priv->vendor);
g_free (priv->version);
g_free (priv->remote_id);
+ g_free (priv->update_message);
+ g_ptr_array_unref (priv->categories);
g_ptr_array_unref (priv->checksums);
g_hash_table_unref (priv->metadata);
@@ -1000,30 +1529,30 @@
/**
* fwupd_release_from_variant:
- * @data: a #GVariant
+ * @value: a #GVariant
*
* Creates a new release using packed data.
*
- * Returns: (transfer full): a new #FwupdRelease, or %NULL if @data was invalid
+ * Returns: (transfer full): a new #FwupdRelease, or %NULL if @value was invalid
*
* Since: 1.0.0
**/
FwupdRelease *
-fwupd_release_from_variant (GVariant *data)
+fwupd_release_from_variant (GVariant *value)
{
FwupdRelease *rel = NULL;
const gchar *type_string;
g_autoptr(GVariantIter) iter = NULL;
/* format from GetDetails */
- type_string = g_variant_get_type_string (data);
+ type_string = g_variant_get_type_string (value);
if (g_strcmp0 (type_string, "(a{sv})") == 0) {
rel = fwupd_release_new ();
- g_variant_get (data, "(a{sv})", &iter);
+ g_variant_get (value, "(a{sv})", &iter);
fwupd_release_set_from_variant_iter (rel, iter);
} else if (g_strcmp0 (type_string, "a{sv}") == 0) {
rel = fwupd_release_new ();
- g_variant_get (data, "a{sv}", &iter);
+ g_variant_get (value, "a{sv}", &iter);
fwupd_release_set_from_variant_iter (rel, iter);
} else {
g_warning ("type %s not known", type_string);
@@ -1032,6 +1561,38 @@
}
/**
+ * fwupd_release_array_from_variant:
+ * @value: a #GVariant
+ *
+ * Creates an array of new releases using packed data.
+ *
+ * Returns: (transfer container) (element-type FwupdRelease): releases, or %NULL if @value was invalid
+ *
+ * Since: 1.2.10
+ **/
+GPtrArray *
+fwupd_release_array_from_variant (GVariant *value)
+{
+ GPtrArray *array = NULL;
+ gsize sz;
+ g_autoptr(GVariant) untuple = NULL;
+
+ array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ untuple = g_variant_get_child_value (value, 0);
+ sz = g_variant_n_children (untuple);
+ for (guint i = 0; i < sz; i++) {
+ FwupdRelease *rel;
+ g_autoptr(GVariant) data = NULL;
+ data = g_variant_get_child_value (untuple, i);
+ rel = fwupd_release_from_variant (data);
+ if (rel == NULL)
+ continue;
+ g_ptr_array_add (array, rel);
+ }
+ return array;
+}
+
+/**
* fwupd_release_new:
*
* Creates a new release.
diff -Nru fwupd-1.0.6/libfwupd/fwupd-release.h fwupd-1.2.10/libfwupd/fwupd-release.h
--- fwupd-1.0.6/libfwupd/fwupd-release.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-release.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2015-2018 Richard Hughes
*
- * Copyright (C) 2015-2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_RELEASE_H
-#define __FWUPD_RELEASE_H
+#pragma once
#include
@@ -53,9 +37,16 @@
const gchar *fwupd_release_get_uri (FwupdRelease *release);
void fwupd_release_set_uri (FwupdRelease *release,
const gchar *uri);
+GPtrArray *fwupd_release_get_categories (FwupdRelease *release);
+void fwupd_release_add_category (FwupdRelease *release,
+ const gchar *category);
+gboolean fwupd_release_has_category (FwupdRelease *release,
+ const gchar *category);
GPtrArray *fwupd_release_get_checksums (FwupdRelease *release);
void fwupd_release_add_checksum (FwupdRelease *release,
const gchar *checksum);
+gboolean fwupd_release_has_checksum (FwupdRelease *release,
+ const gchar *checksum);
GHashTable *fwupd_release_get_metadata (FwupdRelease *release);
void fwupd_release_add_metadata (FwupdRelease *release,
@@ -69,6 +60,9 @@
const gchar *fwupd_release_get_filename (FwupdRelease *release);
void fwupd_release_set_filename (FwupdRelease *release,
const gchar *filename);
+const gchar *fwupd_release_get_protocol (FwupdRelease *release);
+void fwupd_release_set_protocol (FwupdRelease *release,
+ const gchar *protocol);
const gchar *fwupd_release_get_appstream_id (FwupdRelease *release);
void fwupd_release_set_appstream_id (FwupdRelease *release,
const gchar *appstream_id);
@@ -90,17 +84,40 @@
const gchar *fwupd_release_get_homepage (FwupdRelease *release);
void fwupd_release_set_homepage (FwupdRelease *release,
const gchar *homepage);
+const gchar *fwupd_release_get_details_url (FwupdRelease *release);
+void fwupd_release_set_details_url (FwupdRelease *release,
+ const gchar *details_url);
+const gchar *fwupd_release_get_source_url (FwupdRelease *release);
+void fwupd_release_set_source_url (FwupdRelease *release,
+ const gchar *source_url);
guint64 fwupd_release_get_size (FwupdRelease *release);
void fwupd_release_set_size (FwupdRelease *release,
guint64 size);
const gchar *fwupd_release_get_license (FwupdRelease *release);
void fwupd_release_set_license (FwupdRelease *release,
const gchar *license);
-FwupdTrustFlags fwupd_release_get_trust_flags (FwupdRelease *release);
+FwupdTrustFlags fwupd_release_get_trust_flags (FwupdRelease *release)
+G_DEPRECATED_FOR(fwupd_release_get_flags);
void fwupd_release_set_trust_flags (FwupdRelease *release,
- FwupdTrustFlags trust_flags);
-
-G_END_DECLS
+ FwupdTrustFlags trust_flags)
+G_DEPRECATED_FOR(fwupd_release_set_flags);
+FwupdReleaseFlags fwupd_release_get_flags (FwupdRelease *release);
+void fwupd_release_set_flags (FwupdRelease *release,
+ FwupdReleaseFlags flags);
+void fwupd_release_add_flag (FwupdRelease *release,
+ FwupdReleaseFlags flag);
+void fwupd_release_remove_flag (FwupdRelease *release,
+ FwupdReleaseFlags flag);
+gboolean fwupd_release_has_flag (FwupdRelease *release,
+ FwupdReleaseFlags flag);
+guint32 fwupd_release_get_install_duration (FwupdRelease *release);
+void fwupd_release_set_install_duration (FwupdRelease *release,
+ guint32 duration);
+const gchar *fwupd_release_get_update_message (FwupdRelease *release);
+void fwupd_release_set_update_message (FwupdRelease *release,
+ const gchar *update_message);
-#endif /* __FWUPD_RELEASE_H */
+FwupdRelease *fwupd_release_from_variant (GVariant *value);
+GPtrArray *fwupd_release_array_from_variant (GVariant *value);
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-release-private.h fwupd-1.2.10/libfwupd/fwupd-release-private.h
--- fwupd-1.0.6/libfwupd/fwupd-release-private.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-release-private.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,37 +1,21 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_RELEASE_PRIVATE_H
-#define __FWUPD_RELEASE_PRIVATE_H
+#pragma once
#include
+#include
#include "fwupd-release.h"
G_BEGIN_DECLS
-FwupdRelease *fwupd_release_from_variant (GVariant *data);
GVariant *fwupd_release_to_variant (FwupdRelease *release);
+void fwupd_release_to_json (FwupdRelease *release,
+ JsonBuilder *builder);
G_END_DECLS
-#endif /* __FWUPD_RELEASE_PRIVATE_H */
-
diff -Nru fwupd-1.0.6/libfwupd/fwupd-remote.c fwupd-1.2.10/libfwupd/fwupd-remote.c
--- fwupd-1.0.6/libfwupd/fwupd-remote.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-remote.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -51,11 +36,13 @@
gchar *username;
gchar *password;
gchar *title;
+ gchar *agreement;
gchar *checksum;
gchar *filename_cache;
gchar *filename_cache_sig;
gchar *filename_source;
gboolean enabled;
+ gboolean approval_required;
gint priority;
guint64 mtime;
gchar **order_after;
@@ -66,6 +53,7 @@
PROP_0,
PROP_ID,
PROP_ENABLED,
+ PROP_APPROVAL_REQUIRED,
PROP_LAST
};
@@ -89,6 +77,23 @@
priv->title = g_strdup (title);
}
+/**
+ * fwupd_remote_set_agreement:
+ * @self: A #FwupdRemote
+ * @agreement: Agreement markup
+ *
+ * Sets the remote agreement in AppStream markup format
+ *
+ * Since: 1.0.7
+ **/
+void
+fwupd_remote_set_agreement (FwupdRemote *self, const gchar *agreement)
+{
+ FwupdRemotePrivate *priv = GET_PRIVATE (self);
+ g_free (priv->agreement);
+ priv->agreement = g_strdup (agreement);
+}
+
static void
fwupd_remote_set_checksum (FwupdRemote *self, const gchar *checksum)
{
@@ -272,6 +277,8 @@
return FWUPD_REMOTE_KIND_DOWNLOAD;
if (g_strcmp0 (kind, "local") == 0)
return FWUPD_REMOTE_KIND_LOCAL;
+ if (g_strcmp0 (kind, "directory") == 0)
+ return FWUPD_REMOTE_KIND_DIRECTORY;
return FWUPD_REMOTE_KIND_UNKNOWN;
}
@@ -292,6 +299,8 @@
return "download";
if (kind == FWUPD_REMOTE_KIND_LOCAL)
return "local";
+ if (kind == FWUPD_REMOTE_KIND_DIRECTORY)
+ return "directory";
return NULL;
}
@@ -381,7 +390,14 @@
if (metadata_uri == NULL)
return FALSE;
if (g_str_has_prefix (metadata_uri, "file://")) {
- priv->kind = FWUPD_REMOTE_KIND_LOCAL;
+ const gchar *filename_cache = metadata_uri;
+ if (g_str_has_prefix (filename_cache, "file://"))
+ filename_cache += 7;
+ fwupd_remote_set_filename_cache (self, filename_cache);
+ if (g_file_test (filename_cache, G_FILE_TEST_IS_DIR))
+ priv->kind = FWUPD_REMOTE_KIND_DIRECTORY;
+ else
+ priv->kind = FWUPD_REMOTE_KIND_LOCAL;
} else if (g_str_has_prefix (metadata_uri, "http://") ||
g_str_has_prefix (metadata_uri, "https://")) {
priv->kind = FWUPD_REMOTE_KIND_DOWNLOAD;
@@ -396,6 +412,7 @@
/* extract data */
priv->enabled = g_key_file_get_boolean (kf, group, "Enabled", NULL);
+ priv->approval_required = g_key_file_get_boolean (kf, group, "ApprovalRequired", NULL);
priv->title = g_key_file_get_string (kf, group, "Title", NULL);
/* reporting is optional */
@@ -441,14 +458,6 @@
fwupd_remote_set_filename_cache (self, filename_cache);
}
- /* all LOCAL remotes have to include a valid MetadataURI */
- if (priv->kind == FWUPD_REMOTE_KIND_LOCAL) {
- const gchar *filename_cache = metadata_uri;
- if (g_str_has_prefix (filename_cache, "file://"))
- filename_cache += 7;
- fwupd_remote_set_filename_cache (self, filename_cache);
- }
-
/* load the checksum */
if (priv->filename_cache_sig != NULL &&
g_file_test (priv->filename_cache_sig, G_FILE_TEST_EXISTS)) {
@@ -470,6 +479,25 @@
if (firmware_base_uri != NULL)
fwupd_remote_set_firmware_base_uri (self, firmware_base_uri);
+ /* some validation around DIRECTORY types */
+ if (priv->kind == FWUPD_REMOTE_KIND_DIRECTORY) {
+ if (priv->keyring_kind != FWUPD_KEYRING_KIND_NONE) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INVALID_FILE,
+ "Keyring kind %s is not supported with directory remote",
+ fwupd_keyring_kind_to_string (priv->keyring_kind));
+ return FALSE;
+ }
+ if (firmware_base_uri != NULL) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INVALID_FILE,
+ "Directory remotes don't support firmware base URI");
+ return FALSE;
+ }
+ }
+
/* dep logic */
order_before = g_key_file_get_string (kf, group, "OrderBefore", NULL);
if (order_before != NULL)
@@ -738,6 +766,24 @@
}
/**
+ * fwupd_remote_get_agreement:
+ * @self: A #FwupdRemote
+ *
+ * Gets the remote agreement in AppStream markup format
+ *
+ * Returns: a string, or %NULL if unset
+ *
+ * Since: 1.0.7
+ **/
+const gchar *
+fwupd_remote_get_agreement (FwupdRemote *self)
+{
+ FwupdRemotePrivate *priv = GET_PRIVATE (self);
+ g_return_val_if_fail (FWUPD_IS_REMOTE (self), NULL);
+ return priv->agreement;
+}
+
+/**
* fwupd_remote_get_checksum:
* @self: A #FwupdRemote
*
@@ -868,6 +914,25 @@
}
/**
+ * fwupd_remote_get_approval_required:
+ * @self: A #FwupdRemote
+ *
+ * Gets if firmware from the remote should be checked against the list
+ * of a approved checksums.
+ *
+ * Returns: a #TRUE if the remote is restricted
+ *
+ * Since: 1.2.6
+ **/
+gboolean
+fwupd_remote_get_approval_required (FwupdRemote *self)
+{
+ FwupdRemotePrivate *priv = GET_PRIVATE (self);
+ g_return_val_if_fail (FWUPD_IS_REMOTE (self), FALSE);
+ return priv->approval_required;
+}
+
+/**
* fwupd_remote_get_id:
* @self: A #FwupdRemote
*
@@ -920,10 +985,14 @@
fwupd_remote_set_password (self, g_variant_get_string (value, NULL));
} else if (g_strcmp0 (key, "Title") == 0) {
fwupd_remote_set_title (self, g_variant_get_string (value, NULL));
+ } else if (g_strcmp0 (key, "Agreement") == 0) {
+ fwupd_remote_set_agreement (self, g_variant_get_string (value, NULL));
} else if (g_strcmp0 (key, FWUPD_RESULT_KEY_CHECKSUM) == 0) {
fwupd_remote_set_checksum (self, g_variant_get_string (value, NULL));
} else if (g_strcmp0 (key, "Enabled") == 0) {
priv->enabled = g_variant_get_boolean (value);
+ } else if (g_strcmp0 (key, "ApprovalRequired") == 0) {
+ priv->approval_required = g_variant_get_boolean (value);
} else if (g_strcmp0 (key, "Priority") == 0) {
priv->priority = g_variant_get_int32 (value);
} else if (g_strcmp0 (key, "ModificationTime") == 0) {
@@ -953,7 +1022,7 @@
g_return_val_if_fail (FWUPD_IS_REMOTE (self), NULL);
/* create an array with all the metadata in */
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
if (priv->id != NULL) {
g_variant_builder_add (&builder, "{sv}", FWUPD_RESULT_KEY_REMOTE_ID,
g_variant_new_string (priv->id));
@@ -970,6 +1039,10 @@
g_variant_builder_add (&builder, "{sv}", "Title",
g_variant_new_string (priv->title));
}
+ if (priv->agreement != NULL) {
+ g_variant_builder_add (&builder, "{sv}", "Agreement",
+ g_variant_new_string (priv->agreement));
+ }
if (priv->checksum != NULL) {
g_variant_builder_add (&builder, "{sv}", FWUPD_RESULT_KEY_CHECKSUM,
g_variant_new_string (priv->checksum));
@@ -1012,6 +1085,8 @@
}
g_variant_builder_add (&builder, "{sv}", "Enabled",
g_variant_new_boolean (priv->enabled));
+ g_variant_builder_add (&builder, "{sv}", "ApprovalRequired",
+ g_variant_new_boolean (priv->approval_required));
return g_variant_new ("a{sv}", &builder);
}
@@ -1026,6 +1101,9 @@
case PROP_ENABLED:
g_value_set_boolean (value, priv->enabled);
break;
+ case PROP_APPROVAL_REQUIRED:
+ g_value_set_boolean (value, priv->approval_required);
+ break;
case PROP_ID:
g_value_set_string (value, priv->id);
break;
@@ -1046,6 +1124,9 @@
case PROP_ENABLED:
priv->enabled = g_value_get_boolean (value);
break;
+ case PROP_APPROVAL_REQUIRED:
+ priv->approval_required = g_value_get_boolean (value);
+ break;
case PROP_ID:
fwupd_remote_set_id (self, g_value_get_string (value));
break;
@@ -1072,7 +1153,7 @@
* Since: 0.9.3
*/
pspec = g_param_spec_string ("id", NULL, NULL,
- NULL, G_PARAM_READWRITE);
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_ID, pspec);
/**
@@ -1083,8 +1164,20 @@
* Since: 0.9.3
*/
pspec = g_param_spec_boolean ("enabled", NULL, NULL,
- FALSE, G_PARAM_READWRITE);
+ FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_NAME);
g_object_class_install_property (object_class, PROP_ENABLED, pspec);
+
+ /**
+ * FwupdRemote:approval-required:
+ *
+ * If firmware from the remote should be checked against the system
+ * list of approved firmware.
+ *
+ * Since: 1.2.6
+ */
+ pspec = g_param_spec_boolean ("approval-required", NULL, NULL,
+ FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_NAME);
+ g_object_class_install_property (object_class, PROP_APPROVAL_REQUIRED, pspec);
}
static void
@@ -1106,6 +1199,7 @@
g_free (priv->username);
g_free (priv->password);
g_free (priv->title);
+ g_free (priv->agreement);
g_free (priv->checksum);
g_free (priv->filename_cache);
g_free (priv->filename_cache_sig);
@@ -1118,30 +1212,30 @@
/**
* fwupd_remote_from_variant:
- * @data: a #GVariant
+ * @value: a #GVariant
*
* Creates a new remote using packed data.
*
- * Returns: (transfer full): a new #FwupdRemote, or %NULL if @data was invalid
+ * Returns: (transfer full): a new #FwupdRemote, or %NULL if @value was invalid
*
* Since: 1.0.0
**/
FwupdRemote *
-fwupd_remote_from_variant (GVariant *data)
+fwupd_remote_from_variant (GVariant *value)
{
FwupdRemote *rel = NULL;
const gchar *type_string;
g_autoptr(GVariantIter) iter = NULL;
- type_string = g_variant_get_type_string (data);
+ type_string = g_variant_get_type_string (value);
if (g_strcmp0 (type_string, "(a{sv})") == 0) {
rel = fwupd_remote_new ();
- g_variant_get (data, "(a{sv})", &iter);
+ g_variant_get (value, "(a{sv})", &iter);
fwupd_remote_set_from_variant_iter (rel, iter);
fwupd_remote_set_from_variant_iter (rel, iter);
} else if (g_strcmp0 (type_string, "a{sv}") == 0) {
rel = fwupd_remote_new ();
- g_variant_get (data, "a{sv}", &iter);
+ g_variant_get (value, "a{sv}", &iter);
fwupd_remote_set_from_variant_iter (rel, iter);
} else {
g_warning ("type %s not known", type_string);
@@ -1150,6 +1244,35 @@
}
/**
+ * fwupd_remote_array_from_variant:
+ * @value: a #GVariant
+ *
+ * Creates an array of new devices using packed data.
+ *
+ * Returns: (transfer container) (element-type FwupdRemote): remotes, or %NULL if @value was invalid
+ *
+ * Since: 1.2.10
+ **/
+GPtrArray *
+fwupd_remote_array_from_variant (GVariant *value)
+{
+ GPtrArray *remotes = NULL;
+ gsize sz;
+ g_autoptr(GVariant) untuple = NULL;
+
+ remotes = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ untuple = g_variant_get_child_value (value, 0);
+ sz = g_variant_n_children (untuple);
+ for (guint i = 0; i < sz; i++) {
+ g_autoptr(GVariant) data = g_variant_get_child_value (untuple, i);
+ FwupdRemote *remote = fwupd_remote_from_variant (data);
+ g_ptr_array_add (remotes, remote);
+ }
+
+ return remotes;
+}
+
+/**
* fwupd_remote_new:
*
* Creates a new fwupd remote.
diff -Nru fwupd-1.0.6/libfwupd/fwupd-remote.h fwupd-1.2.10/libfwupd/fwupd-remote.h
--- fwupd-1.0.6/libfwupd/fwupd-remote.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-remote.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017-2018 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_REMOTE_H
-#define __FWUPD_REMOTE_H
+#pragma once
#include "fwupd-enums.h"
@@ -42,10 +26,20 @@
void (*_fwupd_reserved7) (void);
};
+/**
+ * FwupdRemoteKind:
+ * @FWUPD_REMOTE_KIND_UNKNOWN: Unknown kind
+ * @FWUPD_REMOTE_KIND_DOWNLOAD: Requires files to be downloaded
+ * @FWUPD_REMOTE_KIND_LOCAL: Reads files from the local machine
+ * @FWUPD_REMOTE_KIND_DIRECTORY: Reads directory from the local machine
+ *
+ * The kind of remote.
+ **/
typedef enum {
FWUPD_REMOTE_KIND_UNKNOWN,
FWUPD_REMOTE_KIND_DOWNLOAD,
FWUPD_REMOTE_KIND_LOCAL,
+ FWUPD_REMOTE_KIND_DIRECTORY, /* Since: 1.2.4 */
/*< private >*/
FWUPD_REMOTE_KIND_LAST
} FwupdRemoteKind;
@@ -56,6 +50,7 @@
FwupdRemote *fwupd_remote_new (void);
const gchar *fwupd_remote_get_id (FwupdRemote *self);
const gchar *fwupd_remote_get_title (FwupdRemote *self);
+const gchar *fwupd_remote_get_agreement (FwupdRemote *self);
const gchar *fwupd_remote_get_checksum (FwupdRemote *self);
const gchar *fwupd_remote_get_username (FwupdRemote *self);
const gchar *fwupd_remote_get_password (FwupdRemote *self);
@@ -67,6 +62,7 @@
const gchar *fwupd_remote_get_metadata_uri (FwupdRemote *self);
const gchar *fwupd_remote_get_metadata_uri_sig (FwupdRemote *self);
gboolean fwupd_remote_get_enabled (FwupdRemote *self);
+gboolean fwupd_remote_get_approval_required (FwupdRemote *self);
gint fwupd_remote_get_priority (FwupdRemote *self);
guint64 fwupd_remote_get_age (FwupdRemote *self);
FwupdRemoteKind fwupd_remote_get_kind (FwupdRemote *self);
@@ -75,7 +71,7 @@
const gchar *url,
GError **error);
-G_END_DECLS
-
-#endif /* __FWUPD_REMOTE_H */
+FwupdRemote *fwupd_remote_from_variant (GVariant *value);
+GPtrArray *fwupd_remote_array_from_variant (GVariant *value);
+G_END_DECLS
diff -Nru fwupd-1.0.6/libfwupd/fwupd-remote-private.h fwupd-1.2.10/libfwupd/fwupd-remote-private.h
--- fwupd-1.0.6/libfwupd/fwupd-remote-private.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-remote-private.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,32 +1,15 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FWUPD_REMOTE_PRIVATE_H
-#define __FWUPD_REMOTE_PRIVATE_H
+#pragma once
#include "fwupd-remote.h"
G_BEGIN_DECLS
-FwupdRemote *fwupd_remote_from_variant (GVariant *data);
GVariant *fwupd_remote_to_variant (FwupdRemote *self);
gboolean fwupd_remote_load_from_filename (FwupdRemote *self,
const gchar *filename,
@@ -34,12 +17,11 @@
GError **error);
void fwupd_remote_set_priority (FwupdRemote *self,
gint priority);
+void fwupd_remote_set_agreement (FwupdRemote *self,
+ const gchar *agreement);
void fwupd_remote_set_mtime (FwupdRemote *self,
guint64 mtime);
gchar **fwupd_remote_get_order_after (FwupdRemote *self);
gchar **fwupd_remote_get_order_before (FwupdRemote *self);
G_END_DECLS
-
-#endif /* __FWUPD_REMOTE_PRIVATE_H */
-
diff -Nru fwupd-1.0.6/libfwupd/fwupd-self-test.c fwupd-1.2.10/libfwupd/fwupd-self-test.c
--- fwupd-1.0.6/libfwupd/fwupd-self-test.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-self-test.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,34 +1,19 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include
#include
-#include
#include "fwupd-client.h"
#include "fwupd-common.h"
#include "fwupd-enums.h"
#include "fwupd-error.h"
+#include "fwupd-device-private.h"
#include "fwupd-release-private.h"
#include "fwupd-remote-private.h"
@@ -59,6 +44,60 @@
return FALSE;
}
+/* https://gitlab.gnome.org/GNOME/glib/issues/225 */
+static guint
+_g_string_replace (GString *string, const gchar *search, const gchar *replace)
+{
+ gchar *tmp;
+ guint count = 0;
+ gsize search_idx = 0;
+ gsize replace_len;
+ gsize search_len;
+
+ g_return_val_if_fail (string != NULL, 0);
+ g_return_val_if_fail (search != NULL, 0);
+ g_return_val_if_fail (replace != NULL, 0);
+
+ /* nothing to do */
+ if (string->len == 0)
+ return 0;
+
+ search_len = strlen (search);
+ replace_len = strlen (replace);
+
+ do {
+ tmp = g_strstr_len (string->str + search_idx, -1, search);
+ if (tmp == NULL)
+ break;
+
+ /* advance the counter in case @replace contains @search */
+ search_idx = (gsize) (tmp - string->str);
+
+ /* reallocate the string if required */
+ if (search_len > replace_len) {
+ g_string_erase (string,
+ (gssize) search_idx,
+ (gssize) (search_len - replace_len));
+ memcpy (tmp, replace, replace_len);
+ } else if (search_len < replace_len) {
+ g_string_insert_len (string,
+ (gssize) search_idx,
+ replace,
+ (gssize) (replace_len - search_len));
+ /* we have to treat this specially as it could have
+ * been reallocated when the insertion happened */
+ memcpy (string->str + search_idx, replace, replace_len);
+ } else {
+ /* just memcmp in the new string */
+ memcpy (tmp, replace, replace_len);
+ }
+ search_idx += replace_len;
+ count++;
+ } while (TRUE);
+
+ return count;
+}
+
static void
fwupd_enums_func (void)
{
@@ -83,6 +122,11 @@
g_assert_cmpstr (tmp, !=, NULL);
g_assert_cmpint (fwupd_trust_flag_from_string (tmp), ==, i);
}
+ for (guint i = 1; i < FWUPD_VERSION_FORMAT_LAST; i++) {
+ const gchar *tmp = fwupd_version_format_to_string (i);
+ g_assert_cmpstr (tmp, !=, NULL);
+ g_assert_cmpint (fwupd_version_format_from_string (tmp), ==, i);
+ }
/* bitfield */
for (guint64 i = 1; i < FWUPD_DEVICE_FLAG_UNKNOWN; i *= 2) {
@@ -187,7 +231,7 @@
g_autoptr(GError) error = NULL;
remote = fwupd_remote_new ();
- fn = g_build_filename (FU_SELF_TEST_REMOTES_DIR, "remotes.d", "fwupd.conf", NULL);
+ fn = g_build_filename (FU_LOCAL_REMOTE_DIR, "dell-esrt.conf", NULL);
ret = fwupd_remote_load_from_filename (remote, fn, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
@@ -197,8 +241,8 @@
g_assert (fwupd_remote_get_metadata_uri (remote) == NULL);
g_assert (fwupd_remote_get_metadata_uri_sig (remote) == NULL);
g_assert (fwupd_remote_get_report_uri (remote) == NULL);
- g_assert_cmpstr (fwupd_remote_get_title (remote), ==, "Core");
- g_assert_cmpstr (fwupd_remote_get_filename_cache (remote), ==, "@datadir@/fwupd/remotes.d/fwupd/metadata.xml");
+ g_assert_cmpstr (fwupd_remote_get_title (remote), ==, "Enable UEFI capsule updates on Dell systems");
+ g_assert_cmpstr (fwupd_remote_get_filename_cache (remote), ==, "@datadir@/fwupd/remotes.d/dell-esrt/metadata.xml");
g_assert_cmpstr (fwupd_remote_get_filename_cache_sig (remote), ==, NULL);
g_assert_cmpstr (fwupd_remote_get_checksum (remote), ==, NULL);
}
@@ -223,10 +267,15 @@
fwupd_device_func (void)
{
gboolean ret;
+ g_autofree gchar *data = NULL;
g_autofree gchar *str = NULL;
g_autoptr(FwupdDevice) dev = NULL;
g_autoptr(FwupdRelease) rel = NULL;
g_autoptr(GError) error = NULL;
+ g_autoptr(GString) str_ascii = NULL;
+ g_autoptr(JsonBuilder) builder = NULL;
+ g_autoptr(JsonGenerator) json_generator = NULL;
+ g_autoptr(JsonNode) json_root = NULL;
/* create dummy object */
dev = fwupd_device_new ();
@@ -242,7 +291,7 @@
fwupd_device_add_icon (dev, "input-mouse");
fwupd_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
rel = fwupd_release_new ();
- fwupd_release_set_trust_flags (rel, FWUPD_TRUST_FLAG_PAYLOAD);
+ fwupd_release_add_flag (rel, FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD);
fwupd_release_add_checksum (rel, "deadbeef");
fwupd_release_set_description (rel, "
\",\n"
+ " \"Version\" : \"1.2.3\",\n"
+ " \"Filename\" : \"firmware.bin\",\n"
+ " \"Checksum\" : [\n"
+ " \"deadbeef\"\n"
+ " ],\n"
+ " \"Size\" : 1024,\n"
+ " \"Uri\" : \"http://foo.com\",\n"
+ " \"Flags\" : [\n"
+ " \"trusted-payload\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}", &error);
g_assert_no_error (error);
g_assert (ret);
}
@@ -302,7 +407,7 @@
g_test_skip ("no enabled fwupd daemon");
return;
}
- if (as_utils_vercmp (fwupd_client_get_daemon_version (client), "1.0.0") < 0) {
+ if (!g_str_has_prefix (fwupd_client_get_daemon_version (client), "1.")) {
g_test_skip ("running fwupd is too old");
return;
}
@@ -351,7 +456,7 @@
g_test_skip ("no enabled fwupd daemon");
return;
}
- if (as_utils_vercmp (fwupd_client_get_daemon_version (client), "1.0.0") < 0) {
+ if (!g_str_has_prefix (fwupd_client_get_daemon_version (client), "1.")) {
g_test_skip ("running fwupd is too old");
return;
}
@@ -417,6 +522,58 @@
g_assert_cmpstr (mhash2, !=, mhash1);
}
+static void
+fwupd_common_guid_func (void)
+{
+ g_autofree gchar *guid1 = NULL;
+ g_autofree gchar *guid2 = NULL;
+ g_autofree gchar *guid_be = NULL;
+ g_autofree gchar *guid_me = NULL;
+ fwupd_guid_t buf = { 0x0 };
+ gboolean ret;
+ g_autoptr(GError) error = NULL;
+
+ /* invalid */
+ g_assert (!fwupd_guid_is_valid (NULL));
+ g_assert (!fwupd_guid_is_valid (""));
+ g_assert (!fwupd_guid_is_valid ("1ff60ab2-3905-06a1-b476"));
+ g_assert (!fwupd_guid_is_valid ("1ff60ab2-XXXX-XXXX-XXXX-0371f00c9e9b"));
+ g_assert (!fwupd_guid_is_valid (" 1ff60ab2-3905-06a1-b476-0371f00c9e9b"));
+ g_assert (!fwupd_guid_is_valid ("00000000-0000-0000-0000-000000000000"));
+
+ /* valid */
+ g_assert (fwupd_guid_is_valid ("1ff60ab2-3905-06a1-b476-0371f00c9e9b"));
+
+ /* make valid */
+ guid1 = fwupd_guid_hash_string ("python.org");
+ g_assert_cmpstr (guid1, ==, "886313e1-3b8a-5372-9b90-0c9aee199e5d");
+
+ guid2 = fwupd_guid_hash_string ("8086:0406");
+ g_assert_cmpstr (guid2, ==, "1fbd1f2c-80f4-5d7c-a6ad-35c7b9bd5486");
+
+ /* round-trip BE */
+ ret = fwupd_guid_from_string ("00112233-4455-6677-8899-aabbccddeeff", &buf,
+ FWUPD_GUID_FLAG_NONE, &error);
+ g_assert_true (ret);
+ g_assert_no_error (error);
+ g_assert (memcmp (buf, "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff", sizeof(buf)) == 0);
+ guid_be = fwupd_guid_to_string ((const fwupd_guid_t *) &buf, FWUPD_GUID_FLAG_NONE);
+ g_assert_cmpstr (guid_be, ==, "00112233-4455-6677-8899-aabbccddeeff");
+
+ /* round-trip mixed encoding */
+ ret = fwupd_guid_from_string ("00112233-4455-6677-8899-aabbccddeeff", &buf,
+ FWUPD_GUID_FLAG_MIXED_ENDIAN, &error);
+ g_assert_true (ret);
+ g_assert_no_error (error);
+ g_assert (memcmp (buf, "\x33\x22\x11\x00\x55\x44\x77\x66\x88\x99\xaa\xbb\xcc\xdd\xee\xff", sizeof(buf)) == 0);
+ guid_me = fwupd_guid_to_string ((const fwupd_guid_t *) &buf, FWUPD_GUID_FLAG_MIXED_ENDIAN);
+ g_assert_cmpstr (guid_me, ==, "00112233-4455-6677-8899-aabbccddeeff");
+
+ /* check failure */
+ g_assert_false (fwupd_guid_from_string ("001122334455-6677-8899-aabbccddeeff", NULL, 0, NULL));
+ g_assert_false (fwupd_guid_from_string ("0112233-4455-6677-8899-aabbccddeeff", NULL, 0, NULL));
+}
+
int
main (int argc, char **argv)
{
@@ -429,6 +586,7 @@
/* tests go here */
g_test_add_func ("/fwupd/enums", fwupd_enums_func);
g_test_add_func ("/fwupd/common{machine-hash}", fwupd_common_machine_hash_func);
+ g_test_add_func ("/fwupd/common{guid}", fwupd_common_guid_func);
g_test_add_func ("/fwupd/release", fwupd_release_func);
g_test_add_func ("/fwupd/device", fwupd_device_func);
g_test_add_func ("/fwupd/remote{download}", fwupd_remote_download_func);
diff -Nru fwupd-1.0.6/libfwupd/fwupd-version.h.in fwupd-1.2.10/libfwupd/fwupd-version.h.in
--- fwupd-1.0.6/libfwupd/fwupd-version.h.in 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/fwupd-version.h.in 2019-07-15 18:25:54.000000000 +0000
@@ -1,24 +1,11 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
+#pragma once
+
/**
* SECTION:fwupd-version
* @short_description: Obtains the version for the installed fwupd
@@ -31,9 +18,6 @@
#error "Only can be included directly."
#endif
-#ifndef __FWUPD_VERSION_H
-#define __FWUPD_VERSION_H
-
/**
* FWUPD_MAJOR_VERSION:
*
@@ -75,5 +59,3 @@
(FWUPD_MAJOR_VERSION == (major) && FWUPD_MINOR_VERSION > (minor)) || \
(FWUPD_MAJOR_VERSION == (major) && FWUPD_MINOR_VERSION == (minor) && \
FWUPD_MICRO_VERSION >= (micro)))
-
-#endif /* __FWUPD_VERSION_H */
diff -Nru fwupd-1.0.6/libfwupd/generate-version-script.py fwupd-1.2.10/libfwupd/generate-version-script.py
--- fwupd-1.0.6/libfwupd/generate-version-script.py 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/generate-version-script.py 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,15 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
# pylint: disable=invalid-name,missing-docstring
#
# Copyright (C) 2017 Richard Hughes
#
-# Licensed under the GNU General Public License Version 2
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see .
+# SPDX-License-Identifier: LGPL-2.1+
import sys
import xml.etree.ElementTree as ET
+from pkg_resources import parse_version
+
XMLNS = '{http://www.gtk.org/introspection/core/1.0}'
XMLNS_C = '{http://www.gtk.org/introspection/c/1.0}'
@@ -45,7 +34,6 @@
if 'version' not in node.attrib:
print('No version for', identifier)
sys.exit(1)
- return
version = node.attrib['version']
if version not in self.releases:
self.releases[version] = []
@@ -53,36 +41,43 @@
release.append(identifier)
return version
+ def _add_cls(self, cls):
+
+ # add all class functions
+ for node in cls.findall(XMLNS + 'function'):
+ self._add_node(node)
+
+ # add the constructor
+ for node in cls.findall(XMLNS + 'constructor'):
+ self._add_node(node)
+
+ # choose the lowest version method for the _get_type symbol
+ version_lowest = None
+ if '{http://www.gtk.org/introspection/glib/1.0}get-type' not in cls.attrib:
+ return
+ type_name = cls.attrib['{http://www.gtk.org/introspection/glib/1.0}get-type']
+
+ # add all class methods
+ for node in cls.findall(XMLNS + 'method'):
+ version_tmp = self._add_node(node)
+ if version_tmp:
+ if not version_lowest or version_tmp < version_lowest:
+ version_lowest = version_tmp
+
+ # finally add the get_type symbol
+ if version_lowest:
+ self.releases[version_lowest].append(type_name)
+
def import_gir(self, filename):
tree = ET.parse(filename)
root = tree.getroot()
for ns in root.findall(XMLNS + 'namespace'):
for node in ns.findall(XMLNS + 'function'):
self._add_node(node)
+ for cls in ns.findall(XMLNS + 'record'):
+ self._add_cls(cls)
for cls in ns.findall(XMLNS + 'class'):
-
- # add all class functions
- for node in cls.findall(XMLNS + 'function'):
- self._add_node(node)
-
- # add the constructor
- for node in cls.findall(XMLNS + 'constructor'):
- self._add_node(node)
-
- # choose the lowest version method for the _get_type symbol
- version_lowest = None
- type_name = cls.attrib['{http://www.gtk.org/introspection/glib/1.0}get-type']
-
- # add all class methods
- for node in cls.findall(XMLNS + 'method'):
- version_tmp = self._add_node(node)
- if version_tmp:
- if not version_lowest or version_tmp < version_lowest:
- version_lowest = version_tmp
-
- # finally add the get_type symbol
- if version_lowest:
- self.releases[version_lowest].append(type_name)
+ self._add_cls(cls)
def render(self):
@@ -94,7 +89,7 @@
# output the version data to a file
verout = '# generated automatically, do not edit!\n'
oldversion = None
- for version in sorted(versions):
+ for version in sorted(versions, key=parse_version):
symbols = sorted(self.releases[version])
verout += '\n%s_%s {\n' % (self.library_name, version)
verout += ' global:\n'
diff -Nru fwupd-1.0.6/libfwupd/meson.build fwupd-1.2.10/libfwupd/meson.build
--- fwupd-1.0.6/libfwupd/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/libfwupd/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -96,7 +96,7 @@
symbol_prefix : 'fwupd',
identifier_prefix : 'Fwupd',
export_packages : 'fwupd',
- extra_args : '--c-include=fwupd.h', # This can be replaced with header : 'fwupd.h' once can depend on Meson 0.43.0
+ header : 'fwupd.h',
dependencies : [
giounix,
soup,
@@ -122,7 +122,7 @@
# 2. The map file is required to build the lib that the GIR is built from
#
# To avoid the circular dep, and to ensure we don't change exported API
- # accidentaly actually check in a version of the version script to git.
+ # accidentally actually check in a version of the version script to git.
mapfile_target = custom_target('mapfile',
input: gir[0],
output: 'fwupd.map',
@@ -145,6 +145,7 @@
if get_option('tests')
testdatadir = join_paths(meson.source_root(), 'data')
+ localremotetestdir = join_paths(meson.source_root(), 'plugins', 'dell-esrt')
e = executable(
'fwupd-self-test',
sources : [
@@ -154,9 +155,9 @@
include_directories('..'),
],
dependencies : [
- appstream_glib,
gio,
soup,
+ libjsonglib,
],
link_with : fwupd,
c_args : [
@@ -164,6 +165,7 @@
'-DLOCALSTATEDIR="' + localstatedir + '"',
'-DTESTDATADIR="' + testdatadir + '"',
'-DFU_SELF_TEST_REMOTES_DIR="' + testdatadir + '"',
+ '-DFU_LOCAL_REMOTE_DIR="' + localremotetestdir + '"',
],
)
test('fwupd-self-test', e)
diff -Nru fwupd-1.0.6/meson.build fwupd-1.2.10/meson.build
--- fwupd-1.0.6/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,7 +1,7 @@
project('fwupd', 'c',
- version : '1.0.6',
+ version : '1.2.10',
license : 'LGPL-2.1+',
- meson_version : '>=0.37.0',
+ meson_version : '>=0.47.0',
default_options : ['warning_level=2', 'c_std=c99'],
)
@@ -48,8 +48,8 @@
lt_age = '0'
lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
-# get suported warning flags
-test_args = [
+# get supported warning flags
+warning_flags = [
'-fstack-protector-strong',
'-Waggregate-return',
'-Wunused',
@@ -76,7 +76,9 @@
'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
- '-Wno-error=cpp',
+ '-Wno-cast-function-type',
+ '-Wno-address-of-packed-member', # incompatible with g_autoptr()
+ '-Wno-unknown-pragmas',
'-Wno-discarded-qualifiers',
'-Wno-missing-field-initializers',
'-Wno-strict-aliasing',
@@ -98,24 +100,22 @@
'-Wuninitialized',
'-Wunused-but-set-variable',
'-Wunused-variable',
+ '-Wvla',
'-Wwrite-strings'
]
cc = meson.get_compiler('c')
-foreach arg: test_args
- if cc.has_argument(arg)
- add_project_arguments(arg, language : 'c')
- endif
-endforeach
+add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c')
# enable full RELRO where possible
# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
global_link_args = []
test_link_args = [
'-Wl,-z,relro',
+ '-Wl,-z,defs',
'-Wl,-z,now',
]
foreach arg: test_link_args
- if cc.has_argument(arg)
+ if cc.has_link_argument(arg)
global_link_args += arg
endif
endforeach
@@ -130,30 +130,55 @@
# do not use deprecated symbols or defines internally
add_project_arguments('-DFWUPD_DISABLE_DEPRECATED', language : 'c')
+# needed for symlink() and BYTE_ORDER
+add_project_arguments('-D_BSD_SOURCE', language : 'c')
+add_project_arguments('-D_XOPEN_SOURCE=700', language : 'c')
+
+prefix = get_option('prefix')
+
+bindir = join_paths(prefix, get_option('bindir'))
+libdir = join_paths(prefix, get_option('libdir'))
+datadir = join_paths(prefix, get_option('datadir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+sysconfdir = join_paths(prefix, get_option('sysconfdir'))
+localstatedir = join_paths(prefix, get_option('localstatedir'))
+mandir = join_paths(prefix, get_option('mandir'))
+localedir = join_paths(prefix, get_option('localedir'))
+
gio = dependency('gio-2.0', version : '>= 2.45.8')
+if gio.version().version_compare ('>= 2.55.0')
+ conf.set('HAVE_GIO_2_55_0', '1')
+endif
gmodule = dependency('gmodule-2.0')
giounix = dependency('gio-unix-2.0', version : '>= 2.45.8')
-polkit = dependency('polkit-gobject-1', version : '>= 0.103')
-if polkit.version().version_compare('>= 0.114')
- conf.set('HAVE_POLKIT_0_114', '1')
-endif
gudev = dependency('gudev-1.0')
if gudev.version().version_compare('>= 232')
conf.set('HAVE_GUDEV_232', '1')
endif
-appstream_glib = dependency('appstream-glib', version : '>= 0.6.13')
+libxmlb = dependency('xmlb', version : '>= 0.1.7', fallback : ['libxmlb', 'libxmlb_dep'])
gusb = dependency('gusb', version : '>= 0.2.9')
sqlite = dependency('sqlite3')
libarchive = dependency('libarchive')
libjsonglib = dependency('json-glib-1.0', version : '>= 1.1.1')
-if meson.version().version_compare('>0.41.0')
- valgrind = dependency('valgrind', required: false)
-else
- valgrind = dependency('valgrindXXX', required: false)
-endif
+valgrind = dependency('valgrind', required: false)
soup = dependency('libsoup-2.4', version : '>= 2.51.92')
+if get_option('daemon')
+ polkit = dependency('polkit-gobject-1', version : '>= 0.103')
+ if polkit.version().version_compare('>= 0.114')
+ conf.set('HAVE_POLKIT_0_114', '1')
+ endif
+ conf.set_quoted ('POLKIT_ACTIONDIR', polkit.get_pkgconfig_variable('actiondir'))
+ udevdir = get_option('udevdir')
+ if udevdir == ''
+ udev = dependency('udev')
+ udevdir = udev.get_pkgconfig_variable('udevdir')
+ endif
+endif
if get_option('pkcs7')
- gnutls = dependency('gnutls')
+ gnutls = dependency('gnutls', version : '>= 3.4.4.1')
+ if gnutls.version().version_compare('>= 3.6.0')
+ conf.set('HAVE_GNUTLS_3_6_0', '1')
+ endif
conf.set('ENABLE_PKCS7', '1')
endif
if get_option('gpg')
@@ -162,8 +187,6 @@
conf.set('ENABLE_GPG', '1')
endif
libm = cc.find_library('m', required: false)
-udev = dependency('udev')
-uuid = dependency('uuid')
libgcab = dependency('libgcab-1.0')
if libgcab.version().version_compare('>= 0.8')
conf.set('HAVE_GCAB_0_8', '1')
@@ -171,24 +194,16 @@
if libgcab.version().version_compare('>= 1.0')
conf.set('HAVE_GCAB_1_0', '1')
endif
-
-if get_option('plugin_uefi_labels')
- cairo = dependency('cairo')
- fontconfig = cc.find_library('fontconfig')
- freetype = cc.find_library('freetype')
- r = run_command('po/test-deps')
- if r.returncode() != 0
- error(r.stdout())
- endif
-endif
+gcab = find_program('gcab', required : true)
+bashcomp = dependency('bash-completion', required: false)
+python3 = find_program('python3')
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')
+if get_option('plugin_redfish')
+ efivar = dependency('efivar')
endif
if get_option('plugin_altos')
@@ -196,24 +211,62 @@
endif
if get_option('plugin_uefi')
- fwup = dependency('fwup', version : '>= 5')
- if fwup.version().version_compare('>= 11')
- conf.set('HAVE_FWUP_GET_ESP_MOUNTPOINT', '1')
+ cairo = dependency('cairo')
+ fontconfig = cc.find_library('fontconfig')
+ freetype = cc.find_library('freetype')
+ efivar = dependency('efivar', version : '>= 33')
+ conf.set_quoted('EFIVAR_LIBRARY_VERSION', efivar.version())
+ efiboot = dependency('efiboot')
+ objcopy = find_program ('objcopy')
+ readelf = find_program ('readelf')
+
+ efi_app_location = join_paths(libexecdir, 'fwupd', 'efi')
+ conf.set_quoted ('EFI_APP_LOCATION', efi_app_location)
+
+ efi_arch = host_machine.cpu_family()
+ if efi_arch == 'x86'
+ EFI_MACHINE_TYPE_NAME = 'ia32'
+ gnu_efi_arch = 'ia32'
+ elif efi_arch == 'x86_64'
+ EFI_MACHINE_TYPE_NAME = 'x64'
+ gnu_efi_arch = 'x86_64'
+ elif efi_arch == 'arm'
+ EFI_MACHINE_TYPE_NAME = 'arm'
+ gnu_efi_arch = 'arm'
+ elif efi_arch == 'aarch64'
+ EFI_MACHINE_TYPE_NAME = 'aa64'
+ gnu_efi_arch = 'aarch64'
+ else
+ EFI_MACHINE_TYPE_NAME = ''
+ gnu_efi_arch = ''
endif
- if fwup.version().version_compare('>= 10')
- conf.set('HAVE_FWUP_GET_BGRT_INFO', '1')
- conf.set('HAVE_FWUP_CUSTOM_ESP', '1')
+ conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
+ r = run_command([python3, 'po/test-deps'])
+ if r.returncode() != 0
+ error(r.stderr())
endif
- efivar = dependency('efivar')
- conf.set_quoted('EFIVAR_LIBRARY_VERSION', efivar.version())
- conf.set_quoted('LIBFWUP_LIBRARY_VERSION', fwup.version())
endif
if get_option('plugin_dell')
- libsmbios_c = dependency('libsmbios_c', version : '>= 2.3.0')
+ libsmbios_c = dependency('libsmbios_c', version : '>= 2.4.0')
efivar = dependency('efivar')
- fwup = dependency('fwup', version : '>= 5')
conf.set('HAVE_DELL', '1')
+ if not get_option('plugin_uefi')
+ error('plugin_dell also needs plugin_uefi to work')
+ endif
+endif
+
+if get_option('plugin_modem_manager')
+ libmm_glib = dependency('mm-glib', version : '>= 1.10.0')
+ add_project_arguments('-DMM_REQUIRED_VERSION="1.10.0"', language : 'c')
+ libqmi_glib = dependency('qmi-glib', version : '>= 1.22.0')
+ add_project_arguments('-DQMI_REQUIRED_VERSION="1.23.1"', language : 'c')
+endif
+
+if get_option('plugin_nvme')
+ if not cc.has_header('linux/nvme_ioctl.h')
+ error('NVMe support requires kernel >= 4.4')
+ endif
endif
if get_option('plugin_synaptics')
@@ -225,36 +278,30 @@
conf.set('HAVE_THUNDERBOLT', '1')
endif
+if get_option('plugin_flashrom')
+ libflashrom = dependency('flashrom', fallback : ['flashrom', 'flashrom_dep'])
+endif
+
if get_option('systemd')
- systemd = dependency('systemd', version : '>= 231')
+ systemd = dependency('systemd', version : '>= 211')
conf.set('HAVE_SYSTEMD' , '1')
+ conf.set('HAVE_LOGIND' , '1')
+endif
+
+if get_option('elogind')
+ elogind = dependency('libelogind', version : '>= 211')
+ conf.set('HAVE_LOGIND' , '1')
endif
if get_option('consolekit')
conf.set('HAVE_CONSOLEKIT' , '1')
endif
-prefix = get_option('prefix')
-
-bindir = join_paths(prefix, get_option('bindir'))
-libdir = join_paths(prefix, get_option('libdir'))
-datadir = join_paths(prefix, get_option('datadir'))
-libexecdir = join_paths(prefix, get_option('libexecdir'))
-sysconfdir = join_paths(prefix, get_option('sysconfdir'))
-localstatedir = join_paths(prefix, get_option('localstatedir'))
-mandir = join_paths(prefix, get_option('mandir'))
-localedir = join_paths(prefix, get_option('localedir'))
-
systemdunitdir = get_option('systemdunitdir')
if systemdunitdir == '' and get_option('systemd')
systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
endif
-udevdir = get_option('udevdir')
-if udevdir == ''
- udevdir = udev.get_pkgconfig_variable('udevdir')
-endif
-
gnome = import('gnome')
i18n = import('i18n')
@@ -262,6 +309,10 @@
conf.set_quoted('BINDIR', bindir)
conf.set_quoted('LIBEXECDIR', libexecdir)
+conf.set_quoted('DATADIR', datadir)
+conf.set_quoted('LOCALSTATEDIR', localstatedir)
+conf.set_quoted('SYSCONFDIR', sysconfdir)
+conf.set_quoted('PLUGINDIR', plugin_dir)
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
@@ -272,48 +323,30 @@
configuration : conf
)
-default_sysconfdir = get_option('sysconfdir')
-if default_sysconfdir == 'etc'
- message('sysconfdir of etc makes no sense, using /etc')
- default_sysconfdir = '/etc'
-endif
-
plugin_deps = []
-plugin_deps += appstream_glib
+plugin_deps += libxmlb
plugin_deps += gio
plugin_deps += giounix
plugin_deps += gmodule
plugin_deps += gusb
plugin_deps += soup
plugin_deps += libarchive
+plugin_deps += gudev
subdir('data')
-subdir('docs')
+if get_option('gtkdoc')
+ gtkdocscan = find_program('gtkdoc-scan', required : true)
+ subdir('docs')
+endif
subdir('libfwupd')
subdir('po')
-subdir('policy')
+if get_option('daemon')
+ subdir('policy')
+endif
subdir('src')
subdir('plugins')
subdir('contrib')
-if meson.version().version_compare('<0.41.0')
- if archiver.found()
- run_target('dist',
- # git config tar.tar.xz.command "xz -c"
- command: [
- 'git', 'archive',
- '--prefix=' + meson.project_name() + '-' + meson.project_version() + '/',
- 'HEAD',
- '--format=tar.xz',
- '--output',
- meson.project_name() + '-' + meson.project_version() + '.tar.xz'
- ]
- )
- else
- message('git not found, you will not be able to run `ninja dist`')
- endif
-endif
-
-if get_option('systemd')
+if get_option('systemd') and get_option('daemon')
meson.add_install_script('meson_post_install.sh', systemdunitdir, localstatedir)
endif
diff -Nru fwupd-1.0.6/meson_options.txt fwupd-1.2.10/meson_options.txt
--- fwupd-1.0.6/meson_options.txt 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/meson_options.txt 2019-07-15 18:25:54.000000000 +0000
@@ -1,5 +1,7 @@
-option('bootdir', type : 'string', value : '/boot/efi', description : 'Directory for EFI system partition')
+option('daemon', type : 'boolean', value : true, description : 'enable the fwupd daemon')
+option('agent', type : 'boolean', value : true, description : 'enable the fwupd agent')
option('consolekit', type : 'boolean', value : true, description : 'enable ConsoleKit support')
+option('firmware-packager', type : 'boolean', value : true, description : 'enable firmware-packager installation')
option('gpg', type : 'boolean', value : true, description : 'enable the GPG verification support')
option('gtkdoc', type : 'boolean', value : true, description : 'enable developer documentation')
option('introspection', type : 'boolean', value : true, description : 'generate GObject Introspection data')
@@ -8,14 +10,23 @@
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')
option('plugin_thunderbolt', type : 'boolean', value : true, description : 'enable Thunderbolt support')
-option('plugin_uefi_labels', type : 'boolean', value : true, description : 'enable UEFI labels support')
+option('plugin_redfish', type : 'boolean', value : true, description : 'enable Redfish support')
option('plugin_uefi', type : 'boolean', value : true, description : 'enable UEFI support')
+option('plugin_nvme', type : 'boolean', value : true, description : 'enable NVMe support')
+option('plugin_modem_manager', type : 'boolean', value : false, description : 'enable ModemManager support')
+option('plugin_flashrom', type : 'boolean', value : false, description : 'enable libflashrom support')
option('systemd', type : 'boolean', value : true, description : 'enable systemd support')
option('systemdunitdir', type: 'string', value: '', description: 'Directory for systemd units')
+option('elogind', type : 'boolean', value : false, description : 'enable elogind support')
option('tests', type : 'boolean', value : true, description : 'enable tests')
option('udevdir', type: 'string', value: '', description: 'Directory for udev rules')
+option('efi-cc', type : 'string', value : 'gcc', description : 'the compiler to use for EFI modules')
+option('efi-ld', type : 'string', value : 'ld', description : 'the linker to use for EFI modules')
+option('efi-libdir', type : 'string', description : 'path to the EFI lib directory')
+option('efi-ldsdir', type : 'string', description : 'path to the EFI lds directory')
+option('efi-includedir', type : 'string', value : '/usr/include/efi', description : 'path to the EFI header directory')
+option('efi_os_dir', type: 'string', description : 'the name of OS directory in ESP')
diff -Nru fwupd-1.0.6/NEWS fwupd-1.2.10/NEWS
--- fwupd-1.0.6/NEWS 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/NEWS 1970-01-01 00:00:00.000000000 +0000
@@ -1,719 +0,0 @@
-Version 1.0.6
-~~~~~~~~~~~~~
-Released: 2018-03-12
-
-New Features:
- - Add bash completion for fwupdmgr (Mario Limonciello)
- - Add support for newest Thunderbolt chips (Andrei Emeltchenko)
- - Allow all functions that take device arguments to be prompted (Mario Limonciello)
- - Allow devices to use the runtime version when in bootloader mode (Richard Hughes)
- - Allow overriding ESP mount point via conf file (Mario Limonciello)
- - Delete any old fwupdate capsules and efivars when launching fwupd (Richard Hughes)
- - Generate Vala bindings (Robert Ancell)
-
-Bugfixes:
- - Allow ctrl-d out of the prompt for devices (Mario Limonciello)
- - Allow to create package out of provided binary (Andrei Emeltchenko)
- - Correct handling of unknown Thunderbolt devices (Yehezkel Bernat)
- - Correctly detect new remotes that are manually copied (Richard Hughes)
- - Fix a crash related to when passing device to downgrade in CLI (Mario Limonciello)
- - Fix running the self tests when no fwupd is installed (Richard Hughes)
- - Fix Unifying signature writing and parsing for Texas bootloader (Ogier Bouvier)
- - Only send success and failure reports to the server (Richard Hughes)
- - Use a CNAME to redirect to the correct CDN for metadata (Richard Hughes)
- - Use a longer timeout when powering back the Thunderbolt device (Richard Hughes)
-
-Version 1.0.5
-~~~~~~~~~~~~~
-Released: 2018-02-14
-
-New Features:
- - Offer to reboot when processing an offline update (Richard Hughes)
- - Report the efivar, libsmbios and fwupdate library versions (Mario Limonciello)
- - Report Thunderbolt safe mode and SecureBoot status (Mario Limonciello)
- - Show the user a URL when they report a known problem (Richard Hughes)
- - Support split cabinet archives as produced by Windows Update (Richard Hughes)
-
-Bugfixes:
- - Be more careful deleting and modifying device history (Richard Hughes)
- - Clarify which devices don't have upgrades (Mario Limonciello)
- - Ensure the Thunderbolt version is xx.yy (Richard Hughes)
- - Fix a daemon warning when using fwupdmgr get-results (Richard Hughes)
- - Fix crasher with MST flashing (Mario Limonciello)
- - Fix DFU detach with newer releases of libusb (Richard Hughes)
- - Include the device VID and PID when generating the device-id (Richard Hughes)
- - Set the RemoteId when using GetDetails (Richard Hughes)
- - Stop matching 8bitdo DS4 controller VID/PID (Mario Limonciello)
- - Use help2man for dfu-tool and drop docbook dependencies (Mario Limonciello)
- - Use ngettext for any strings with plurals (Piotr Drąg)
- - Use the default value if ArchiveSizeMax is unspecified (Richard Hughes)
-
-Version 1.0.4
-~~~~~~~~~~~~~
-Released: 2018-01-25
-
-New Features:
- - Add D-Bus methods to get and modify the history information (Richard Hughes)
- - Allow the user to share firmware update success or failure (Richard Hughes)
- - Ask the user to refresh metadata when it is very old (Richard Hughes)
- - Store firmware update success and failure to a local database (Richard Hughes)
-
-Bugfixes:
- - Add a device name for locked UEFI devices (Mario Limonciello)
- - Allow each plugin to opt-in to the recoldplug action (Richard Hughes)
- - Fix firmware downloading using gnome-software (Richard Hughes)
- - Fix UX capsule reference to the one specified in efivar (Mario Limonciello)
- - Never add two devices to the daemon with the same ID (Richard Hughes)
- - Rescan supported flags when refreshing metadata (Richard Hughes)
-
-Version 1.0.3
-~~~~~~~~~~~~~
-Released: 2018-01-09
-
-New Features:
- - Add a new plugin to add support for CSR "Driverless DFU" (Richard Hughes)
- - Add initial SF30/SN30 Pro support (Mario Limonciello)
- - Support AppStream metadata with relative URLs (Richard Hughes)
-
-Bugfixes:
- - Add more metadata to the user-agent string (Richard Hughes)
- - Block owned Dell TPM updates (Mario Limonciello)
- - Choose the correct component from provides matches using requirements (Richard Hughes)
- - Do not try to parse huge compressed archive files (Richard Hughes)
- - Fix a double-free bug in the Udev code (Philip Withnall)
- - Handle Thunderbolt "native" mode (Yehezkel Bernat)
- - Use the new functionality in libgcab >= 1.0 to avoid writing temp files (Richard Hughes)
-
-Version 1.0.2
-~~~~~~~~~~~~~
-Released: 2017-11-28
-
-New Features:
- - Add a plugin for the Nitrokey Storage device (Richard Hughes)
- - Add support for the original AVR DFU protocol (Richard Hughes)
- - Allow different plugins to claim the same device (Richard Hughes)
- - Allow quirks to set common USB properties (Richard Hughes)
- - Move a common plugin functionality out to a new shared object (Richard Hughes)
- - Optionally delay the device removal for better replugging (Richard Hughes)
- - Set environment variables to allow easy per-plugin debugging (Richard Hughes)
- - Use a SHA1 hash for the internal DeviceID (Richard Hughes)
-
-Bugfixes:
- - Add quirk for AT32UC3B1256 as used in the RubberDucky (Richard Hughes)
- - Disable the dell plugin if libsmbios fails (Mario Limonciello)
- - Don't register for USB UDev events to later ignore them (Richard Hughes)
- - Fix a possible buffer overflow when debugging ebitdo devices (Richard Hughes)
- - Fix critical warning when more than one remote fails to load (Richard Hughes)
- - Fix DFU attaching AVR32 devices like the XMEGA (Richard Hughes)
- - Ignore useless Thunderbolt device types (Mario Limonciello)
- - Refactor ColorHug into a much more modern plugin (Richard Hughes)
- - Release the Steelseries interface if getting the version failed (Richard Hughes)
- - Remove autoconf-isms from the meson configure options (Richard Hughes)
- - Show a nicer error message if the requirement fails (Richard Hughes)
- - Sort the output of GetUpgrades correctly (Richard Hughes)
-
-Version 1.0.1
-~~~~~~~~~~~~~
-Released: 2017-11-09
-
-New Features:
- - Add support for HWID requirements (Richard Hughes)
- - Add support for programming various AVR32 and XMEGA parts using DFU (Richard Hughes)
- - Add the various DFU quirks for the Jabra Speak devices (Richard Hughes)
- - Allow specifying the output file type for 'dfu-tool read' (Richard Hughes)
- - Move the database of supported devices out into runtime loaded files (Richard Hughes)
- - Support the IHEX record type 0x05 (Richard Hughes)
- - Use help2man to generate the man page at build time (Richard Hughes)
- - Use the new quirk infrastructure for version numbers (Richard Hughes)
-
-Bugfixes:
- - Catch invalid Dell dock component requests (Mario Limonciello)
- - Correctly output Intel HEX files with > 16bit offset addresses (Richard Hughes)
- - Do not try to verify the element write if upload is unsupported (Richard Hughes)
- - Fix a double-unref when updating any 8Bitdo device (Richard Hughes)
- - Fix crash when enumerating with Dell dock connected but with no UEFI (Mario Limonciello)
- - Fix uploading large firmware files over DFU (Richard Hughes)
- - Format the BCD USB revision numbers correctly (Richard Hughes)
- - Guess the DFU transfer size if it is not specified (Richard Hughes)
- - Include the reset timeout as wValue to fix some DFU bootloaders (Richard Hughes)
- - Make the error message clearer when sans fonts are missing (Mario Limonciello)
- - Support devices with truncated DFU interface data (Richard Hughes)
- - Use the correct remote-specified username and passord when using fwupdmgr (Richard Hughes)
- - Use the correct wDetachTimeOut when writing DFU firmware (Richard Hughes)
- - Verify devices with legacy VIDs are actually 8Bitdo controllers (Richard Hughes)
-
-Version 1.0.0
-~~~~~~~~~~~~~
-Released: 2017-10-09
-
-Notes:
- - This release breaks API and ABI to remove deprecated symbols
- - libdfu is now not installed as a shared library
-
-New Features:
- - Add a human-readable title for each remote (Richard Hughes)
- - Add a method to return a list of upgrades for a specific device (Richard Hughes)
- - Add an 'Summary' and 'Icons' properties to each device (Richard Hughes)
- - Add FuDeviceLocker to simplify device open/close lifecycles (Richard Hughes)
- - Add functionality to blacklist Dell HW with problems (Mario Limonciello)
- - Add fu_plugin_check_supported() (Richard Hughes)
- - Add fwupd_remote_get_checksum() to use in client programs (Richard Hughes)
- - Add ModifyRemote as an easy way to enable and disable remotes (Richard Hughes)
- - Add the plugin documentation to the main gtk-doc (Richard Hughes)
- - Allow plugins to depend on each other (Richard Hughes)
- - Disable the fallback USB plugin (Richard Hughes)
- - Parse the SMBIOS v2 and v3 DMI tables directly (Richard Hughes)
- - Support uploading the UEFI firmware splash image (Richard Hughes)
- - Use the intel-wmi-thunderbolt kernel module to force power (Mario Limonciello)
-
-Bugfixes:
- - Only run SMI to toggle host MST GPIO on Dell systems with host MST (Mario Limonciello)
- - Disable unifying support if no CONFIG_HIDRAW support (Richard Hughes)
- - Do not auto-open all USB devices at startup (Richard Hughes)
- - Do not fail to load the daemon if cached metadata is invalid (Richard Hughes)
- - Do not use system-specific infomation for UEFI PCI devices (Richard Hughes)
- - Fix a crash when using fu_plugin_device_add_delay() (Richard Hughes)
- - Fix the libdfu self test failure on s390 and ppc64 (Richard Hughes)
- - Fix various printing issues with the progressbar (Richard Hughes)
- - Generate the LD script from the GObject introspection data (Richard Hughes)
- - Never fallback to an offline update from client code (Richard Hughes)
- - Only set the Dell coldplug delay when we know we need it (Mario Limonciello)
- - Prefer to use HWIDs to get DMI keys and DE table (Mario Limonciello)
-
-Version 0.9.7
-~~~~~~~~~~~~~
-Released: 2017-09-01
-
-New Features:
- - Add a configure switch for the LVFS remotes (Richard Hughes)
- - Add a FirmwareBaseURI parameter to the remote config (Richard Hughes)
- - Add a firmware builder that uses bubblewrap (Richard Hughes)
- - Add a python script to create fwupd compatible cab files from Microsoft .exe files (Max Ehrlich)
- - Add a thunderbolt plugin for new kernel interface (Christian Kellner, Yehezkel Bernat)
- - Allow plugins to get DMI data from the hardware in a safe way (Richard Hughes)
- - Allow plugins to set metadata on devices created by other plugins (Richard Hughes, Mario Limonciello)
- - Optionally install the LVFS PKCS7 root certificate (Richard Hughes)
- - Optionally use GnuTLS to verify PKCS7 certificates (Richard Hughes)
-
-Bugfixes:
- - Add back options for HAVE_SYNAPTICS and HAVE_THUNDERBOLT (Mario Limonciello)
- - Allow configuring systemd and udev directories (Mario Limonciello)
- - Enable C99 support in meson.build (Philip Withnall)
- - Fix an incomplete cipher when using XTEA on data not in 4 byte chunks (Richard Hughes)
- - Fix minor const-correctness issues (Philip Withnall)
- - Implement thunderbolt image validation (Yehezkel Bernat, Christian Kellner)
- - Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags (Richard Hughes)
- - Show a bouncing progress bar if the percentage remains at zero (Richard Hughes)
- - Use a hwid to match supported systems for synapticsmst (Mario Limonciello)
- - Use the new bootloader PIDs for Unifying pico receivers (Richard Hughes)
- - When thunderbolt is in safe mode on a Dell recover using SMBIOS (Mario Limonciello)
-
-Version 0.9.6
-~~~~~~~~~~~~~
-Released: 2017-08-03
-
-New Features:
- - Add DfuPatch to support forward-only firmware patching (Richard Hughes)
- - Add --version option to fwupdmgr (Richard Hughes, Mario Limonciello)
- - Display all errors recorded by efi_error tracing (Mario Limonciello)
- - Make building introspection optional (Patrick Ohly)
- - Support embedded devices with local firmware metadata (Richard Hughes)
-
-Bugfixes:
- - Check all the device GUIDs against the blacklist when added (Richard Hughes)
- - Correct a memory leak in Dell plugin (Mario Limonciello, Richard Hughes)
- - Default to "en" for UEFI capsule graphics (Mario Limonciello)
- - Don't log a warning when an unknown unifying report is parsed (Richard Hughes)
- - Enable test suite via /etc/fwupd.conf (Mario Limonciello)
- - Fix a hang on 32 bit computers (Richard Hughes)
- - Fix compilation of the policy on a variety of configurations (Mario Limonciello)
- - Fix UEFI crash when the product name is NULL (Richard Hughes)
- - Make flashing ebitdo devices work with fu-ebitdo-tool (Chris Lee)
- - Make messages from installing capsules useful (Mario Limonciello)
- - Make sure the unifying percentage completion goes from 0% to 100% (Richard Hughes)
- - Run the plugin coldplug methods in a predictable order (Richard Hughes)
- - Test UEFI for kernel support during coldplug (Mario Limonciello)
- - Use new GUsb functionality to fix flashing Unifying devices (Richard Hughes)
-
-Version 0.9.5
-~~~~~~~~~~~~~
-Released: 2017-07-04
-
-New Features:
- - Add a get-remotes command to fwupdmgr (Richard Hughes)
- - Add a plugin to get the version of the AMT ME interface (Richard Hughes)
- - Add Arch Linux to CI (Bruno Pagani)
- - Add some installed tests flashing actual hardware (Richard Hughes)
- - Allow flashing Unifying devices in bootloader modes (Richard Hughes)
- - Allow ordering the metadata remotes (Richard Hughes)
-
-Bugfixes:
- - Do not check the runtime if the DFU device is in bootloader mode (Richard Hughes)
- - Do not unlock devices when doing VerifyUpdate (Richard Hughes)
- - Filter by Unifying SwId when making HID++2.0 requests (Richard Hughes)
- - Fix downgrades when version_lowest is set (Richard Hughes)
- - Fix the self tests when running on PPC64 big endian (Richard Hughes)
- - Move the remotes parsing from the client to the server (Richard Hughes)
- - Split up the Unifying HID++2.0 and HID++1.0 functionality (Richard Hughes)
- - Store the metadata files rather than merging to one store (Richard Hughes)
- - Use a longer timeout for some Unifying operations (Richard Hughes)
- - Use the UFY DeviceID prefix for Unifying devides (Richard Hughes)
-
-Version 0.9.4
-~~~~~~~~~~~~~
-Released: 2017-06-15
-
-New Features:
- - Add installed tests that use the daemon (Richard Hughes)
- - Add the ability to restrict firmware to specific vendors (Richard Hughes)
- - Enable Travis CI for Fedora and Debian (Richard Hughes, Mario Limonciello)
- - Export some more API for dealing with checksums (Richard Hughes)
- - Generate a images for status messages during system firmware update (Peter Jones)
- - Show progress download when refreshing metadata (Richard Hughes)
-
-Bugfixes:
- - Compile with newer versions of meson (Richard Hughes, Mario Limonciello)
- - Ensure that firmware provides are legal GUIDs (Richard Hughes)
- - Fix a common crash when refreshing metadata (Richard Hughes)
- - Use the correct type signature in the D-Bus introspection file (Richard Hughes)
-
-Version 0.9.3
-~~~~~~~~~~~~~
-Released: 2017-06-07
-
-New Features:
- - Add a 'downgrade' command to fwupdmgr (Richard Hughes)
- - Add a 'get-releases' command to fwupdmgr (Richard Hughes)
- - Add support for ConsoleKit2 (Eric Koegel)
- - Add support for Microsoft HardwareIDs (Richard Hughes)
- - Allow downloading metadata from more than just the LVFS (Richard Hughes)
- - Allow multiple checksums on devices and releases (Richard Hughes)
-
-Bugfixes:
- - Allow to specify bindir (Timo Gurr)
- - Correctly open Unifying devices with original factory firmware (Richard Hughes)
- - Deprecate some of the old FwupdResult API (Richard Hughes)
- - Do not copy the origin from the new metadata file (Richard Hughes)
- - Do not expect a Unifying reply when issuing a REBOOT command (Richard Hughes)
- - Do not re-download firmware that exists in the cache (Richard Hughes)
- - Fix a problem when testing for a Dell system (Mario Limonciello)
- - Fix flashing new firmware to 8bitdo controllers (Richard Hughes)
- - Increase minimum required AppStream-Glib version to 0.6.13 (Chris Mayo)
- - Make documentation and man pages optional (Chris Mayo)
- - Make systemd dependency at least version 231 (Mario Limonciello)
- - Only decompress the firmware after the signature check (Richard Hughes)
- - Remove 'lib' prefix when looking for libraries (Mirco Tischler)
- - Return the remote ID when getting updates about hardware (Richard Hughes)
- - Send the daemon the remote ID when sending firmware metadata (Richard Hughes)
-
-Version 0.9.2
-~~~~~~~~~~~~~
-Released: 2017-05-22
-
-New Features:
- - Add support for Unifying DFU features (Richard Hughes)
-
-Bugfixes:
- - Do not spew a critial warning when parsing an invalid URI (Richard Hughes)
- - Ensure device is closed if did not complete setup (Richard Hughes)
- - Ensure steelseries device is closed if it returns an invalid packet (Richard Hughes)
- - Fix man page installation location (Mario Limonciello)
- - Ignore spaces in the Unifying version prefix (Richard Hughes)
- - Set HAVE_POLKIT_0_114 when polkit is newer than 0.114 (Moritz Kiefer)
-
-Version 0.9.1
-~~~~~~~~~~~~~
-Released: 2017-04-28
-
-New Features:
- - Add a config option to allow runtime disabling plugins by name (Richard Hughes)
- - Add the Meson build system and remove autotools (Richard Hughes)
- - Support signed Intel HEX files (Richard Hughes)
-
-Bugfixes:
- - Add DFU quirk for OpenPICC and SIMtrace (Richard Hughes)
- - Create directories in /var/cache as required (Richard Hughes)
- - Refactor the unifying plugin now we know more about the hardware (Richard Hughes)
- - Set the source origin when saving metadata (Richard Hughes)
- - Support proxy servers in fwupdmgr (Richard Hughes)
- - Use a 60 second timeout on all client downloads (Richard Hughes)
-
-Version 0.8.1
-~~~~~~~~~~~~~
-Released: 2017-02-27
-
-Bugfixes:
- - Adjust systemd confinement restrictions (Mario Limonciello, Richard Hughes)
- - Do not hardcode docbook2man path (Kai Krakow)
- - Don't initialize libsmbios on unsupported systems (Mario Limonciello)
- - Fix a crash when enumerating devices on a Dell WLD15 (Richard Hughes)
- - Fix compiler warnings (Kai Krakow)
- - Fix fwupdmgr timeout with missing pending database (Richard Hughes)
-
-Version 0.8.0
-~~~~~~~~~~~~~
-Released: 2017-02-08
-
-New Features:
- - Add a set of vfuncs that are run before and after a device update (Richard Hughes)
- - Add Dell-specific functionality to allow other plugins turn on TBT/GPIO (Mario Limonciello)
- - Add support for Intel Thunderbolt devices (Richard Hughes, Mario Limonciello)
- - Add support for Logitech Unifying devices (Richard Hughes)
- - Add support for Synaptics MST cascades hubs (Mario Limonciello)
- - Add support for the Altus-Metrum ChaosKey device (Richard Hughes)
- - Add VerifyUpdate to update the device checksums server-side (Richard Hughes)
- - Allow the metadata to match a version of fwupd and the existing fw version (Richard Hughes)
-
-Bugfixes:
- - Add a new method for forcing a controller to flash mode (Mario Limonciello)
- - Always make sure we're getting a C99 compiler (Richard Hughes)
- - Close USB devices before error returns (Tsunghan Liu)
- - Don't read data from some DfuSe targets (Richard Hughes)
- - Include all debug messages when run with --verbose (Richard Hughes)
- - Return the pending UEFI update when not on AC power (Richard Hughes)
- - Use a heuristic for the start address if the firmware has no DfuSe footer (Richard Hughes)
- - Use more restrictive settings when running under systemd (Richard Hughes, Mario Limonciello)
-
-Version 0.7.5
-~~~~~~~~~~~~~
-Released: 2016-10-19
-
-New Features:
- - Add a 'replace-data' command to dfu-tool (Richard Hughes)
- - Use an animated progress bar when performing DFU operations (Richard Hughes)
-
-Bugfixes:
- - Add quirks for HydraBus as it does not have a DFU runtime (Richard Hughes)
- - Don't create the UEFI dummy device if the unlock will happen on next boot (Richard Hughes)
- - Enable hardening flags on more binaries (Mario Limonciello)
- - Fix an assert when unlocking the dummy ESRT device (Richard Hughes)
- - Fix writing firmware to devices using the ST reference bootloader (Richard Hughes)
- - Match the Dell TB16 device (Mario Limonciello)
- - Re-get the quirks when the DfuDevice gets a new GUsbDevice (Richard Hughes)
- - Show the nicely formatted target name for DfuSe devices (Richard Hughes)
- - Verify devices support updating in mode they are called (Mario Limonciello)
-
-Version 0.7.4
-~~~~~~~~~~~~~
-Released: 2016-09-19
-
-New Features:
- - Add dfu_firmware_add_symbol() (Richard Hughes)
- - Allow the argument to 'dfu-tool set-release' be major.minor (Richard Hughes)
- - Load the Altos USB descriptor from ELF files (Richard Hughes)
- - Support writing the IHEX symbol table (Richard Hughes)
-
-Bugfixes:
- - Add a fallback for older appstream-glib releases (Richard Hughes)
- - Fix a possible crash when uploading firmware files using libdfu (Richard Hughes)
- - Fix libfwupd self tests when a host-provided fwupd is not available (Richard Hughes)
- - Show the human-readable version in the 'dfu-tool dump' output (Richard Hughes)
- - Write the ELF files with the correct section type (Richard Hughes)
-
-Version 0.7.3
-~~~~~~~~~~~~~
-Released: 2016-08-29
-
-New Features:
- - Add a set-address and set-target-size commands to dfu-util (Richard Hughes)
- - Add a small library for talking with 0bitdo hardware (Richard Hughes)
- - Add Dell TPM and TB15/WD15 support via new Dell provider (Mario Limonciello)
- - Add FU_DEVICE_FLAG_NEEDS_BOOTLOADER (Richard Hughes)
- - Add fwupd_client_get_status() (Richard Hughes)
- - Add fwupd_result_get_unique_id() (Richard Hughes)
- - Add initial ELF reading and writing support to libdfu (Richard Hughes)
- - Add support for installing multiple devices from a CAB file (Richard Hughes)
- - Allow providers to export percentage completion (Richard Hughes)
- - Show a progress notification when installing firmware (Richard Hughes)
- - Show the vendor flashing instructions when installing (Richard Hughes)
-
-Bugfixes:
- - Add XPS 9250 to Dell TPM modeswitch blacklist (Mario Limonciello)
- - Allow blacklisting devices by their GUID (Richard Hughes)
- - Conditionally enable all providers based upon installed (Mario Limonciello)
- - Display flashes left in results output when it gets low (Mario Limonciello)
- - Do not attempt to add DFU devices not in runtime mode (Richard Hughes)
- - Do not use the deprecated GNOME_COMPILE_WARNINGS (Richard Hughes)
- - Don't fail while checking versions or locked state (Richard Hughes)
- - Embed fwupd version in generated documentation (Mario Limonciello)
- - Ensure the ID is set when getting local firmware details (Richard Hughes)
- - Fix gtk-doc build when srcdir != builddir (Ting-Wei Lan)
- - Fix libdfu hang when parsing corrupt IHEX files (Richard Hughes)
- - Ignore devices that do not add at least one GUID (Richard Hughes)
- - In get-details output, display the blob filename (Mario Limonciello)
- - Save the unique ID in the pending database (Richard Hughes)
- - Support the 'DEVO' cipher kind in libdfu (Richard Hughes)
- - Switch to the Amazon S3 CDN for firmware metadata (Richard Hughes)
- - Update fwupdmgr manpage for new commands and arguments (Mario Limonciello)
- - Use a private gnupg key store (Richard Hughes)
- - Use the correct firmware when installing a composite device (Richard Hughes)
- - Use the SHA1 hash of the local file data as the origin (Richard Hughes)
-
-Version 0.7.2
-~~~~~~~~~~~~~
-Released: 2016-06-13
-
-New Features:
- - Add a GetDetailsLocal() method to eventually replace GetDetails() (Richard Hughes)
- - Add fu_device_get_alternate() (Richard Hughes)
- - Allow devices to have multiple assigned GUIDs (Richard Hughes)
- - Allow metainfo files to match only specific revisions of devices (Richard Hughes)
- - Show the DFU protocol version in 'dfu-tool list' (Richard Hughes)
-
-Bugfixes:
- - Enforce allowing providers to take away flash abilities (Mario Limonciello)
- - Only claim the DFU interface when required (Richard Hughes)
- - Only return updatable devices from GetDevices() (Richard Hughes)
-
-Version 0.7.1
-~~~~~~~~~~~~~
-Released: 2016-05-13
-
-New Features:
- - Add a --force flag to override provider warnings (Mario Limonciello)
- - Add device-added, device-removed and device-changed signals (Richard Hughes)
- - Add dfu_image_get_element_default() (Richard Hughes)
- - Add for a new device field "Flashes Left" (Mario Limonciello)
- - Add fwupd_client_connect() (Richard Hughes)
- - Add the 'monitor' debugging command for fwupdmgr (Richard Hughes)
- - Add the 'supported' flag to the FuDevice (Richard Hughes)
-
-Bugfixes:
- - Add summary and name field for Rival SteelSeries (Mario Limonciello)
- - Fix a critical warning when restarting the daemon (Richard Hughes)
- - Fix BE issues when reading and writing DFU files (Mario Limonciello, Richard Hughes)
- - Make the device display name nicer (Richard Hughes, Richard Hughes)
- - Match the AppStream metadata after a device has been added (Richard Hughes)
- - Remove non-interactive pinentry setting from fu-keyring (Mario Limonciello)
- - Return all update descriptions newer than the installed version (Richard Hughes)
- - Set the device description when parsing local firmware files (Richard Hughes)
-
-Version 0.7.0
-~~~~~~~~~~~~~
-Released: 2016-04-01
-
-New Features:
- - Add a version plugin for SteelSeries hardware (Richard Hughes)
- - Add FwupdClient and FwupdResult to libfwupd (Richard Hughes)
- - Generate gtk-doc documentation for libfwupd (Richard Hughes)
- - Return the device flags when getting firmware details (Richard Hughes)
- - Support other checksum kinds (Richard Hughes)
-
-Bugfixes:
- - Add Alienware to the version quirk table (Mario Limonciello)
- - Allow the test suite to run in %check (Richard Hughes)
- - Do not return updates that require AC when on battery (Richard Hughes)
- - Do not use /tmp for downloaded files (Richard Hughes)
- - Test that GPG key import actually was successful (Mario Limonciello)
-
-Version 0.6.3
-~~~~~~~~~~~~~
-Released: 2016-03-14
-
-New Features:
- - Add an unlock method for devices (Richard Hughes)
- - Add a simple plugin infrastructure (Richard Hughes)
- - Add ESRT enable method into UEFI provider (Mario Limonciello)
- - Install the hardcoded firmware AppStream file (Richard Hughes)
-
-Bugfixes:
- - Correct the BCD version number for DFU 1.1 (Richard Hughes)
- - Do not use deprecated API from libappstream-glib (Richard Hughes)
- - Ignore the DFU runtime on the DW1820A (Richard Hughes)
- - Only read PCI OptionROM firmware when devices are manually unlocked (Richard Hughes)
- - Require AC power before scheduling some types of firmware update (Richard Hughes)
- - Show ignored DFU devices in dfu-util, but not in fwupd (Richard Hughes)
-
-Version 0.6.2
-~~~~~~~~~~~~~
-Released: 2016-02-12
-
-New Features:
- - Add 'Created' and 'Modified' properties on managed devices (Richard Hughes)
-
-Bugfixes:
- - Fix get-results for UEFI provider (Mario Limonciello)
- - Support vendor-specific UEFI version encodings (Richard Hughes)
-
-Version 0.6.1
-~~~~~~~~~~~~~
-Released: 2016-01-19
-
-Bugfixes:
- - Always persist ColorHug devices after replug (Richard Hughes)
- - Do not misdetect different ColorHug devices (Richard Hughes)
- - Only dump the profiling data when run with --verbose (Richard Hughes)
-
-Version 0.6.0
-~~~~~~~~~~~~~
-Released: 2015-12-07
-
-Notes:
- - This release adds a new GObject library called libdfu and a command line
- client called dfu-tool. This is a low-level tool used to upgrade USB device
- firmware and can either be shipped in the same package as fwupd or split off
- as separate subpackages.
-
-New Features:
- - Add support for automatically updating USB DFU-capable devices (Richard Hughes)
-
-Bugfixes:
- - Emit the changed signal after doing an update (Richard Hughes)
- - Export the AppStream ID when returning device results (Richard Hughes)
- - Fix compile with --disable-shared (Richard Hughes)
- - Use new API available in fwup 0.5 (Richard Hughes, Mario Limonciello)
- - Use the same device identification string format as Microsoft (Richard Hughes)
-
-Version 0.5.3
-~~~~~~~~~~~~~
-Released: 2015-11-05
-
-Bugfixes:
- - Avoid seeking when reading the file magic during refresh (Richard Hughes)
- - Do not assume that the compressed XML data will be NUL terminated (Richard Hughes)
- - Use the correct user agent string for fwupdmgr (Richard Hughes)
-
-Version 0.5.2
-~~~~~~~~~~~~~
-Released: 2015-10-28
-
-New Features:
- - Add profiling data to debug slow startup times (Richard Hughes)
- - Support cabinet archives files with more than one firmware (Richard Hughes)
-
-Bugfixes:
- - Add the update description to the GetDetails results (Richard Hughes)
- - Clear the in-memory firmware store only after parsing a valid XML file (Richard Hughes)
- - Ensure D-Bus remote errors are registered at fwupdmgr startup (Richard Hughes)
- - Fix verify-update to produce components with the correct provide values (Richard Hughes)
- - Require appstream-glib 0.5.1 (Mirco Tischler)
- - Show the dotted-decimal representation of the UEFI version number (Richard Hughes)
- - When the version is from the 'FW' extension do not cache the device (Richard Hughes)
-
-Version 0.5.1
-~~~~~~~~~~~~~
-Released: 2015-09-21
-
-Bugfixes:
- - Fix the error message when no devices can be updated (Richard Hughes)
- - Fix reading symlink to prevent crash with some compilers (Kalev Lember)
-
-Version 0.5.0
-~~~~~~~~~~~~~
-Released: 2015-09-15
-
-New Features:
- - Raise the dep on GLib to support and use g_autoptr() (Richard Hughes)
-
-Bugfixes:
- - Do not merge existing firmware metadata (Richard Hughes)
- - Do not reboot if racing with the PackageKit offline update mechanism (Richard Hughes)
-
-Version 0.1.6
-~~~~~~~~~~~~~
-Released: 2015-09-10
-
-New Features:
- - Remove fwsignd, we have the LVFS now (Richard Hughes)
-
-Bugfixes:
- - Add application metadata when getting the updates list (Richard Hughes)
- - Depend on appstream-glib >= 0.5.0 (Richard Hughes)
- - Don't apply firmware if something else is processing the update (Richard Hughes)
- - Install fwupd into /usr/lib/$(triplet)/fwupd instead (Mario Limonciello)
- - Simplify the version properties on devices to avoid complexity (Richard Hughes)
- - Update the offline update service to invoke right command (Kalev Lember)
- - Use the new secure metadata URI (Richard Hughes)
-
-Version 0.1.5
-~~~~~~~~~~~~~
-Released: 2015-08-12
-
-Notes:
- - For the device verification code to work correctly you need at least
- libappstream-glib 0.5.0 installed.
-
-New Features:
- - Add a Raspberry Pi firmware provider (Richard Hughes)
- - Add a simple config file to store the correct LVFS download URI (Richard Hughes)
- - Make parsing the option ROM runtime optional (Richard Hughes)
-
-Bugfixes:
- - Allow fwupd to be autostarted by systemd (Richard Hughes)
- - Allow no arguments to 'fwupdmgr verify-update' and use sane defaults (Richard Hughes)
- - Devices with option ROM are always internal (Richard Hughes)
- - Do not pre-convert the update description from AppStream XML (Richard Hughes)
- - Fix validation of written firmware (Richard Hughes)
- - Move the verification and metadata matching phase to the daemon (Richard Hughes)
- - Sign the test binary with the correct key (Richard Hughes)
- - Use the AppStream 0.9 firmware specification by default (Richard Hughes)
-
-Version 0.1.4
-~~~~~~~~~~~~~
-Released: 2015-07-25
-
-Notes:
- - In this release we've moved the LVFS website to the fwupd project and made
- them work really well together. To update all the firmware on your system
- is now just a case of "fwupdmgr refresh && fwupdmgr update"
- - We've also added verification of BIOS and PCI ROM firmware, which may be
- useful for forensics or to verify that system updates have been applied.
-
-New Features:
- - Actually parse the complete PCI option ROM (Richard Hughes)
- - Add a 'fwupdmgr update' command to update all devices to latest versions (Richard Hughes)
- - Add a simple signing server that operates on .cab files (Richard Hughes)
- - Add a 'verify' command that verifies the cryptographic hash of device firmware (Richard Hughes)
- - Allow clients to add new firmware metadata to the system cache (Richard Hughes)
- - Move GetUpdates to the daemon (Richard Hughes)
- - Move the LVFS website to the fwupd project (Richard Hughes)
-
-Bugfixes:
- - Accept multiple files at one time when using fwupdmgr dump-rom (Richard Hughes)
- - Automatically download metadata using fwupdmgr if required (Richard Hughes)
- - Do not return NULL as a gboolean (Thomas Hindoe Paaboel Andersen)
- - Don't call efibootmgr after fwupdate (Mario Limonciello)
- - Fallback to offline install when calling the update argument (Mario Limonciello)
- - Fix Intel VBIOS detection on Dell hardware (Richard Hughes)
- - Reload appstream data after refreshing (Mario Limonciello)
- - Use the new LVFS GPG key (Richard Hughes)
- - Fix build: libgusb is required even without colorhug support (Jussi Kukkonen)
-
-Version 0.1.3
-~~~~~~~~~~~~~
-Released: 2015-05-28
-
-New Features:
- - Get the firmware version from the device descriptors (Richard Hughes)
- - Run the offline actions using systemd when required (Richard Hughes)
- - Support OpenHardware devices using the fwupd vendor extensions (Richard Hughes)
-
-Bugfixes:
- - Add an UNKNOWN status so we can return meaningful enum values (Richard Hughes)
- - Coldplug the devices before acquiring the well known name (Richard Hughes)
-
-Version 0.1.2
-~~~~~~~~~~~~~
-Released: 2015-04-22
- - Add some guidelines for vendors to README (Richard Hughes)
- - Only allow signed firmware to be upgraded without a password (Richard Hughes)
-
-Version 0.1.1
-~~~~~~~~~~~~~
-Released: 2015-03-23
-
-New Features:
- - Add a 'get-updates' command to fwupdmgr (Richard Hughes)
- - Add and document the offline-update lifecycle (Richard Hughes)
- - Create a libfwupd shared library (Richard Hughes)
-
-Bugfixes:
- - Create runtime directories if they do not exist (Richard Hughes)
- - Do not crash when there are no devices to return (Richard Hughes)
-
-Version 0.1.0
-~~~~~~~~~~~~~
-Released: 2015-03-16
-
-Notes:
- - fwupd is a simple daemon to allow session software to update firmware.
diff -Nru fwupd-1.0.6/plugins/altos/altos.quirk fwupd-1.2.10/plugins/altos/altos.quirk
--- fwupd-1.0.6/plugins/altos/altos.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/altos.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,7 @@
+# ChaosKey
+[DeviceInstanceId=USB\VID_1D50&PID_60C6]
+Plugin = altos
+Flags = none
+[DeviceInstanceId=USB\VID_FFFE&PID_000A]
+Plugin = altos
+Flags = is-bootloader
diff -Nru fwupd-1.0.6/plugins/altos/fu-altos-device.c fwupd-1.2.10/plugins/altos/fu-altos-device.c
--- fwupd-1.0.6/plugins/altos/fu-altos-device.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-altos-device.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,39 +1,23 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include
#include
-#include
#include
#include
#include
#include
+#include "fu-io-channel.h"
#include "fu-altos-device.h"
#include "fu-altos-firmware.h"
-typedef struct
-{
+struct _FuAltosDevice {
+ FuUsbDevice parent_instance;
FuAltosDeviceKind kind;
guint32 serial[9];
gchar *guid;
@@ -42,15 +26,16 @@
guint64 addr_base;
guint64 addr_bound;
struct termios tty_termios;
- gint tty_fd;
-} FuAltosDevicePrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (FuAltosDevice, fu_altos_device, FU_TYPE_USB_DEVICE)
+ FuIOChannel *io_channel;
+};
-#define GET_PRIVATE(o) (fu_altos_device_get_instance_private (o))
+G_DEFINE_TYPE (FuAltosDevice, fu_altos_device, FU_TYPE_USB_DEVICE)
#ifndef HAVE_GUDEV_232
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevClient, g_object_unref)
+#pragma clang diagnostic pop
#endif
/**
@@ -96,40 +81,25 @@
static void
fu_altos_device_finalize (GObject *object)
{
- FuAltosDevice *device = FU_ALTOS_DEVICE (object);
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
+ FuAltosDevice *self = FU_ALTOS_DEVICE (object);
- g_free (priv->guid);
- g_free (priv->tty);
- g_free (priv->version);
+ g_free (self->guid);
+ g_free (self->tty);
+ g_free (self->version);
G_OBJECT_CLASS (fu_altos_device_parent_class)->finalize (object);
}
-static void
-fu_altos_device_init (FuAltosDevice *device)
-{
-}
-
-static void
-fu_altos_device_class_init (FuAltosDeviceClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = fu_altos_device_finalize;
-}
-
FuAltosDeviceKind
-fu_altos_device_get_kind (FuAltosDevice *device)
+fu_altos_device_get_kind (FuAltosDevice *self)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
- return priv->kind;
+ return self->kind;
}
static gboolean
-fu_altos_device_find_tty (FuAltosDevice *device, GError **error)
+fu_altos_device_find_tty (FuAltosDevice *self, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
+ GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
g_autoptr(GList) devices = NULL;
g_autoptr(GUdevClient) gudev_client = g_udev_client_new (NULL);
@@ -160,7 +130,7 @@
continue;
/* success */
- priv->tty = g_strdup (dev_file);
+ self->tty = g_strdup (dev_file);
return TRUE;
}
@@ -175,188 +145,56 @@
}
static gboolean
-fu_altos_device_tty_write (FuAltosDevice *device,
+fu_altos_device_tty_write (FuAltosDevice *self,
const gchar *data,
gssize data_len,
GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
- gint rc;
- gssize idx = 0;
- guint timeout_ms = 500;
- struct pollfd fds;
-
/* lets assume this is text */
if (data_len < 0)
data_len = strlen (data);
-
- fds.fd = priv->tty_fd;
- fds.events = POLLOUT;
-
- g_debug ("write, with timeout %ums", timeout_ms);
- while (idx < data_len) {
-
- /* wait for data to be allowed to write without blocking */
- rc = poll (&fds, 1, (gint) timeout_ms);
- if (rc == 0)
- break;
- if (rc < 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "failed to poll %i",
- priv->tty_fd);
- return FALSE;
- }
-
- /* we can write data */
- if (fds.revents & POLLOUT) {
- gssize len;
- g_debug ("writing %" G_GSSIZE_FORMAT " bytes: %s", data_len, data);
- len = write (priv->tty_fd, data + idx, data_len - idx);
- if (len < 0) {
- if (errno == EAGAIN) {
- g_debug ("got EAGAIN, trying harder");
- continue;
- }
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_WRITE,
- "failed to write %" G_GSSIZE_FORMAT
- " bytes to %i: %s" ,
- data_len,
- priv->tty_fd,
- strerror (errno));
- return FALSE;
- }
- g_debug ("wrote %" G_GSSIZE_FORMAT " bytes", len);
- idx += len;
- }
- }
-
- return TRUE;
+ return fu_io_channel_write_raw (self->io_channel,
+ (const guint8 *) data,
+ (gsize) data_len,
+ 500, /* ms */
+ FU_IO_CHANNEL_FLAG_NONE,
+ error);
}
static GString *
-fu_altos_device_tty_read (FuAltosDevice *device,
+fu_altos_device_tty_read (FuAltosDevice *self,
guint timeout_ms,
gssize max_size,
GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
- gint rc;
- struct pollfd fds;
- g_autoptr(GString) str = g_string_new (NULL);
-
- fds.fd = priv->tty_fd;
- fds.events = POLLIN;
-
- g_debug ("read, with timeout %ums", timeout_ms);
- for (;;) {
- /* wait for data to appear */
- rc = poll (&fds, 1, (gint) timeout_ms);
- if (rc == 0)
- break;
- if (rc < 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "failed to poll %i",
- priv->tty_fd);
- return NULL;
- }
-
- /* we have data to read */
- if (fds.revents & POLLIN) {
- guint8 buf[1024];
- gssize len = read (priv->tty_fd, buf, sizeof (buf));
- if (len < 0) {
- if (errno == EAGAIN) {
- g_debug ("got EAGAIN, trying harder");
- continue;
- }
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "failed to read %i: %s",
- priv->tty_fd,
- strerror (errno));
- return NULL;
- }
- if (len > 0) {
- g_debug ("read %" G_GSSIZE_FORMAT " bytes from device", len);
- g_string_append_len (str, (gchar *) buf, len);
- }
-
- /* check maximum size */
- if (max_size > 0 && str->len >= (guint) max_size)
- break;
- continue;
- }
- if (fds.revents & POLLERR) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "error condition");
- return NULL;
- }
- if (fds.revents & POLLHUP) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "connection hung up");
- return NULL;
- }
- if (fds.revents & POLLNVAL) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "invalid request");
- return NULL;
- }
- }
-
- /* no data */
- if (str->len == 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_READ,
- "no data received from device in %ums",
- timeout_ms);
+ g_autoptr(GBytes) buf = NULL;
+ buf = fu_io_channel_read_bytes (self->io_channel, max_size,
+ timeout_ms, FU_IO_CHANNEL_FLAG_NONE, error);
+ if (buf == NULL)
return NULL;
- }
-
- /* return blob */
- return g_steal_pointer (&str);
+ return g_string_new_len (g_bytes_get_data (buf, NULL), g_bytes_get_size (buf));
}
static gboolean
-fu_altos_device_tty_open (FuAltosDevice *device, GError **error)
+fu_altos_device_tty_open (FuAltosDevice *self, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
struct termios termios;
g_autoptr(GString) str = NULL;
/* open device */
- priv->tty_fd = open (priv->tty, O_RDWR | O_NONBLOCK);
- if (priv->tty_fd < 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_INVALID_FILE,
- "failed to open %s",
- priv->tty);
+ self->io_channel = fu_io_channel_new_file (self->tty, error);
+ if (self->io_channel == NULL)
return FALSE;
- }
/* get the old termios settings so we can restore later */
- if (tcgetattr (priv->tty_fd, &termios) < 0) {
+ if (tcgetattr (fu_io_channel_unix_get_fd (self->io_channel), &termios) < 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"failed to get attributes from fd");
return FALSE;
}
- priv->tty_termios = termios;
+ self->tty_termios = termios;
cfmakeraw (&termios);
/* set speed */
@@ -374,7 +212,8 @@
termios.c_cc[VTIME] = 0;
/* set all new data */
- if (tcsetattr (priv->tty_fd, TCSAFLUSH, &termios) < 0) {
+ if (tcsetattr (fu_io_channel_unix_get_fd (self->io_channel),
+ TCSAFLUSH, &termios) < 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
@@ -383,7 +222,7 @@
}
/* dump any pending input */
- str = fu_altos_device_tty_read (device, 50, -1, NULL);
+ str = fu_altos_device_tty_read (self, 50, -1, NULL);
if (str != NULL)
g_debug ("dumping pending buffer: %s", str->str);
@@ -391,51 +230,51 @@
}
static gboolean
-fu_altos_device_tty_close (FuAltosDevice *device, GError **error)
+fu_altos_device_tty_close (FuAltosDevice *self, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
-
- tcsetattr (priv->tty_fd, TCSAFLUSH, &priv->tty_termios);
- close (priv->tty_fd);
-
+ tcsetattr (fu_io_channel_unix_get_fd (self->io_channel),
+ TCSAFLUSH, &self->tty_termios);
+ if (!fu_io_channel_shutdown (self->io_channel, error))
+ return FALSE;
+ g_clear_object (&self->io_channel);
return TRUE;
}
static GString *
-fu_altos_device_read_page (FuAltosDevice *device, guint address, GError **error)
+fu_altos_device_read_page (FuAltosDevice *self, guint address, GError **error)
{
g_autoptr(GString) str = NULL;
g_autofree gchar *cmd = g_strdup_printf ("R %x\n", address);
- if (!fu_altos_device_tty_write (device, cmd, -1, error))
+ if (!fu_altos_device_tty_write (self, cmd, -1, error))
return NULL;
- str = fu_altos_device_tty_read (device, 1500, 256, error);
+ str = fu_altos_device_tty_read (self, 1500, 256, error);
if (str == NULL)
return NULL;
return g_steal_pointer (&str);
}
static gboolean
-fu_altos_device_write_page (FuAltosDevice *device,
+fu_altos_device_write_page (FuAltosDevice *self,
guint address,
const guint8 *data,
guint data_len,
GError **error)
{
g_autofree gchar *cmd = g_strdup_printf ("W %x\n", address);
- if (!fu_altos_device_tty_write (device, cmd, -1, error))
+ if (!fu_altos_device_tty_write (self, cmd, -1, error))
return FALSE;
- if (!fu_altos_device_tty_write (device, (const gchar *) data, data_len, error))
+ if (!fu_altos_device_tty_write (self, (const gchar *) data, data_len, error))
return FALSE;
return TRUE;
}
-gboolean
-fu_altos_device_write_firmware (FuAltosDevice *device,
+static gboolean
+fu_altos_device_write_firmware (FuDevice *device,
GBytes *fw,
- FuAltosDeviceWriteFirmwareFlag flags,
+ FwupdInstallFlags flags,
GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
+ FuAltosDevice *self = FU_ALTOS_DEVICE (device);
GBytes *fw_blob;
const gchar *data;
const gsize data_len;
@@ -445,7 +284,7 @@
g_autoptr(GString) buf = g_string_new (NULL);
/* check kind */
- if (priv->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
+ if (self->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
@@ -454,7 +293,7 @@
}
/* check sizes */
- if (priv->addr_base == 0x0 || priv->addr_bound == 0x0) {
+ if (self->addr_base == 0x0 || self->addr_bound == 0x0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
@@ -463,7 +302,7 @@
}
/* read in blocks of 256 bytes */
- flash_len = priv->addr_bound - priv->addr_base;
+ flash_len = self->addr_bound - self->addr_base;
if (flash_len == 0x0 || flash_len > 0x100000) {
g_set_error_literal (error,
FWUPD_ERROR,
@@ -478,14 +317,14 @@
return FALSE;
/* check the start address */
- if (fu_altos_firmware_get_address (altos_firmware) != priv->addr_base) {
+ if (fu_altos_firmware_get_address (altos_firmware) != self->addr_base) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"start address not correct %" G_GUINT64_FORMAT ":"
"%" G_GUINT64_FORMAT,
fu_altos_firmware_get_address (altos_firmware),
- priv->addr_base);
+ self->addr_base);
return FALSE;
}
@@ -522,16 +361,16 @@
}
/* verify data from device */
- if (!fu_altos_device_write_page (device,
- priv->addr_base + i,
+ if (!fu_altos_device_write_page (self,
+ self->addr_base + i,
buf_tmp,
0x100,
error))
return FALSE;
/* verify data written on device */
- str = fu_altos_device_read_page (device,
- priv->addr_base + i,
+ str = fu_altos_device_read_page (self,
+ self->addr_base + i,
error);
if (str == NULL)
return FALSE;
@@ -541,7 +380,7 @@
FWUPD_ERROR_WRITE,
"failed to verify @%x, "
"not enough data returned",
- (guint) (priv->addr_base + i));
+ (guint) (self->addr_base + i));
return FALSE;
}
if (memcmp (str->str, buf_tmp, 0x100) != 0) {
@@ -549,38 +388,36 @@
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
"failed to verify @%x",
- (guint) (priv->addr_base + i));
+ (guint) (self->addr_base + i));
return FALSE;
}
/* progress */
- fu_device_set_progress_full (FU_DEVICE (device), i, flash_len);
+ fu_device_set_progress_full (device, i, flash_len);
g_string_append_len (buf, str->str, str->len);
}
/* go to application mode */
- if (flags & FU_ALTOS_DEVICE_WRITE_FIRMWARE_FLAG_REBOOT) {
- if (!fu_altos_device_tty_write (device, "a\n", -1, error))
- return FALSE;
- }
+ if (!fu_altos_device_tty_write (self, "a\n", -1, error))
+ return FALSE;
/* progress complete */
- fu_device_set_progress_full (FU_DEVICE (device), flash_len, flash_len);
+ fu_device_set_progress_full (device, flash_len, flash_len);
/* success */
return TRUE;
}
-GBytes *
-fu_altos_device_read_firmware (FuAltosDevice *device, GError **error)
+static GBytes *
+fu_altos_device_read_firmware (FuDevice *device, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
+ FuAltosDevice *self = FU_ALTOS_DEVICE (device);
guint flash_len;
g_autoptr(FuDeviceLocker) locker = NULL;
g_autoptr(GString) buf = g_string_new (NULL);
/* check kind */
- if (priv->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
+ if (self->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
@@ -589,7 +426,7 @@
}
/* check sizes */
- if (priv->addr_base == 0x0 || priv->addr_bound == 0x0) {
+ if (self->addr_base == 0x0 || self->addr_bound == 0x0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
@@ -598,7 +435,7 @@
}
/* read in blocks of 256 bytes */
- flash_len = priv->addr_bound - priv->addr_base;
+ flash_len = self->addr_bound - self->addr_base;
if (flash_len == 0x0 || flash_len > 0x100000) {
g_set_error_literal (error,
FWUPD_ERROR,
@@ -614,18 +451,18 @@
error);
if (locker == NULL)
return NULL;
- for (guint i = priv->addr_base; i < priv->addr_bound; i+= 0x100) {
+ for (guint i = self->addr_base; i < self->addr_bound; i+= 0x100) {
g_autoptr(GString) str = NULL;
/* request data from device */
- str = fu_altos_device_read_page (device, i, error);
+ str = fu_altos_device_read_page (self, i, error);
if (str == NULL)
return NULL;
/* progress */
- fu_device_set_progress_full (FU_DEVICE (device),
- i - priv->addr_base,
- priv->addr_bound - priv->addr_base);
+ fu_device_set_progress_full (device,
+ i - self->addr_base,
+ self->addr_bound - self->addr_base);
g_string_append_len (buf, str->str, str->len);
}
@@ -634,17 +471,16 @@
}
static gboolean
-fu_altos_device_probe_bootloader (FuAltosDevice *device, GError **error)
+fu_altos_device_probe_bootloader (FuAltosDevice *self, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
g_autoptr(FuDeviceLocker) locker = NULL;
g_auto(GStrv) lines = NULL;
g_autoptr(GString) str = NULL;
/* get tty for upload */
- if (!fu_altos_device_find_tty (device, error))
+ if (!fu_altos_device_find_tty (self, error))
return FALSE;
- locker = fu_device_locker_new_full (device,
+ locker = fu_device_locker_new_full (self,
(FuDeviceLockerFunc) fu_altos_device_tty_open,
(FuDeviceLockerFunc) fu_altos_device_tty_close,
error);
@@ -652,9 +488,9 @@
return FALSE;
/* get the version information */
- if (!fu_altos_device_tty_write (device, "v\n", -1, error))
+ if (!fu_altos_device_tty_write (self, "v\n", -1, error))
return FALSE;
- str = fu_altos_device_tty_read (device, 100, -1, error);
+ str = fu_altos_device_tty_read (self, 100, -1, error);
if (str == NULL)
return FALSE;
@@ -672,25 +508,26 @@
/* we can flash firmware */
if (g_strcmp0 (lines[i], "altos-loader") == 0) {
- fu_device_remove_flag (FU_DEVICE (device),
+ fu_device_remove_flag (FU_DEVICE (self),
FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER);
continue;
}
/* version number */
if (g_str_has_prefix (lines[i], "software-version ")) {
- fu_device_set_version (FU_DEVICE (device), lines[i] + 17);
+ fu_device_set_version (FU_DEVICE (self), lines[i] + 17,
+ FWUPD_VERSION_FORMAT_TRIPLET);
continue;
}
/* address base and bound */
if (g_str_has_prefix (lines[i], "flash-range ")) {
g_auto(GStrv) addrs = g_strsplit (lines[i] + 17, " ", -1);
- priv->addr_base = g_ascii_strtoull (addrs[0], NULL, 16);
- priv->addr_bound = g_ascii_strtoull (addrs[1], NULL, 16);
+ self->addr_base = g_ascii_strtoull (addrs[0], NULL, 16);
+ self->addr_bound = g_ascii_strtoull (addrs[1], NULL, 16);
g_debug ("base: %x, bound: %x",
- (guint) priv->addr_base,
- (guint) priv->addr_bound);
+ (guint) self->addr_base,
+ (guint) self->addr_bound);
continue;
}
@@ -701,18 +538,18 @@
return TRUE;
}
-gboolean
-fu_altos_device_probe (FuAltosDevice *device, GError **error)
+static gboolean
+fu_altos_device_probe (FuDevice *device, GError **error)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
+ FuAltosDevice *self = FU_ALTOS_DEVICE (device);
+ GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
/* bootloader uses tty */
- if (priv->kind == FU_ALTOS_DEVICE_KIND_BOOTLOADER)
- return fu_altos_device_probe_bootloader (device, error);
+ if (self->kind == FU_ALTOS_DEVICE_KIND_BOOTLOADER)
+ return fu_altos_device_probe_bootloader (self, error);
/* get version */
- if (priv->kind == FU_ALTOS_DEVICE_KIND_CHAOSKEY) {
+ if (self->kind == FU_ALTOS_DEVICE_KIND_CHAOSKEY) {
const gchar *version_prefix = "ChaosKey-hw-1.0-sw-";
guint8 version_idx;
g_autofree gchar *version = NULL;
@@ -738,7 +575,8 @@
version);
return FALSE;
}
- fu_device_set_version (FU_DEVICE (device), version + 19);
+ fu_device_set_version (FU_DEVICE (self), version + 19,
+ FWUPD_VERSION_FORMAT_TRIPLET);
}
/* success */
@@ -747,23 +585,21 @@
/* now with kind and usb_device set */
static void
-fu_altos_device_init_real (FuAltosDevice *device)
+fu_altos_device_init_real (FuAltosDevice *self)
{
- FuAltosDevicePrivate *priv = GET_PRIVATE (device);
-
/* allowed, but requires manual bootloader step */
- fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
/* set default vendor */
- fu_device_set_vendor (FU_DEVICE (device), "altusmetrum.org");
+ fu_device_set_vendor (FU_DEVICE (self), "altusmetrum.org");
/* set name */
- switch (priv->kind) {
+ switch (self->kind) {
case FU_ALTOS_DEVICE_KIND_BOOTLOADER:
- fu_device_set_name (FU_DEVICE (device), "Altos [bootloader]");
+ fu_device_set_name (FU_DEVICE (self), "Altos [bootloader]");
break;
case FU_ALTOS_DEVICE_KIND_CHAOSKEY:
- fu_device_set_name (FU_DEVICE (device), "Altos ChaosKey");
+ fu_device_set_name (FU_DEVICE (self), "Altos ChaosKey");
break;
default:
g_assert_not_reached ();
@@ -771,16 +607,32 @@
}
/* set one line summary */
- fu_device_set_summary (FU_DEVICE (device),
+ fu_device_set_summary (FU_DEVICE (self),
"A USB hardware random number generator");
/* only the bootloader can do the update */
- if (priv->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
- fu_device_add_flag (FU_DEVICE (device),
+ if (self->kind != FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
+ fu_device_add_flag (FU_DEVICE (self),
FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER);
}
}
+static void
+fu_altos_device_init (FuAltosDevice *self)
+{
+}
+
+static void
+fu_altos_device_class_init (FuAltosDeviceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ klass_device->probe = fu_altos_device_probe;
+ klass_device->write_firmware = fu_altos_device_write_firmware;
+ klass_device->read_firmware = fu_altos_device_read_firmware;
+ object_class->finalize = fu_altos_device_finalize;
+}
+
typedef struct {
guint16 vid;
guint16 pid;
@@ -788,7 +640,7 @@
} FuAltosDeviceVidPid;
FuAltosDevice *
-fu_altos_device_new (GUsbDevice *usb_device)
+fu_altos_device_new (FuUsbDevice *device)
{
const FuAltosDeviceVidPid vidpids[] = {
{ 0xfffe, 0x000a, FU_ALTOS_DEVICE_KIND_BOOTLOADER },
@@ -798,17 +650,13 @@
/* set kind */
for (guint j = 0; vidpids[j].vid != 0x0000; j++) {
- if (g_usb_device_get_vid (usb_device) == vidpids[j].vid &&
- g_usb_device_get_pid (usb_device) == vidpids[j].pid) {
- FuAltosDevice *device;
- FuAltosDevicePrivate *priv;
- device = g_object_new (FU_TYPE_ALTOS_DEVICE,
- "usb-device", usb_device,
- NULL);
- priv = GET_PRIVATE (device);
- priv->kind = vidpids[j].kind;
- fu_altos_device_init_real (device);
- return device;
+ if (fu_usb_device_get_vid (device) == vidpids[j].vid &&
+ fu_usb_device_get_pid (device) == vidpids[j].pid) {
+ FuAltosDevice *self = g_object_new (FU_TYPE_ALTOS_DEVICE, NULL);
+ fu_device_incorporate (FU_DEVICE (self), FU_DEVICE (device));
+ self->kind = vidpids[j].kind;
+ fu_altos_device_init_real (self);
+ return self;
}
}
return NULL;
diff -Nru fwupd-1.0.6/plugins/altos/fu-altos-device.h fwupd-1.2.10/plugins/altos/fu-altos-device.h
--- fwupd-1.0.6/plugins/altos/fu-altos-device.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-altos-device.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,41 +1,17 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_ALTOS_DEVICE_H
-#define __FU_ALTOS_DEVICE_H
-
-#include
-#include
+#pragma once
#include "fu-plugin.h"
G_BEGIN_DECLS
#define FU_TYPE_ALTOS_DEVICE (fu_altos_device_get_type ())
-G_DECLARE_DERIVABLE_TYPE (FuAltosDevice, fu_altos_device, FU, ALTOS_DEVICE, FuUsbDevice)
-
-struct _FuAltosDeviceClass
-{
- FuUsbDeviceClass parent_class;
-};
+G_DECLARE_FINAL_TYPE (FuAltosDevice, fu_altos_device, FU, ALTOS_DEVICE, FuUsbDevice)
typedef enum {
FU_ALTOS_DEVICE_KIND_UNKNOWN,
@@ -52,19 +28,9 @@
FU_ALTOS_DEVICE_WRITE_FIRMWARE_FLAG_LAST
} FuAltosDeviceWriteFirmwareFlag;
-FuAltosDevice *fu_altos_device_new (GUsbDevice *usb_device);
+FuAltosDevice *fu_altos_device_new (FuUsbDevice *device);
FuAltosDeviceKind fu_altos_device_kind_from_string (const gchar *kind);
const gchar *fu_altos_device_kind_to_string (FuAltosDeviceKind kind);
FuAltosDeviceKind fu_altos_device_get_kind (FuAltosDevice *device);
-gboolean fu_altos_device_probe (FuAltosDevice *device,
- GError **error);
-gboolean fu_altos_device_write_firmware (FuAltosDevice *device,
- GBytes *fw,
- FuAltosDeviceWriteFirmwareFlag flags,
- GError **error);
-GBytes *fu_altos_device_read_firmware (FuAltosDevice *device,
- GError **error);
G_END_DECLS
-
-#endif /* __FU_ALTOS_DEVICE_H */
diff -Nru fwupd-1.0.6/plugins/altos/fu-altos-firmware.c fwupd-1.2.10/plugins/altos/fu-altos-firmware.c
--- fwupd-1.0.6/plugins/altos/fu-altos-firmware.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-altos-firmware.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -36,7 +21,10 @@
G_DEFINE_TYPE (FuAltosFirmware, fu_altos_firmware, G_TYPE_OBJECT)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Elf, elf_end);
+#pragma clang diagnostic pop
GBytes *
fu_altos_firmware_get_data (FuAltosFirmware *self)
diff -Nru fwupd-1.0.6/plugins/altos/fu-altos-firmware.h fwupd-1.2.10/plugins/altos/fu-altos-firmware.h
--- fwupd-1.0.6/plugins/altos/fu-altos-firmware.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-altos-firmware.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,28 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_ALTOS_FIRMWARE_H
-#define __FU_ALTOS_FIRMWARE_H
-
-#include
+#pragma once
G_BEGIN_DECLS
@@ -38,5 +20,3 @@
GError **error);
G_END_DECLS
-
-#endif /* __FU_ALTOS_FIRMWARE_H */
diff -Nru fwupd-1.0.6/plugins/altos/fu-altos-tool.c fwupd-1.2.10/plugins/altos/fu-altos-tool.c
--- fwupd-1.0.6/plugins/altos/fu-altos-tool.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-altos-tool.c 1970-01-01 00:00:00.000000000 +0000
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2017 Richard Hughes
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include "fu-altos-device.h"
-
-static void
-fu_altos_tool_progress_cb (FuDevice *device, GParamSpec *pspec, gpointer user_data)
-{
- g_print ("Written %u%%\n", fu_device_get_progress (device));
-}
-
-int
-main (int argc, char **argv)
-{
- gsize len;
- g_autofree guint8 *data = NULL;
- g_autoptr(FuAltosDevice) dev = NULL;
- g_autoptr(GBytes) fw = NULL;
- g_autoptr(GError) error = NULL;
- g_autoptr(GPtrArray) devices = NULL;
- g_autoptr(GUsbContext) usb_ctx = NULL;
-
- g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
-
- /* require filename */
- if (argc != 2) {
- g_print ("USAGE: %s \n", argv[0]);
- return 1;
- }
-
- /* get the device */
- usb_ctx = g_usb_context_new (&error);
- if (usb_ctx == NULL) {
- g_print ("Failed to open USB devices: %s\n", error->message);
- return 1;
- }
- g_usb_context_enumerate (usb_ctx);
- devices = g_usb_context_get_devices (usb_ctx);
- for (guint i = 0; i < devices->len; i++) {
- GUsbDevice *usb_dev_tmp = g_ptr_array_index (devices, i);
- g_autoptr(FuAltosDevice) dev_tmp = fu_altos_device_new (usb_dev_tmp);
- if (dev_tmp == NULL)
- continue;
- if (fu_altos_device_get_kind (dev_tmp) == FU_ALTOS_DEVICE_KIND_BOOTLOADER) {
- dev = g_object_ref (dev_tmp);
- break;
- }
- }
-
- /* nothing supported */
- if (dev == NULL) {
- g_print ("No supported device plugged in!\n");
- return 1;
- }
- g_debug ("found %s",
- fu_altos_device_kind_to_string (fu_altos_device_get_kind (dev)));
-
- /* open device */
- if (!fu_altos_device_probe (dev, &error)) {
- g_print ("Failed to probe device: %s\n", error->message);
- return 1;
- }
- g_print ("Device Firmware Ver: %s\n", fu_device_get_version (FU_DEVICE (dev)));
-
- /* load firmware file */
- if (!g_file_get_contents (argv[1], (gchar **) &data, &len, &error)) {
- g_print ("Failed to load file: %s\n", error->message);
- return 1;
- }
-
- /* update with data blob */
- fw = g_bytes_new (data, len);
- g_signal_connect (dev, "notify::progress",
- G_CALLBACK (fu_altos_tool_progress_cb), NULL);
- if (!fu_altos_device_write_firmware (dev, fw,
- FU_ALTOS_DEVICE_WRITE_FIRMWARE_FLAG_NONE,
- &error)) {
- g_print ("Failed to write firmware: %s\n", error->message);
- return 1;
- }
-
- return 0;
-}
diff -Nru fwupd-1.0.6/plugins/altos/fu-plugin-altos.c fwupd-1.2.10/plugins/altos/fu-plugin-altos.c
--- fwupd-1.0.6/plugins/altos/fu-plugin-altos.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/fu-plugin-altos.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,45 +1,38 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2017 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include "fu-plugin.h"
#include "fu-plugin-vfuncs.h"
#include "fu-altos-device.h"
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "org.altusmetrum.altos");
+}
+
gboolean
-fu_plugin_usb_device_added (FuPlugin *plugin, GUsbDevice *usb_device, GError **error)
+fu_plugin_usb_device_added (FuPlugin *plugin, FuUsbDevice *device, GError **error)
{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (device);
const gchar *platform_id = NULL;
g_autofree gchar *runtime_id = NULL;
g_autoptr(FuAltosDevice) dev = NULL;
/* get kind */
- dev = fu_altos_device_new (usb_device);
+ dev = fu_altos_device_new (device);
if (dev == NULL)
return TRUE;
/* get device properties */
- if (!fu_altos_device_probe (dev, error))
+ if (!fu_device_probe (FU_DEVICE (dev), error))
return FALSE;
/* only the bootloader can do the update */
@@ -51,9 +44,10 @@
if (dev_runtime != NULL) {
const gchar *guid = fu_device_get_guid_default (dev_runtime);
g_debug ("adding runtime GUID of %s", guid);
- fu_device_add_guid (FU_DEVICE (dev), guid);
+ fu_device_add_counterpart_guid (FU_DEVICE (dev), guid);
fu_device_set_version (FU_DEVICE (dev),
- fu_device_get_version (dev_runtime));
+ fu_device_get_version (dev_runtime),
+ fu_device_get_version_format (dev_runtime));
}
} else {
fu_plugin_cache_add (plugin, runtime_id, dev);
@@ -78,8 +72,7 @@
/* get data */
fu_device_set_status (dev, FWUPD_STATUS_DEVICE_VERIFY);
- blob_fw = fu_altos_device_read_firmware (FU_ALTOS_DEVICE (dev),
- error);
+ blob_fw = fu_device_read_firmware (dev, error);
if (blob_fw == NULL)
return FALSE;
for (guint i = 0; checksum_types[i] != 0; i++) {
@@ -98,11 +91,5 @@
GError **error)
{
fu_device_set_status (dev, FWUPD_STATUS_DEVICE_WRITE);
- if (!fu_altos_device_write_firmware (FU_ALTOS_DEVICE (dev),
- blob_fw,
- FU_ALTOS_DEVICE_WRITE_FIRMWARE_FLAG_REBOOT,
- error)) {
- return FALSE;
- }
- return TRUE;
+ return fu_device_write_firmware (dev, blob_fw, flags, error);
}
diff -Nru fwupd-1.0.6/plugins/altos/meson.build fwupd-1.2.10/plugins/altos/meson.build
--- fwupd-1.0.6/plugins/altos/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,6 +1,11 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginAltos"']
+install_data(['altos.quirk'],
+ install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
+)
+
shared_module('fu_plugin_altos',
+ fu_hash,
sources : [
'fu-altos-device.c',
'fu-altos-firmware.c',
@@ -13,34 +18,12 @@
],
install : true,
install_dir: plugin_dir,
- c_args : cargs,
- dependencies : [
- gudev,
- libelf,
- plugin_deps,
- ],
-)
-
-executable(
- 'fu-altos-tool',
- sources : [
- 'fu-altos-device.c',
- 'fu-altos-firmware.c',
- 'fu-altos-tool.c',
- ],
- include_directories : [
- include_directories('../..'),
- include_directories('../../libfwupd'),
- include_directories('../../src'),
+ link_with : [
+ libfwupdprivate,
],
+ c_args : cargs,
dependencies : [
- gudev,
libelf,
plugin_deps,
],
- link_with : [
- fwupd,
- libfwupdprivate,
- ],
- c_args : cargs,
)
diff -Nru fwupd-1.0.6/plugins/altos/README.md fwupd-1.2.10/plugins/altos/README.md
--- fwupd-1.0.6/plugins/altos/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/altos/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -15,6 +15,25 @@
created so userspace can communicate with the hardware. Commands the bootloader
accept are as follows:
+Firmware Format
+---------------
+
+The daemon will decompress the cabinet archive and extract a firmware blob in
+ELF file format. The firmware image is inserted into the `.text` section.
+
+This plugin supports the following protocol ID:
+
+ * org.altusmetrum.altos
+
+GUID Generation
+---------------
+
+These devices use the standard USB DeviceInstanceId values, e.g.
+
+ * `USB\VID_1D50&PID_60C6&REV_0001`
+ * `USB\VID_1D50&PID_60C6`
+ * `USB\VID_1D50`
+
### List Information
Command: `l\n`
diff -Nru fwupd-1.0.6/plugins/amt/fu-plugin-amt.c fwupd-1.2.10/plugins/amt/fu-plugin-amt.c
--- fwupd-1.0.6/plugins/amt/fu-plugin-amt.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/amt/fu-plugin-amt.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,24 +1,9 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+/*
+ * Copyright (C) 2012 Intel Corporation.
* Copyright (C) 2017 Google, Inc.
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
@@ -26,10 +11,9 @@
#include
#include
#include
+#include
#include
-#include
-#include "fu-plugin.h"
#include "fu-plugin-vfuncs.h"
typedef struct {
@@ -101,27 +85,26 @@
return TRUE;
}
-static gssize
+static gboolean
mei_recv_msg (mei_context *ctx, guchar *buffer,
- gssize len, unsigned long timeout, GError **error)
+ gssize len, guint32 *readsz, unsigned long timeout, GError **error)
{
gssize rc;
-
- g_debug ("call read length = %zd", len);
rc = read (ctx->fd, buffer, len);
if (rc < 0) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_READ,
"read failed with status %zd %s",
- rc, strerror(errno));
- } else {
- g_debug ("read succeeded with result %zd", rc);
+ rc, strerror(errno));
+ return FALSE;
}
- return rc;
+ if (readsz != NULL)
+ *readsz = rc;
+ return TRUE;
}
-static gssize
+static gboolean
mei_send_msg (mei_context *ctx, const guchar *buffer,
gssize len, unsigned long timeout, GError **error)
{
@@ -133,7 +116,6 @@
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000000;
- g_debug ("call write length = %zd", len);
written = write (ctx->fd, buffer, len);
if (written < 0) {
g_set_error (error,
@@ -141,16 +123,22 @@
FWUPD_ERROR_WRITE,
"write failed with status %zd %s",
written, strerror(errno));
- return -errno;
+ return FALSE;
+ }
+ if (written != len) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_WRITE,
+ "only wrote %" G_GSSIZE_FORMAT " of %" G_GSSIZE_FORMAT,
+ written, len);
+ return FALSE;
}
FD_ZERO(&set);
FD_SET(ctx->fd, &set);
rc = select (ctx->fd + 1 , &set, NULL, NULL, &tv);
- if (rc > 0 && FD_ISSET(ctx->fd, &set)) {
- g_debug ("write success");
- return written;
- }
+ if (rc > 0 && FD_ISSET(ctx->fd, &set))
+ return TRUE;
/* timed out */
if (rc == 0) {
@@ -158,7 +146,7 @@
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
"write failed on timeout with status");
- return 0;
+ return FALSE;
}
/* rc < 0 */
@@ -166,7 +154,7 @@
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
"write failed on select with status %zd", rc);
- return rc;
+ return FALSE;
}
/***************************************************************************
@@ -269,50 +257,91 @@
mei_context mei_cl;
};
-static guint32
-amt_verify_code_versions (const struct amt_host_if_resp_header *resp)
+static gboolean
+amt_verify_code_versions (const struct amt_host_if_resp_header *resp, GError **error)
{
struct amt_code_versions *code_ver = (struct amt_code_versions *)resp->data;
gsize code_ver_len = resp->header.length - sizeof(guint32);
guint32 ver_type_cnt = code_ver_len -
sizeof(code_ver->bios) -
sizeof(code_ver->count);
- if (code_ver->count != ver_type_cnt / sizeof(struct amt_version_type))
- return AMT_STATUS_INTERNAL_ERROR;
+ if (code_ver->count != ver_type_cnt / sizeof(struct amt_version_type)) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "invalid offset");
+ return FALSE;
+ }
for (guint32 i = 0; i < code_ver->count; i++) {
guint32 len = code_ver->versions[i].description.length;
- if (len > AMT_UNICODE_STRING_LEN)
- return AMT_STATUS_INTERNAL_ERROR;
+ if (len > AMT_UNICODE_STRING_LEN) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "string too large");
+ return FALSE;
+ }
len = code_ver->versions[i].version.length;
if (code_ver->versions[i].version.string[len] != '\0' ||
- len != strlen(code_ver->versions[i].version.string))
- return AMT_STATUS_INTERNAL_ERROR;
+ len != strlen(code_ver->versions[i].version.string)) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "string was invalid size");
+ return FALSE;
+ }
}
- return AMT_STATUS_SUCCESS;
+ return TRUE;
}
-static guint32
-amt_verify_response_header (guint32 command,
- const struct amt_host_if_msg_header *resp_hdr,
- guint32 response_size)
+static gboolean
+amt_status_set_error (guint32 status, GError **error)
{
- if (response_size < sizeof(struct amt_host_if_resp_header)) {
- return AMT_STATUS_INTERNAL_ERROR;
- } else if (response_size != (resp_hdr->length +
- sizeof(struct amt_host_if_msg_header))) {
- return AMT_STATUS_INTERNAL_ERROR;
- } else if (resp_hdr->command != command) {
- return AMT_STATUS_INTERNAL_ERROR;
- } else if (resp_hdr->_reserved != 0) {
- return AMT_STATUS_INTERNAL_ERROR;
- } else if (resp_hdr->version.major != AMT_MAJOR_VERSION ||
- resp_hdr->version.minor < AMT_MINOR_VERSION) {
- return AMT_STATUS_INTERNAL_ERROR;
+ if (status == AMT_STATUS_SUCCESS)
+ return TRUE;
+ if (status == AMT_STATUS_INTERNAL_ERROR) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "internal error");
+ return FALSE;
+ }
+ if (status == AMT_STATUS_NOT_READY) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "not ready");
+ return FALSE;
+ }
+ if (status == AMT_STATUS_INVALID_AMT_MODE) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "invalid AMT mode");
+ return FALSE;
+ }
+ if (status == AMT_STATUS_INVALID_MESSAGE_LENGTH) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "invalid message length");
+ return FALSE;
}
- return AMT_STATUS_SUCCESS;
+ if (status == AMT_STATUS_HOST_IF_EMPTY_RESPONSE) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "Intel AMT is disabled");
+ return FALSE;
+ }
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "unknown error");
+ return FALSE;
}
-static guint32
+static gboolean
amt_host_if_call (mei_context *mei_cl,
const guchar *command,
gssize command_sz,
@@ -324,72 +353,106 @@
{
guint32 in_buf_sz;
guint32 out_buf_sz;
- gssize written;
- guint32 status;
struct amt_host_if_resp_header *msg_hdr;
in_buf_sz = mei_cl->buf_size;
*read_buf = (guint8 *) g_malloc0 (in_buf_sz);
msg_hdr = (struct amt_host_if_resp_header *) *read_buf;
- written = mei_send_msg (mei_cl, command, command_sz, send_timeout, error);
- if (written != command_sz)
- return AMT_STATUS_INTERNAL_ERROR;
-
- out_buf_sz = mei_recv_msg (mei_cl, *read_buf, in_buf_sz, 2000, error);
- if (out_buf_sz <= 0)
- return AMT_STATUS_HOST_IF_EMPTY_RESPONSE;
-
- status = msg_hdr->status;
- if (status != AMT_STATUS_SUCCESS)
- return status;
-
- status = amt_verify_response_header(rcmd, &msg_hdr->header, out_buf_sz);
- if (status != AMT_STATUS_SUCCESS)
- return status;
-
- if (expected_sz && expected_sz != out_buf_sz)
- return AMT_STATUS_INTERNAL_ERROR;
-
- return AMT_STATUS_SUCCESS;
+ if (!mei_send_msg (mei_cl, command, command_sz, send_timeout, error))
+ return FALSE;
+ if (!mei_recv_msg (mei_cl, *read_buf, in_buf_sz, &out_buf_sz, 2000, error))
+ return FALSE;
+ if (out_buf_sz <= 0) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "empty response");
+ return FALSE;
+ }
+ if (expected_sz && expected_sz != out_buf_sz) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_WRITE,
+ "expected %u but got %" G_GUINT32_FORMAT,
+ expected_sz, out_buf_sz);
+ return FALSE;
+ }
+ if (!amt_status_set_error (msg_hdr->status, error))
+ return FALSE;
+ if (out_buf_sz < sizeof(struct amt_host_if_resp_header)) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "invalid response: too small");
+ return FALSE;
+ }
+ if (out_buf_sz != (msg_hdr->header.length +
+ sizeof(struct amt_host_if_msg_header))) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "invalid response: headerlen");
+ return FALSE;
+ }
+ if (msg_hdr->header.command != rcmd) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "invalid response: rcmd");
+ return FALSE;
+ }
+ if (msg_hdr->header._reserved != 0) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "invalid response: reserved");
+ return FALSE;
+ }
+ if (msg_hdr->header.version.major != AMT_MAJOR_VERSION ||
+ msg_hdr->header.version.minor < AMT_MINOR_VERSION) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "invalid response: version");
+ return FALSE;
+ }
+ return TRUE;
}
-static guint32
+static gboolean
amt_get_provisioning_state (mei_context *mei_cl, guint8 *state, GError **error)
{
g_autofree struct amt_host_if_resp_header *response = NULL;
- guint32 status;
-
- status = amt_host_if_call (mei_cl,
- (const guchar *)&PROVISIONING_STATE_REQUEST,
- sizeof(PROVISIONING_STATE_REQUEST),
- (guint8 **)&response,
- AMT_HOST_IF_PROVISIONING_STATE_RESPONSE, 0,
- 5000, error);
- if (status != AMT_STATUS_SUCCESS) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "Unable to get provisioning state");
+ if (!amt_host_if_call (mei_cl,
+ (const guchar *)&PROVISIONING_STATE_REQUEST,
+ sizeof(PROVISIONING_STATE_REQUEST),
+ (guint8 **)&response,
+ AMT_HOST_IF_PROVISIONING_STATE_RESPONSE, 0,
+ 5000, error)) {
+ g_prefix_error (error, "unable to get provisioning state: ");
return FALSE;
}
-
*state = response->data[0];
return TRUE;
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
G_DEFINE_AUTOPTR_CLEANUP_FUNC(mei_context, mei_context_free)
+#pragma clang diagnostic pop
static FuDevice *
fu_plugin_amt_create_device (GError **error)
{
- gchar guid_buf[37];
- guint32 status;
guint8 state;
struct amt_code_versions ver;
- uuid_t uu;
+ fwupd_guid_t uu;
+ g_autofree gchar *guid_buf = NULL;
g_autofree struct amt_host_if_resp_header *response = NULL;
g_autoptr(FuDevice) dev = NULL;
+ g_autoptr(GString) version_bl = g_string_new (NULL);
+ g_autoptr(GString) version_fw = g_string_new (NULL);
g_autoptr(mei_context) ctx = g_new0 (mei_context, 1);
const uuid_le MEI_IAMTHIF = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, \
@@ -400,37 +463,28 @@
return NULL;
/* check version */
- status = amt_host_if_call (ctx,
- (const guchar *) &CODE_VERSION_REQ,
- sizeof(CODE_VERSION_REQ),
- (guint8 **) &response,
- AMT_HOST_IF_CODE_VERSIONS_RESPONSE, 0,
- 5000,
- error);
- if (status != AMT_STATUS_SUCCESS)
- return NULL;
- status = amt_verify_code_versions (response);
- if (status == AMT_STATUS_HOST_IF_EMPTY_RESPONSE) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "Intel AMT is disabled");
+ if (!amt_host_if_call (ctx,
+ (const guchar *) &CODE_VERSION_REQ,
+ sizeof(CODE_VERSION_REQ),
+ (guint8 **) &response,
+ AMT_HOST_IF_CODE_VERSIONS_RESPONSE, 0,
+ 5000,
+ error)) {
+ g_prefix_error (error, "Failed to check version: ");
return NULL;
}
- if (status != AMT_STATUS_SUCCESS) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "Failed to verify code versions");
+ if (!amt_verify_code_versions (response, error)) {
+ g_prefix_error (error, "failed to verify code versions: ");
return NULL;
}
memcpy (&ver, response->data, sizeof(struct amt_code_versions));
dev = fu_device_new ();
- fu_device_set_id (dev, "/dev/mei");
+ fu_device_set_id (dev, "/dev/mei0");
fu_device_set_vendor (dev, "Intel Corporation");
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
fu_device_add_icon (dev, "computer");
+ fu_device_add_parent_guid (dev, "main-system-firmware");
if (!amt_get_provisioning_state (ctx, &state, error))
return NULL;
switch (state) {
@@ -452,24 +506,44 @@
/* add guid */
memcpy (&uu, &ctx->guid, 16);
- uuid_unparse (uu, guid_buf);
+ guid_buf = fwupd_guid_to_string ((const fwupd_guid_t *) &uu, FWUPD_GUID_FLAG_NONE);
fu_device_add_guid (dev, guid_buf);
/* get version numbers */
for (guint i = 0; i < ver.count; i++) {
if (g_strcmp0 (ver.versions[i].description.string, "AMT") == 0) {
- fu_device_set_version (dev, ver.versions[i].version.string);
+ g_string_append (version_fw, ver.versions[i].version.string);
+ continue;
+ }
+ if (g_strcmp0 (ver.versions[i].description.string, "Recovery Version") == 0) {
+ g_string_append (version_bl, ver.versions[i].version.string);
+ continue;
+ }
+ if (g_strcmp0 (ver.versions[i].description.string, "Build Number") == 0) {
+ g_string_append_printf (version_fw, ".%s",
+ ver.versions[i].version.string);
continue;
}
- if (g_strcmp0 (ver.versions[i].description.string,
- "Recovery Version") == 0) {
- fu_device_set_version_bootloader (dev, ver.versions[i].version.string);
+ if (g_strcmp0 (ver.versions[i].description.string, "Recovery Build Num") == 0) {
+ g_string_append_printf (version_bl, ".%s",
+ ver.versions[i].version.string);
continue;
}
}
+ if (version_fw->len > 0)
+ fu_device_set_version (dev, version_fw->str, FWUPD_VERSION_FORMAT_INTEL_ME);
+ if (version_bl->len > 0)
+ fu_device_set_version_bootloader (dev, version_bl->str);
+
return g_steal_pointer (&dev);
}
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+}
+
gboolean
fu_plugin_coldplug (FuPlugin *plugin, GError **error)
{
diff -Nru fwupd-1.0.6/plugins/amt/meson.build fwupd-1.2.10/plugins/amt/meson.build
--- fwupd-1.0.6/plugins/amt/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/amt/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,6 +1,7 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginAmt"']
shared_module('fu_plugin_amt',
+ fu_hash,
sources : [
'fu-plugin-amt.c',
],
@@ -11,9 +12,11 @@
],
install : true,
install_dir: plugin_dir,
+ link_with : [
+ libfwupdprivate,
+ ],
c_args : cargs,
dependencies : [
plugin_deps,
- uuid,
],
)
diff -Nru fwupd-1.0.6/plugins/amt/README.md fwupd-1.2.10/plugins/amt/README.md
--- fwupd-1.0.6/plugins/amt/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/amt/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -15,3 +15,8 @@
That tool in turn is heavily based on mei-amt-version from samples/mei in the
Linux source tree and copyright Intel Corporation.
+
+GUID Generation
+---------------
+
+These devices use the existing GUID provided by the AMT host interface.
diff -Nru fwupd-1.0.6/plugins/ata/ata.quirk fwupd-1.2.10/plugins/ata/ata.quirk
--- fwupd-1.0.6/plugins/ata/ata.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/ata.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+
diff -Nru fwupd-1.0.6/plugins/ata/fu-ata-device.c fwupd-1.2.10/plugins/ata/fu-ata-device.c
--- fwupd-1.0.6/plugins/ata/fu-ata-device.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/fu-ata-device.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,728 @@
+/*
+ * Copyright (C) 2019 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include "config.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "fu-ata-device.h"
+#include "fu-chunk.h"
+
+#define FU_ATA_IDENTIFY_SIZE 512 /* bytes */
+#define FU_ATA_BLOCK_SIZE 512 /* bytes */
+
+struct ata_tf {
+ guint8 dev;
+ guint8 command;
+ guint8 error;
+ guint8 status;
+ guint8 feat;
+ guint8 nsect;
+ guint8 lbal;
+ guint8 lbam;
+ guint8 lbah;
+};
+
+#define ATA_USING_LBA (1 << 6)
+#define ATA_STAT_DRQ (1 << 3)
+#define ATA_STAT_ERR (1 << 0)
+
+#define ATA_OP_IDENTIFY 0xec
+#define ATA_OP_FLUSH_CACHE 0xe7
+#define ATA_OP_DOWNLOAD_MICROCODE 0x92
+#define ATA_OP_STANDBY_IMMEDIATE 0xe0
+
+#define ATA_SUBCMD_MICROCODE_OBSOLETE 0x01
+#define ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS_ACTIVATE 0x03
+#define ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNK 0x07
+#define ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS 0x0e
+#define ATA_SUBCMD_MICROCODE_ACTIVATE 0x0f
+
+#define SG_CHECK_CONDITION 0x02
+#define SG_DRIVER_SENSE 0x08
+
+#define SG_ATA_12 0xa1
+#define SG_ATA_12_LEN 12
+
+#define SG_ATA_PROTO_NON_DATA (3 << 1)
+#define SG_ATA_PROTO_PIO_IN (4 << 1)
+#define SG_ATA_PROTO_PIO_OUT (5 << 1)
+
+enum {
+ SG_CDB2_TLEN_NODATA = 0 << 0,
+ SG_CDB2_TLEN_FEAT = 1 << 0,
+ SG_CDB2_TLEN_NSECT = 2 << 0,
+
+ SG_CDB2_TLEN_BYTES = 0 << 2,
+ SG_CDB2_TLEN_SECTORS = 1 << 2,
+
+ SG_CDB2_TDIR_TO_DEV = 0 << 3,
+ SG_CDB2_TDIR_FROM_DEV = 1 << 3,
+
+ SG_CDB2_CHECK_COND = 1 << 5,
+};
+
+struct _FuAtaDevice {
+ FuUdevDevice parent_instance;
+ guint pci_depth;
+ guint usb_depth;
+ gint fd;
+ guint16 transfer_blocks;
+ guint8 transfer_mode;
+};
+
+G_DEFINE_TYPE (FuAtaDevice, fu_ata_device, FU_TYPE_UDEV_DEVICE)
+
+#ifndef HAVE_GUDEV_232
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevDevice, g_object_unref)
+#pragma clang diagnostic pop
+#endif
+
+guint8
+fu_ata_device_get_transfer_mode (FuAtaDevice *self)
+{
+ return self->transfer_mode;
+}
+
+guint16
+fu_ata_device_get_transfer_blocks (FuAtaDevice *self)
+{
+ return self->transfer_blocks;
+}
+
+static gchar *
+fu_ata_device_get_string (const guint16 *buf, guint start, guint end)
+{
+ g_autoptr(GString) str = g_string_new (NULL);
+ for (guint i = start; i <= end; i++) {
+ g_string_append_c (str, (gchar) (buf[i] >> 8));
+ g_string_append_c (str, (gchar) (buf[i] & 0xff));
+ }
+
+ /* remove whitespace before returning */
+ if (str->len > 0) {
+ g_strstrip (str->str);
+ if (str->str[0] == '\0')
+ return NULL;
+ }
+ return g_string_free (g_steal_pointer (&str), FALSE);
+}
+
+static void
+fu_ata_device_to_string (FuDevice *device, GString *str)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ g_string_append (str, " FuAtaDevice:\n");
+ g_string_append_printf (str, " fd:\t\t\t%i\n", self->fd);
+ g_string_append_printf (str, " transfer-mode:\t0x%x\n", (guint) self->transfer_mode);
+ g_string_append_printf (str, " transfer-size:\t0x%x\n", (guint) self->transfer_blocks);
+ g_string_append_printf (str, " pci-depth:\t\t%u\n", self->pci_depth);
+ g_string_append_printf (str, " usb-depth:\t\t%u\n", self->usb_depth);
+}
+
+/* https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-ide-devices */
+static gchar *
+fu_ata_device_pad_string_for_id (const gchar *name)
+{
+ GString *str = g_string_new (name);
+ fu_common_string_replace (str, " ", "_");
+ for (guint i = str->len; i < 40; i++)
+ g_string_append_c (str, '_');
+ return g_string_free (str, FALSE);
+}
+
+static gchar *
+fu_ata_device_get_guid_safe (const guint16 *buf, guint16 addr_start)
+{
+ if (!fu_common_guid_is_plausible ((guint8 *) (buf + addr_start)))
+ return NULL;
+ return fwupd_guid_to_string ((const fwupd_guid_t *) (buf + addr_start),
+ FWUPD_GUID_FLAG_MIXED_ENDIAN);
+}
+
+static void
+fu_ata_device_parse_id_maybe_dell (FuAtaDevice *self, const guint16 *buf)
+{
+ g_autofree gchar *component_id = NULL;
+ g_autofree gchar *guid_efi = NULL;
+ g_autofree gchar *guid_id = NULL;
+ g_autofree gchar *guid = NULL;
+
+ /* add extra component ID if set */
+ component_id = fu_ata_device_get_string (buf, 137, 140);
+ if (component_id == NULL ||
+ !g_str_is_ascii (component_id) ||
+ strlen (component_id) < 6) {
+ g_debug ("invalid component ID, skipping");
+ return;
+ }
+
+ /* do not add the FuUdevDevice instance IDs as generic firmware
+ * should not be used on these OEM-specific devices */
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_NO_AUTO_INSTANCE_IDS);
+
+ /* add instance ID *and* GUID as using no-auto-instance-ids */
+ guid_id = g_strdup_printf ("STORAGE-DELL-%s", component_id);
+ fu_device_add_instance_id (FU_DEVICE (self), guid_id);
+ guid = fwupd_guid_hash_string (guid_id);
+ fu_device_add_guid (FU_DEVICE (self), guid);
+
+ /* also add the EFI GUID */
+ guid_efi = fu_ata_device_get_guid_safe (buf, 129);
+ if (guid_efi != NULL)
+ fu_device_add_guid (FU_DEVICE (self), guid_efi);
+}
+
+static gboolean
+fu_ata_device_parse_id (FuAtaDevice *self, const guint8 *buf, gsize sz, GError **error)
+{
+ FuDevice *device = FU_DEVICE (self);
+ guint16 xfer_min = 1;
+ guint16 xfer_max = 0xffff;
+ guint16 id[FU_ATA_IDENTIFY_SIZE/2];
+ g_autofree gchar *name_pad = NULL;
+ g_autofree gchar *sku = NULL;
+
+ /* check size */
+ if (sz != FU_ATA_IDENTIFY_SIZE) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "ID incorrect size, got 0x%02x",
+ (guint) sz);
+ return FALSE;
+ }
+
+ /* read LE buffer */
+ for (guint i = 0; i < sz / 2; i++)
+ id[i] = fu_common_read_uint16 (buf + (i * 2), G_LITTLE_ENDIAN);
+
+ /* verify drive correctly supports DOWNLOAD_MICROCODE */
+ if (!(id[83] & 1 && id[86] & 1)) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "DOWNLOAD_MICROCODE not supported by device");
+ return FALSE;
+ }
+
+ fu_ata_device_parse_id_maybe_dell (self, id);
+
+ /* firmware will be applied when the device restarts */
+ if (self->transfer_mode == ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS)
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
+
+ /* the newer, segmented transfer mode */
+ if (self->transfer_mode == ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS_ACTIVATE ||
+ self->transfer_mode == ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS) {
+ xfer_min = id[234];
+ if (xfer_min == 0x0 || xfer_min == 0xffff)
+ xfer_min = 1;
+ xfer_max = id[235];
+ if (xfer_max == 0x0 || xfer_max == 0xffff)
+ xfer_max = xfer_min;
+ }
+
+ /* fall back to a sane block size */
+ if (self->transfer_blocks == 0x0)
+ self->transfer_blocks = xfer_min;
+ else if (self->transfer_blocks == 0xffff)
+ self->transfer_blocks = xfer_max;
+
+ /* get values in case the kernel didn't */
+ if (fu_device_get_serial (device) == NULL) {
+ g_autofree gchar *tmp = NULL;
+ tmp = fu_ata_device_get_string (id, 10, 19);
+ if (tmp != NULL)
+ fu_device_set_serial (device, tmp);
+ }
+ if (fu_device_get_name (device) == NULL) {
+ g_autofree gchar *tmp = NULL;
+ tmp = fu_ata_device_get_string (id, 27, 46);
+ if (tmp != NULL)
+ fu_device_set_name (device, tmp);
+ }
+ if (fu_device_get_version (device) == NULL) {
+ g_autofree gchar *tmp = NULL;
+ tmp = fu_ata_device_get_string (id, 23, 26);
+ if (tmp != NULL)
+ fu_device_set_version (device, tmp, FWUPD_VERSION_FORMAT_PLAIN);
+ } else {
+ fu_device_set_version_format (device, FWUPD_VERSION_FORMAT_PLAIN);
+ }
+
+ /* 8 byte additional product identifier == SKU? */
+ sku = fu_ata_device_get_string (id, 170, 173);
+ if (sku != NULL)
+ g_debug ("SKU=%s", sku);
+
+ /* if we have vendor defined identify blocks don't add generic GUID */
+ if (fu_device_get_guids (device)->len != 0)
+ return TRUE;
+
+ /* add extra GUIDs if none detected from identify block */
+ name_pad = fu_ata_device_pad_string_for_id (fu_device_get_name (device));
+ if (name_pad != NULL &&
+ fu_device_get_version (device) != NULL) {
+ g_autofree gchar *tmp = NULL;
+ tmp = g_strdup_printf ("IDE\\%s%s", name_pad,
+ fu_device_get_version (device));
+ fu_device_add_instance_id (device, tmp);
+ }
+ if (name_pad != NULL) {
+ g_autofree gchar *tmp = NULL;
+ tmp = g_strdup_printf ("IDE\\0%s", name_pad);
+ fu_device_add_instance_id (device, tmp);
+ }
+
+ /* add the name fallback */
+ fu_device_add_instance_id (device, fu_device_get_name (device));
+
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_open (FuDevice *device, GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ GUdevDevice *udev_device = fu_udev_device_get_dev (FU_UDEV_DEVICE (device));
+
+ /* open device */
+ self->fd = g_open (g_udev_device_get_device_file (udev_device), O_RDONLY);
+ if (self->fd < 0) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "failed to open %s: %s",
+ g_udev_device_get_device_file (udev_device),
+ strerror (errno));
+ return FALSE;
+ }
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_probe (FuUdevDevice *device, GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+
+ /* set the physical ID */
+ if (!fu_udev_device_set_physical_id (device, "scsi", error))
+ return FALSE;
+
+ /* look at the PCI and USB depth to work out if in an external enclosure */
+ self->pci_depth = fu_udev_device_get_slot_depth (device, "pci");
+ self->usb_depth = fu_udev_device_get_slot_depth (device, "usb");
+ if (self->pci_depth <= 2 && self->usb_depth <= 2)
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_INTERNAL);
+
+ return TRUE;
+}
+
+static guint64
+fu_ata_device_tf_to_pack_id (struct ata_tf *tf)
+{
+ guint32 lba24 = (tf->lbah << 16) | (tf->lbam << 8) | (tf->lbal);
+ guint32 lbah = tf->dev & 0x0f;
+ return (((guint64) lbah) << 24) | (guint64) lba24;
+}
+
+static gboolean
+fu_ata_device_command (FuAtaDevice *self, struct ata_tf *tf,
+ gint dxfer_direction, guint timeout_ms,
+ guint8 *dxferp, gsize dxfer_len, GError **error)
+{
+ guint8 cdb[SG_ATA_12_LEN] = { 0x0 };
+ guint8 sb[32] = { 0x0 };
+ sg_io_hdr_t io_hdr = { 0x0 };
+
+ /* map _TO_DEV to PIO mode */
+ if (dxfer_direction == SG_DXFER_TO_DEV)
+ cdb[1] = SG_ATA_PROTO_PIO_OUT;
+ else if (dxfer_direction == SG_DXFER_FROM_DEV)
+ cdb[1] = SG_ATA_PROTO_PIO_IN;
+ else
+ cdb[1] = SG_ATA_PROTO_NON_DATA;
+
+ /* libata workaround: don't demand sense data for IDENTIFY */
+ if (dxfer_len > 0) {
+ cdb[2] |= SG_CDB2_TLEN_NSECT | SG_CDB2_TLEN_SECTORS;
+ cdb[2] |= dxfer_direction == SG_DXFER_TO_DEV ? SG_CDB2_TDIR_TO_DEV : SG_CDB2_TDIR_FROM_DEV;
+ } else {
+ cdb[2] = SG_CDB2_CHECK_COND;
+ }
+
+ /* populate non-LBA48 CDB */
+ cdb[0] = SG_ATA_12;
+ cdb[3] = tf->feat;
+ cdb[4] = tf->nsect;
+ cdb[5] = tf->lbal;
+ cdb[6] = tf->lbam;
+ cdb[7] = tf->lbah;
+ cdb[8] = tf->dev;
+ cdb[9] = tf->command;
+ fu_common_dump_raw (G_LOG_DOMAIN, "CBD", cdb, sizeof(cdb));
+ if (dxfer_direction == SG_DXFER_TO_DEV && dxferp != NULL) {
+ fu_common_dump_raw (G_LOG_DOMAIN, "outgoing_data",
+ dxferp, dxfer_len);
+ }
+
+ /* hit hardware */
+ io_hdr.interface_id = 'S';
+ io_hdr.mx_sb_len = sizeof(sb);
+ io_hdr.dxfer_direction = dxfer_direction;
+ io_hdr.dxfer_len = dxfer_len;
+ io_hdr.dxferp = dxferp;
+ io_hdr.cmdp = cdb;
+ io_hdr.cmd_len = SG_ATA_12_LEN;
+ io_hdr.sbp = sb;
+ io_hdr.pack_id = fu_ata_device_tf_to_pack_id (tf);
+ io_hdr.timeout = timeout_ms;
+ if (ioctl (self->fd, SG_IO, &io_hdr) == -1) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "SG_IO not supported: %s",
+ strerror (errno));
+ return FALSE;
+ }
+ g_debug ("ATA_%u status=0x%x, host_status=0x%x, driver_status=0x%x",
+ io_hdr.cmd_len, io_hdr.status, io_hdr.host_status, io_hdr.driver_status);
+ fu_common_dump_raw (G_LOG_DOMAIN, "SB", sb, sizeof(sb));
+
+ /* error check */
+ if (io_hdr.status && io_hdr.status != SG_CHECK_CONDITION) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "bad status: 0x%x", io_hdr.status);
+ return FALSE;
+ }
+ if (io_hdr.host_status) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "bad host status: 0x%x", io_hdr.host_status);
+ return FALSE;
+ }
+ if (io_hdr.driver_status && (io_hdr.driver_status != SG_DRIVER_SENSE)) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "bad driver status: 0x%x", io_hdr.driver_status);
+ return FALSE;
+ }
+
+ /* repopulate ata_tf */
+ tf->error = sb[8 + 3];
+ tf->nsect = sb[8 + 5];
+ tf->lbal = sb[8 + 7];
+ tf->lbam = sb[8 + 9];
+ tf->lbah = sb[8 + 11];
+ tf->dev = sb[8 + 12];
+ tf->status = sb[8 + 13];
+ g_debug ("ATA_%u stat=%02x err=%02x nsect=%02x lbal=%02x lbam=%02x lbah=%02x dev=%02x",
+ io_hdr.cmd_len, tf->status, tf->error, tf->nsect, tf->lbal, tf->lbam, tf->lbah, tf->dev);
+
+ /* io error */
+ if (tf->status & (ATA_STAT_ERR | ATA_STAT_DRQ)) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "I/O error, ata_op=0x%02x ata_status=0x%02x ata_error=0x%02x",
+ tf->command, tf->status, tf->error);
+ return FALSE;
+ }
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_setup (FuDevice *device, GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ struct ata_tf tf = { 0x0 };
+ guint8 id[FU_ATA_IDENTIFY_SIZE];
+
+ /* get ID block */
+ tf.dev = ATA_USING_LBA;
+ tf.command = ATA_OP_IDENTIFY;
+ tf.nsect = 1; /* 512 bytes */
+ if (!fu_ata_device_command (self, &tf, SG_DXFER_FROM_DEV, 1000,
+ id, sizeof(id), error)) {
+ g_prefix_error (error, "failed to IDENTIFY");
+ return FALSE;
+ }
+ if (!fu_ata_device_parse_id (self, id, sizeof(id), error))
+ return FALSE;
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_activate (FuDevice *device, GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ struct ata_tf tf = { 0x0 };
+
+
+ /* flush cache and put drive in standby to prepare to activate */
+ tf.dev = ATA_USING_LBA;
+ tf.command = ATA_OP_FLUSH_CACHE;
+ if (!fu_ata_device_command (self, &tf, SG_DXFER_NONE,
+ 120 * 1000, /* a long time! */
+ NULL, 0, error)) {
+ g_prefix_error (error, "failed to flush cache immediate: ");
+ return FALSE;
+ }
+ tf.command = ATA_OP_STANDBY_IMMEDIATE;
+ if (!fu_ata_device_command (self, &tf, SG_DXFER_NONE,
+ 120 * 1000, /* a long time! */
+ NULL, 0, error)) {
+ g_prefix_error (error, "failed to standby immediate: ");
+ return FALSE;
+ }
+
+ /* load the new firmware */
+ tf.dev = 0xa0 | ATA_USING_LBA;
+ tf.command = ATA_OP_DOWNLOAD_MICROCODE;
+ tf.feat = ATA_SUBCMD_MICROCODE_ACTIVATE;
+ if (!fu_ata_device_command (self, &tf, SG_DXFER_NONE,
+ 120 * 1000, /* a long time! */
+ NULL, 0, error)) {
+ g_prefix_error (error, "failed to activate firmware: ");
+ return FALSE;
+ }
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_close (FuDevice *device, GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ if (!g_close (self->fd, error))
+ return FALSE;
+ self->fd = 0;
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_fw_download (FuAtaDevice *self,
+ guint32 idx,
+ guint32 addr,
+ const guint8 *data,
+ guint32 data_sz,
+ GError **error)
+{
+ struct ata_tf tf = { 0x0 };
+ guint32 block_count = data_sz / FU_ATA_BLOCK_SIZE;
+ guint32 buffer_offset = addr / FU_ATA_BLOCK_SIZE;
+
+ /* write block */
+ tf.dev = 0xa0 | ATA_USING_LBA;
+ tf.command = ATA_OP_DOWNLOAD_MICROCODE;
+ tf.feat = self->transfer_mode;
+ tf.nsect = block_count & 0xff;
+ tf.lbal = block_count >> 8;
+ tf.lbam = buffer_offset & 0xff;
+ tf.lbah = buffer_offset >> 8;
+ if (!fu_ata_device_command (self, &tf, SG_DXFER_TO_DEV,
+ 120 * 1000, /* a long time! */
+ (guint8 *) data, data_sz, error)) {
+ g_prefix_error (error, "failed to write firmware @0x%0x",
+ (guint) addr);
+ return FALSE;
+ }
+
+ /* check drive status */
+ if (tf.nsect == 0x0)
+ return TRUE;
+
+ /* drive wants more data, or thinks it is all done */
+ if (tf.nsect == 0x1 || tf.nsect == 0x2)
+ return TRUE;
+
+ /* the offset was set up incorrectly */
+ if (tf.nsect == 0x4) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "alignment error");
+ return FALSE;
+ }
+
+ /* other error */
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "unknown return code 0x%02x",
+ tf.nsect);
+ return FALSE;
+}
+
+static gboolean
+fu_ata_device_write_firmware (FuDevice *device,
+ GBytes *fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ guint32 chunksz = (guint32) self->transfer_blocks * FU_ATA_BLOCK_SIZE;
+ guint max_size = 0xffff * FU_ATA_BLOCK_SIZE;
+ g_autoptr(GPtrArray) chunks = NULL;
+
+ /* only one block allowed */
+ if (self->transfer_mode == ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNK)
+ max_size = 0xffff;
+
+ /* check is valid */
+ if (g_bytes_get_size (fw) > max_size) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "firmware is too large, maximum size is %u",
+ max_size);
+ return FALSE;
+ }
+ if (g_bytes_get_size (fw) % FU_ATA_BLOCK_SIZE != 0) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "firmware is not multiple of block size %i",
+ FU_ATA_BLOCK_SIZE);
+ return FALSE;
+ }
+
+ /* write each block */
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ chunks = fu_chunk_array_new_from_bytes (fw, 0x00, 0x00, chunksz);
+ for (guint i = 0; i < chunks->len; i++) {
+ FuChunk *chk = g_ptr_array_index (chunks, i);
+ if (!fu_ata_device_fw_download (self,
+ chk->idx,
+ chk->address,
+ chk->data,
+ chk->data_sz,
+ error)) {
+ g_prefix_error (error, "failed to write chunk %u: ", i);
+ return FALSE;
+ }
+ fu_device_set_progress_full (device, (gsize) i, (gsize) chunks->len + 1);
+ }
+
+ /* success! */
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION);
+ fu_device_set_progress (device, 100);
+ return TRUE;
+}
+
+static gboolean
+fu_ata_device_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuAtaDevice *self = FU_ATA_DEVICE (device);
+ if (g_strcmp0 (key, "AtaTransferMode") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp != ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS_ACTIVATE &&
+ tmp != ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS &&
+ tmp != ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNK) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "AtaTransferMode only supports "
+ "values 0x3, 0x7 or 0xe");
+ return FALSE;
+ }
+ self->transfer_mode = (guint8) tmp;
+ return TRUE;
+ }
+ if (g_strcmp0 (key, "AtaTransferBlocks") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp > 0xffff) {
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "AtaTransferBlocks only supports "
+ "values <= 0xffff");
+ return FALSE;
+ }
+ self->transfer_blocks = (guint16) tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+static void
+fu_ata_device_init (FuAtaDevice *self)
+{
+ /* we chose this default as _DOWNLOAD_CHUNKS_ACTIVATE applies the
+ * firmware straight away and the kernel might not like the unexpected
+ * ATA restart and panic */
+ self->transfer_mode = ATA_SUBCMD_MICROCODE_DOWNLOAD_CHUNKS;
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_REQUIRE_AC);
+ fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
+ fu_device_set_summary (FU_DEVICE (self), "ATA Drive");
+ fu_device_add_icon (FU_DEVICE (self), "drive-harddisk");
+}
+
+static void
+fu_ata_device_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (fu_ata_device_parent_class)->finalize (object);
+}
+
+static void
+fu_ata_device_class_init (FuAtaDeviceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ FuUdevDeviceClass *klass_udev_device = FU_UDEV_DEVICE_CLASS (klass);
+ object_class->finalize = fu_ata_device_finalize;
+ klass_device->to_string = fu_ata_device_to_string;
+ klass_device->set_quirk_kv = fu_ata_device_set_quirk_kv;
+ klass_device->open = fu_ata_device_open;
+ klass_device->setup = fu_ata_device_setup;
+ klass_device->activate = fu_ata_device_activate;
+ klass_device->close = fu_ata_device_close;
+ klass_device->write_firmware = fu_ata_device_write_firmware;
+ klass_udev_device->probe = fu_ata_device_probe;
+}
+
+FuAtaDevice *
+fu_ata_device_new (FuUdevDevice *device)
+{
+ FuAtaDevice *self = g_object_new (FU_TYPE_ATA_DEVICE, NULL);
+ fu_device_incorporate (FU_DEVICE (self), FU_DEVICE (device));
+ return self;
+}
+
+FuAtaDevice *
+fu_ata_device_new_from_blob (const guint8 *buf, gsize sz, GError **error)
+{
+ g_autoptr(FuAtaDevice) self = g_object_new (FU_TYPE_ATA_DEVICE, NULL);
+ if (!fu_ata_device_parse_id (self, buf, sz, error))
+ return NULL;
+ return g_steal_pointer (&self);
+}
diff -Nru fwupd-1.0.6/plugins/ata/fu-ata-device.h fwupd-1.2.10/plugins/ata/fu-ata-device.h
--- fwupd-1.0.6/plugins/ata/fu-ata-device.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/fu-ata-device.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2019 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#pragma once
+
+#include "fu-plugin.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_ATA_DEVICE (fu_ata_device_get_type ())
+G_DECLARE_FINAL_TYPE (FuAtaDevice, fu_ata_device, FU, ATA_DEVICE, FuUdevDevice)
+
+FuAtaDevice *fu_ata_device_new (FuUdevDevice *device);
+FuAtaDevice *fu_ata_device_new_from_blob (const guint8 *buf,
+ gsize sz,
+ GError **error);
+
+/* for self tests */
+guint8 fu_ata_device_get_transfer_mode (FuAtaDevice *self);
+guint16 fu_ata_device_get_transfer_blocks (FuAtaDevice *self);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/ata/fu-plugin-ata.c fwupd-1.2.10/plugins/ata/fu-plugin-ata.c
--- fwupd-1.0.6/plugins/ata/fu-plugin-ata.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/fu-plugin-ata.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include "config.h"
+
+#include "fu-plugin-vfuncs.h"
+
+#include "fu-ata-device.h"
+
+gboolean
+fu_plugin_udev_device_added (FuPlugin *plugin, FuUdevDevice *device, GError **error)
+{
+ GUdevDevice *udev_device = fu_udev_device_get_dev (device);
+ g_autoptr(FuAtaDevice) dev = NULL;
+ g_autoptr(FuDeviceLocker) locker = NULL;
+
+ /* interesting device? */
+ if (udev_device == NULL)
+ return TRUE;
+ if (g_strcmp0 (g_udev_device_get_subsystem (udev_device), "block") != 0)
+ return TRUE;
+ if (g_strcmp0 (g_udev_device_get_devtype (udev_device), "disk") != 0)
+ return TRUE;
+ if (!g_udev_device_get_property_as_boolean (udev_device, "ID_ATA_SATA"))
+ return TRUE;
+ if (!g_udev_device_get_property_as_boolean (udev_device, "ID_ATA_DOWNLOAD_MICROCODE"))
+ return TRUE;
+
+ dev = fu_ata_device_new (device);
+ locker = fu_device_locker_new (dev, error);
+ if (locker == NULL)
+ return FALSE;
+ fu_plugin_device_add (plugin, FU_DEVICE (dev));
+ return TRUE;
+}
+
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+ fu_plugin_add_udev_subsystem (plugin, "block");
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "org.t13.ata");
+}
+
+gboolean
+fu_plugin_update (FuPlugin *plugin,
+ FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+ locker = fu_device_locker_new (device, error);
+ if (locker == NULL)
+ return FALSE;
+ return fu_device_write_firmware (device, blob_fw, flags, error);
+}
+
+gboolean
+fu_plugin_activate (FuPlugin *plugin, FuDevice *device, GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+ locker = fu_device_locker_new (device, error);
+ if (locker == NULL)
+ return FALSE;
+ return fu_device_activate (device, error);
+}
diff -Nru fwupd-1.0.6/plugins/ata/fu-self-test.c fwupd-1.2.10/plugins/ata/fu-self-test.c
--- fwupd-1.0.6/plugins/ata/fu-self-test.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/fu-self-test.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include "config.h"
+
+#include
+
+#include "fu-ata-device.h"
+#include "fu-test.h"
+
+static void
+fu_ata_id_func (void)
+{
+ gboolean ret;
+ gsize sz;
+ g_autofree gchar *data = NULL;
+ g_autofree gchar *path = NULL;
+ g_autoptr(FuAtaDevice) dev = NULL;
+ g_autoptr(GError) error = NULL;
+
+ path = fu_test_get_filename (TESTDATADIR, "StarDrive-SBFM61.2.bin");
+ g_assert_nonnull (path);
+ ret = g_file_get_contents (path, &data, &sz, &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ dev = fu_ata_device_new_from_blob ((guint8 *)data, sz, &error);
+ g_assert_no_error (error);
+ g_assert_nonnull (dev);
+ g_assert_cmpint (fu_ata_device_get_transfer_mode (dev), ==, 0xe);
+ g_assert_cmpint (fu_ata_device_get_transfer_blocks (dev), ==, 0x1);
+ g_assert_cmpstr (fu_device_get_serial (FU_DEVICE (dev)), ==, "A45A078A198600476509");
+ g_assert_cmpstr (fu_device_get_name (FU_DEVICE (dev)), ==, "SATA SSD");
+ g_assert_cmpstr (fu_device_get_version (FU_DEVICE (dev)), ==, "SBFM61.2");
+}
+
+int
+main (int argc, char **argv)
+{
+ g_test_init (&argc, &argv, NULL);
+
+ /* only critical and error are fatal */
+ g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
+
+ /* tests go here */
+ g_test_add_func ("/fwupd/id", fu_ata_id_func);
+ return g_test_run ();
+}
diff -Nru fwupd-1.0.6/plugins/ata/meson.build fwupd-1.2.10/plugins/ata/meson.build
--- fwupd-1.0.6/plugins/ata/meson.build 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,59 @@
+cargs = ['-DG_LOG_DOMAIN="FuPluginAta"']
+
+install_data([
+ 'ata.quirk',
+ ],
+ install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
+)
+
+shared_module('fu_plugin_ata',
+ fu_hash,
+ sources : [
+ 'fu-plugin-ata.c',
+ 'fu-ata-device.c',
+ ],
+ include_directories : [
+ include_directories('../..'),
+ include_directories('../../src'),
+ include_directories('../../libfwupd'),
+ ],
+ install : true,
+ install_dir: plugin_dir,
+ c_args : [
+ cargs,
+ '-DLOCALSTATEDIR="' + localstatedir + '"',
+ ],
+ link_with : [
+ libfwupdprivate,
+ ],
+ dependencies : [
+ plugin_deps,
+ ],
+)
+
+if get_option('tests')
+ testdatadir = join_paths(meson.current_source_dir(), 'tests')
+ cargs += '-DTESTDATADIR="' + testdatadir + '"'
+ e = executable(
+ 'ata-self-test',
+ fu_hash,
+ sources : [
+ 'fu-self-test.c',
+ 'fu-ata-device.c',
+ ],
+ include_directories : [
+ include_directories('..'),
+ include_directories('../..'),
+ include_directories('../../libfwupd'),
+ include_directories('../../src'),
+ ],
+ dependencies : [
+ plugin_deps,
+ ],
+ link_with : [
+ libfwupdprivate,
+ ],
+ c_args : cargs
+ )
+ test('ata-self-test', e)
+endif
diff -Nru fwupd-1.0.6/plugins/ata/README.md fwupd-1.2.10/plugins/ata/README.md
--- fwupd-1.0.6/plugins/ata/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/ata/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,44 @@
+ATA
+===
+
+Introduction
+------------
+
+This plugin allows updating ATA/ATAPI storage hardware. Devices are enumerated
+from the block devices and if ID_ATA_DOWNLOAD_MICROCODE is supported they can
+be updated with appropriate firmware file.
+
+Updating ATA devices is more dangerous than other hardware such as DFU or NVMe
+and should be tested carefully with the help of the drive vendor.
+
+The device GUID is read from the trimmed model string.
+
+Firmware Format
+---------------
+
+The daemon will decompress the cabinet archive and extract a firmware blob in
+an unspecified binary file format.
+
+This plugin supports the following protocol ID:
+
+ * org.t13.ata
+
+GUID Generation
+---------------
+
+These device use the Microsoft DeviceInstanceId values, e.g.
+
+ * `IDE\VENDOR[40]REVISION[8]`
+ * `IDE\0VENDOR[40]`
+
+See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-ide-devices
+for more details.
+
+Quirk use
+---------
+This plugin uses the following plugin-specific quirks:
+
+| Quirk | Description | Minimum fwupd version |
+|------------------------|-------------------------------------------|-----------------------|
+| `AtaTransferBlocks` | Blocks to transfer, or `0xffff` for max | 1.2.4 |
+| `AtaTransferMode` | The transfer mode, `0x3`, `0x7` or `0xe` | 1.2.4 |
Binary files /tmp/tmpQQbJCR/7rYBbtNFzp/fwupd-1.0.6/plugins/ata/tests/StarDrive-SBFM61.2.bin and /tmp/tmpQQbJCR/GMbZcPqOnn/fwupd-1.2.10/plugins/ata/tests/StarDrive-SBFM61.2.bin differ
diff -Nru fwupd-1.0.6/plugins/colorhug/colorhug.quirk fwupd-1.2.10/plugins/colorhug/colorhug.quirk
--- fwupd-1.0.6/plugins/colorhug/colorhug.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/colorhug.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,55 @@
+# ColorHug1
+[DeviceInstanceId=USB\VID_273F&PID_1000]
+Plugin = colorhug
+Flags = is-bootloader
+Guid = 40338ceb-b966-4eae-adae-9c32edfcc484
+FirmwareSizeMin = 0x2000
+FirmwareSizeMax = 0x8000
+CounterpartGuid = USB\VID_273F&PID_1001
+InstallDuration = 8
+
+[DeviceInstanceId=USB\VID_273F&PID_1001]
+Plugin = colorhug
+Flags = none
+Summary = An open source display colorimeter
+Icon = colorimeter-colorhug
+Guid = 40338ceb-b966-4eae-adae-9c32edfcc484
+CounterpartGuid = USB\VID_273F&PID_1000
+InstallDuration = 8
+
+# ColorHug2
+[DeviceInstanceId=USB\VID_273F&PID_1004]
+Plugin = colorhug
+Flags = none
+Summary = An open source display colorimeter
+Icon = colorimeter-colorhug
+Guid = 2082b5e0-7a64-478a-b1b2-e3404fab6dad
+FirmwareSizeMin = 0x2000
+FirmwareSizeMax = 0x8000
+CounterpartGuid = USB\VID_273F&PID_1005
+InstallDuration = 8
+
+[DeviceInstanceId=USB\VID_273F&PID_1005]
+Plugin = colorhug
+Flags = is-bootloader
+Guid = 2082b5e0-7a64-478a-b1b2-e3404fab6dad
+CounterpartGuid = USB\VID_273F&PID_1004
+InstallDuration = 8
+
+# ColorHugALS
+[DeviceInstanceId=USB\VID_273F&PID_1007]
+Plugin = colorhug
+Flags = halfsize,none
+Summary = An open source ambient light sensor
+Guid = 84f40464-9272-4ef7-9399-cd95f12da696
+FirmwareSizeMin = 0x1000
+FirmwareSizeMax = 0x4000
+CounterpartGuid = USB\VID_273F&PID_1006
+InstallDuration = 5
+
+[DeviceInstanceId=USB\VID_273F&PID_1006]
+Plugin = colorhug
+Flags = halfsize,is-bootloader
+Guid = 84f40464-9272-4ef7-9399-cd95f12da696
+CounterpartGuid = USB\VID_273F&PID_1007
+InstallDuration = 5
diff -Nru fwupd-1.0.6/plugins/colorhug/fu-colorhug-common.c fwupd-1.2.10/plugins/colorhug/fu-colorhug-common.c
--- fwupd-1.0.6/plugins/colorhug/fu-colorhug-common.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/fu-colorhug-common.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2016-2018 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include "config.h"
+
+#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;
+}
diff -Nru fwupd-1.0.6/plugins/colorhug/fu-colorhug-common.h fwupd-1.2.10/plugins/colorhug/fu-colorhug-common.h
--- fwupd-1.0.6/plugins/colorhug/fu-colorhug-common.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/fu-colorhug-common.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016-2018 Richard Hughes
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#pragma once
+
+#include
+
+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);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/colorhug/fu-colorhug-device.c fwupd-1.2.10/plugins/colorhug/fu-colorhug-device.c
--- fwupd-1.0.6/plugins/colorhug/fu-colorhug-device.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/fu-colorhug-device.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,80 +1,173 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include
-#include
-#include
+#include "fu-chunk.h"
+#include "fu-colorhug-common.h"
#include "fu-colorhug-device.h"
-typedef struct
-{
- ChDeviceQueue *device_queue;
- gboolean is_bootloader;
-} FuColorhugDevicePrivate;
+/**
+ * FU_COLORHUG_DEVICE_FLAG_HALFSIZE:
+ *
+ * Some devices have a compact memory layout and the application code starts
+ * earlier.
+ *
+ * Since: 1.0.3
+ */
+#define FU_COLORHUG_DEVICE_FLAG_HALFSIZE "halfsize"
-G_DEFINE_TYPE_WITH_PRIVATE (FuColorhugDevice, fu_colorhug_device, FU_TYPE_USB_DEVICE)
+struct _FuColorhugDevice {
+ FuUsbDevice parent_instance;
+ guint16 start_addr;
+};
+
+G_DEFINE_TYPE (FuColorhugDevice, fu_colorhug_device, FU_TYPE_USB_DEVICE)
+
+#define CH_CMD_GET_FIRMWARE_VERSION 0x07
+#define CH_CMD_RESET 0x24
+#define CH_CMD_READ_FLASH 0x25
+#define CH_CMD_WRITE_FLASH 0x26
+#define CH_CMD_BOOT_FLASH 0x27
+#define CH_CMD_SET_FLASH_SUCCESS 0x28
+#define CH_CMD_ERASE_FLASH 0x29
+
+#define CH_USB_HID_EP 0x0001
+#define CH_USB_HID_EP_IN (CH_USB_HID_EP | 0x80)
+#define CH_USB_HID_EP_OUT (CH_USB_HID_EP | 0x00)
+#define CH_USB_HID_EP_SIZE 64
+#define CH_USB_CONFIG 0x0001
+#define CH_USB_INTERFACE 0x0000
+#define CH_EEPROM_ADDR_RUNCODE 0x4000
+#define CH_EEPROM_ADDR_RUNCODE_ALS 0x2000
-#define GET_PRIVATE(o) (fu_colorhug_device_get_instance_private (o))
+#define CH_DEVICE_USB_TIMEOUT 5000 /* ms */
+#define CH_FLASH_TRANSFER_BLOCK_SIZE 0x020 /* 32 */
-static void
-fu_colorhug_device_finalize (GObject *object)
-{
- FuColorhugDevice *device = FU_COLORHUG_DEVICE (object);
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
+static gboolean
+fu_colorhug_device_msg (FuColorhugDevice *self, guint8 cmd,
+ guint8 *ibuf, gsize ibufsz,
+ guint8 *obuf, gsize obufsz,
+ GError **error)
+{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
+ guint8 buf[] = { [0] = cmd, [1 ... CH_USB_HID_EP_SIZE - 1] = 0x00 };
+ gsize actual_length = 0;
- g_object_unref (priv->device_queue);
+ /* check size */
+ if (ibufsz > sizeof(buf) - 1) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "cannot process chunk of size %" G_GSIZE_FORMAT,
+ ibufsz);
+ return FALSE;
+ }
+ if (obufsz > sizeof(buf) - 2) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "cannot process chunk of size %" G_GSIZE_FORMAT,
+ ibufsz);
+ return FALSE;
+ }
- G_OBJECT_CLASS (fu_colorhug_device_parent_class)->finalize (object);
-}
+ /* optionally copy in data */
+ if (ibuf != NULL)
+ memcpy (buf + 1, ibuf, ibufsz);
+
+ /* request */
+ if (g_getenv ("FWUPD_COLORHUG_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "REQ", buf, ibufsz + 1);
+ if (!g_usb_device_interrupt_transfer (usb_device,
+ CH_USB_HID_EP_OUT,
+ buf,
+ sizeof(buf),
+ &actual_length,
+ CH_DEVICE_USB_TIMEOUT,
+ NULL, /* cancellable */
+ error)) {
+ g_prefix_error (error, "failed to send request: ");
+ return FALSE;
+ }
+ if (actual_length != CH_USB_HID_EP_SIZE) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "request not all sent, got %" G_GSIZE_FORMAT,
+ actual_length);
+ return FALSE;
+ }
-static void
-fu_colorhug_device_progress_cb (ChDeviceQueue *device_queue,
- guint percentage,
- FuColorhugDevice *device)
-{
- fu_device_set_progress (FU_DEVICE (device), percentage);
-}
+ /* read reply */
+ if (!g_usb_device_interrupt_transfer (usb_device,
+ CH_USB_HID_EP_IN,
+ buf,
+ sizeof(buf),
+ &actual_length,
+ CH_DEVICE_USB_TIMEOUT,
+ NULL, /* cancellable */
+ error)) {
+ g_prefix_error (error, "failed to get reply: ");
+ return FALSE;
+ }
+ if (g_getenv ("FWUPD_COLORHUG_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "RES", buf, actual_length);
-gboolean
-fu_colorhug_device_get_is_bootloader (FuColorhugDevice *device)
-{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- return priv->is_bootloader;
+ /* old bootloaders do not return the full block */
+ if (actual_length != CH_USB_HID_EP_SIZE &&
+ actual_length != 2 &&
+ actual_length != obufsz + 2) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "request not all received, got %" G_GSIZE_FORMAT,
+ actual_length);
+ return FALSE;
+ }
+
+ /* check error code */
+ if (buf[0] != CH_ERROR_NONE) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ ch_strerror (buf[0]));
+ return FALSE;
+ }
+
+ /* check cmd matches */
+ if (buf[1] != cmd) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_INTERNAL,
+ "cmd incorrect, expected %u, got %u",
+ cmd, buf[1]);
+ return FALSE;
+ }
+
+ /* copy back optional buf */
+ if (obuf != NULL)
+ memcpy (obuf, buf + 2, obufsz);
+
+ return TRUE;
}
-gboolean
-fu_colorhug_device_detach (FuColorhugDevice *device, GError **error)
+static gboolean
+fu_colorhug_device_detach (FuDevice *device, GError **error)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
g_autoptr(GError) error_local = NULL;
- fu_device_set_status (FU_DEVICE (device), FWUPD_STATUS_DEVICE_RESTART);
- ch_device_queue_reset (priv->device_queue, usb_device);
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
+ if (!fu_colorhug_device_msg (self, CH_CMD_RESET,
+ NULL, 0, /* in */
+ NULL, 0, /* out */
+ &error_local)) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
@@ -85,18 +178,17 @@
return TRUE;
}
-gboolean
-fu_colorhug_device_attach (FuColorhugDevice *device, GError **error)
+static gboolean
+fu_colorhug_device_attach (FuDevice *device, GError **error)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
g_autoptr(GError) error_local = NULL;
- fu_device_set_status (FU_DEVICE (device), FWUPD_STATUS_DEVICE_RESTART);
- ch_device_queue_boot_flash (priv->device_queue, usb_device);
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_RESTART);
+ if (!fu_colorhug_device_msg (self, CH_CMD_BOOT_FLASH,
+ NULL, 0, /* in */
+ NULL, 0, /* out */
+ &error_local)) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
@@ -108,19 +200,18 @@
}
gboolean
-fu_colorhug_device_set_flash_success (FuColorhugDevice *device, GError **error)
+fu_colorhug_device_set_flash_success (FuColorhugDevice *self,
+ gboolean val,
+ GError **error)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
+ guint8 buf[] = { [0] = val ? 0x01 : 0x00 };
g_autoptr(GError) error_local = NULL;
g_debug ("setting flash success");
- ch_device_queue_set_flash_success (priv->device_queue,
- usb_device,
- 0x01);
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
+ if (!fu_colorhug_device_msg (self, CH_CMD_SET_FLASH_SUCCESS,
+ buf, sizeof(buf), /* in */
+ NULL, 0, /* out */
+ &error_local)) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_WRITE,
@@ -132,64 +223,56 @@
}
static gboolean
-fu_colorhug_device_probe (FuUsbDevice *device, GError **error)
+fu_colorhug_device_erase (FuColorhugDevice *self, guint16 addr, gsize sz, GError **error)
{
- FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
- FuColorhugDevicePrivate *priv = GET_PRIVATE (self);
- GUsbDevice *usb_device = fu_usb_device_get_dev (device);
- ChDeviceMode mode;
+ guint8 buf[4];
+ g_autoptr(GError) error_local = NULL;
- /* ignore */
- mode = ch_device_get_mode (usb_device);
- if (mode == CH_DEVICE_MODE_UNKNOWN ||
- mode == CH_DEVICE_MODE_BOOTLOADER_PLUS ||
- mode == CH_DEVICE_MODE_FIRMWARE_PLUS) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "not supported with this device");
+ fu_common_write_uint16 (buf + 0, addr, G_LITTLE_ENDIAN);
+ fu_common_write_uint16 (buf + 2, sz, G_LITTLE_ENDIAN);
+ if (!fu_colorhug_device_msg (self, CH_CMD_ERASE_FLASH,
+ buf, sizeof(buf), /* in */
+ NULL, 0, /* out */
+ &error_local)) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_WRITE,
+ "failed to erase device: %s",
+ error_local->message);
return FALSE;
}
+ return TRUE;
+}
+
+static gchar *
+fu_colorhug_device_get_version (FuColorhugDevice *self, GError **error)
+{
+ guint8 buf[6];
+ if (!fu_colorhug_device_msg (self, CH_CMD_GET_FIRMWARE_VERSION,
+ NULL, 0, /* in */
+ buf, sizeof(buf), /* out */
+ error)) {
+ return NULL;
+ }
+ return g_strdup_printf ("%i.%i.%i",
+ fu_common_read_uint16 (buf + 0, G_LITTLE_ENDIAN),
+ fu_common_read_uint16 (buf + 2, G_LITTLE_ENDIAN),
+ fu_common_read_uint16 (buf + 4, G_LITTLE_ENDIAN));
+}
+
+static gboolean
+fu_colorhug_device_probe (FuUsbDevice *device, GError **error)
+{
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
+
+ /* compact memory layout */
+ if (fu_device_has_custom_flag (FU_DEVICE (device),
+ FU_COLORHUG_DEVICE_FLAG_HALFSIZE))
+ self->start_addr = CH_EEPROM_ADDR_RUNCODE_ALS;
/* add hardcoded bits */
- fu_device_add_guid (FU_DEVICE (device), ch_device_get_guid (usb_device));
- fu_device_add_icon (FU_DEVICE (device), "colorimeter-colorhug");
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
- /* set the display name */
- switch (mode) {
- case CH_DEVICE_MODE_BOOTLOADER:
- case CH_DEVICE_MODE_FIRMWARE:
- case CH_DEVICE_MODE_LEGACY:
- fu_device_set_summary (FU_DEVICE (device),
- "An open source display colorimeter");
- break;
- case CH_DEVICE_MODE_BOOTLOADER2:
- case CH_DEVICE_MODE_FIRMWARE2:
- fu_device_set_summary (FU_DEVICE (device),
- "An open source display colorimeter");
- break;
- case CH_DEVICE_MODE_BOOTLOADER_ALS:
- case CH_DEVICE_MODE_FIRMWARE_ALS:
- fu_device_set_summary (FU_DEVICE (device),
- "An open source ambient light sensor");
- break;
- default:
- break;
- }
-
- /* is the device in bootloader mode */
- switch (mode) {
- case CH_DEVICE_MODE_BOOTLOADER:
- case CH_DEVICE_MODE_BOOTLOADER2:
- case CH_DEVICE_MODE_BOOTLOADER_ALS:
- priv->is_bootloader = TRUE;
- break;
- default:
- priv->is_bootloader = FALSE;
- break;
- }
-
/* success */
return TRUE;
}
@@ -197,8 +280,6 @@
static gboolean
fu_colorhug_device_open (FuUsbDevice *device, GError **error)
{
- FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
- FuColorhugDevicePrivate *priv = GET_PRIVATE (self);
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
/* got the version using the HID API */
@@ -209,108 +290,131 @@
error)) {
return FALSE;
}
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_colorhug_device_setup (FuDevice *device, GError **error)
+{
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
+
if (fu_device_get_version (FU_DEVICE (device)) == NULL) {
- guint16 major;
- guint16 micro;
- guint16 minor;
g_autofree gchar *version = NULL;
g_autoptr(GError) error_local = NULL;
- ch_device_queue_get_firmware_ver (priv->device_queue, usb_device,
- &major, &minor, µ);
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
+ version = fu_colorhug_device_get_version (self, &error_local);
+ if (version != NULL) {
+ g_debug ("obtained fwver using API '%s'", version);
+ fu_device_set_version (device, version, FWUPD_VERSION_FORMAT_TRIPLET);
+ } else {
g_warning ("failed to get firmware version: %s",
error_local->message);
}
- version = g_strdup_printf ("%i.%i.%i", major, minor, micro);
- g_debug ("obtained fwver using API '%s'", version);
- fu_device_set_version (FU_DEVICE (device), version);
}
/* success */
return TRUE;
}
-gboolean
-fu_colorhug_device_verify_firmware (FuColorhugDevice *device, GError **error)
+static guint8
+ch_colorhug_device_calculate_checksum (const guint8 *data, guint32 len)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
- gsize len;
- g_autoptr(GError) error_local = NULL;
- g_autofree guint8 *data2 = NULL;
- GChecksumType checksum_types[] = {
- G_CHECKSUM_SHA1,
- G_CHECKSUM_SHA256,
- 0 };
-
- /* get the firmware from the device */
- fu_device_set_status (FU_DEVICE (device), FWUPD_STATUS_DEVICE_VERIFY);
- ch_device_queue_read_firmware (priv->device_queue, usb_device,
- &data2, &len);
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_WRITE,
- "failed to dump firmware: %s",
- error_local->message);
- return FALSE;
- }
-
- /* get the checksum */
- for (guint i = 0; checksum_types[i] != 0; i++) {
- g_autofree gchar *hash = NULL;
- hash = g_compute_checksum_for_data (checksum_types[i],
- (guchar *) data2, len);
- fu_device_add_checksum (device, hash);
- }
-
- return TRUE;
+ guint8 checksum = 0xff;
+ for (guint32 i = 0; i < len; i++)
+ checksum ^= data[i];
+ return checksum;
}
-gboolean
-fu_colorhug_device_write_firmware (FuColorhugDevice *device, GBytes *fw, GError **error)
+static gboolean
+fu_colorhug_device_write_firmware (FuDevice *device,
+ GBytes *fw,
+ FwupdInstallFlags flags,
+ GError **error)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
- g_autoptr(GError) error_local = NULL;
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
+ g_autoptr(GPtrArray) chunks = NULL;
- /* write firmware */
- fu_device_set_status (FU_DEVICE (device), FWUPD_STATUS_DEVICE_WRITE);
- ch_device_queue_set_flash_success (priv->device_queue,
- usb_device,
- 0x00);
- ch_device_queue_write_firmware (priv->device_queue, usb_device,
- g_bytes_get_data (fw, NULL),
- g_bytes_get_size (fw));
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_WRITE,
- "failed to write firmware: %s",
- error_local->message);
+ /* build packets */
+ chunks = fu_chunk_array_new_from_bytes (fw,
+ self->start_addr,
+ 0x00, /* page_sz */
+ CH_FLASH_TRANSFER_BLOCK_SIZE);
+
+ /* don't auto-boot firmware */
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ if (!fu_colorhug_device_set_flash_success (self, FALSE, error))
return FALSE;
- }
- /* verify firmware */
- fu_device_set_status (FU_DEVICE (device), FWUPD_STATUS_DEVICE_VERIFY);
- ch_device_queue_verify_firmware (priv->device_queue, usb_device,
- g_bytes_get_data (fw, NULL),
- g_bytes_get_size (fw));
- if (!ch_device_queue_process (priv->device_queue,
- CH_DEVICE_QUEUE_PROCESS_FLAGS_NONE,
- NULL, &error_local)) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_WRITE,
- "failed to verify firmware: %s",
- error_local->message);
+ /* erase flash */
+ if (!fu_colorhug_device_erase (self, self->start_addr, g_bytes_get_size (fw), error))
return FALSE;
+
+ /* write each block */
+ for (guint i = 0; i < chunks->len; i++) {
+ FuChunk *chk = g_ptr_array_index (chunks, i);
+ guint8 buf[CH_FLASH_TRANSFER_BLOCK_SIZE+4];
+ g_autoptr(GError) error_local = NULL;
+
+ /* set address, length, checksum, data */
+ fu_common_write_uint16 (buf + 0, chk->address, G_LITTLE_ENDIAN);
+ buf[2] = chk->data_sz;
+ buf[3] = ch_colorhug_device_calculate_checksum (chk->data, chk->data_sz);
+ memcpy (buf + 4, chk->data, chk->data_sz);
+ if (!fu_colorhug_device_msg (self, CH_CMD_WRITE_FLASH,
+ buf, sizeof(buf), /* in */
+ NULL, 0, /* out */
+ &error_local)) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_WRITE,
+ "failed to write: %s",
+ error_local->message);
+ return FALSE;
+ }
+
+ /* update progress */
+ fu_device_set_progress_full (device, (gsize) i, (gsize) chunks->len * 2);
+ }
+
+ /* verify each block */
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_VERIFY);
+ for (guint i = 0; i < chunks->len; i++) {
+ FuChunk *chk = g_ptr_array_index (chunks, i);
+ guint8 buf[3];
+ guint8 buf_out[CH_FLASH_TRANSFER_BLOCK_SIZE+1];
+ g_autoptr(GError) error_local = NULL;
+
+ /* set address */
+ fu_common_write_uint16 (buf + 0, chk->address, G_LITTLE_ENDIAN);
+ buf[2] = chk->data_sz;
+ if (!fu_colorhug_device_msg (self, CH_CMD_READ_FLASH,
+ buf, sizeof(buf), /* in */
+ buf_out, sizeof(buf_out), /* out */
+ &error_local)) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_READ,
+ "failed to read: %s",
+ error_local->message);
+ return FALSE;
+ }
+
+ /* verify */
+ if (memcmp (buf_out + 1, chk->data, chk->data_sz) != 0) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_WRITE,
+ "failed to verify firmware for chunk %u, "
+ "address 0x%0x, length 0x%0x",
+ i, (guint) chk->address, chk->data_sz);
+ return FALSE;
+ }
+
+ /* update progress */
+ fu_device_set_progress_full (device,
+ (gsize) chunks->len + i,
+ (gsize) chunks->len * 2);
}
/* success! */
@@ -318,39 +422,32 @@
}
static void
-fu_colorhug_device_init (FuColorhugDevice *device)
+fu_colorhug_device_init (FuColorhugDevice *self)
{
- FuColorhugDevicePrivate *priv = GET_PRIVATE (device);
- priv->device_queue = ch_device_queue_new ();
- g_signal_connect (priv->device_queue, "progress_changed",
- G_CALLBACK (fu_colorhug_device_progress_cb), device);
+ /* this is the application code */
+ self->start_addr = CH_EEPROM_ADDR_RUNCODE;
+ fu_device_set_remove_delay (FU_DEVICE (self),
+ FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
}
static void
fu_colorhug_device_class_init (FuColorhugDeviceClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
FuUsbDeviceClass *klass_usb_device = FU_USB_DEVICE_CLASS (klass);
- object_class->finalize = fu_colorhug_device_finalize;
+ klass_device->write_firmware = fu_colorhug_device_write_firmware;
+ klass_device->attach = fu_colorhug_device_attach;
+ klass_device->detach = fu_colorhug_device_detach;
+ klass_device->setup = fu_colorhug_device_setup;
klass_usb_device->open = fu_colorhug_device_open;
klass_usb_device->probe = fu_colorhug_device_probe;
}
-/**
- * fu_colorhug_device_new:
- *
- * Creates a new #FuColorhugDevice.
- *
- * Returns: (transfer full): a #FuColorhugDevice, or %NULL if not a game pad
- *
- * Since: 0.1.0
- **/
FuColorhugDevice *
-fu_colorhug_device_new (GUsbDevice *usb_device)
+fu_colorhug_device_new (FuUsbDevice *device)
{
- FuColorhugDevice *device = NULL;
- device = g_object_new (FU_TYPE_COLORHUG_DEVICE,
- "usb-device", usb_device,
- NULL);
- return device;
+ FuColorhugDevice *self = NULL;
+ self = g_object_new (FU_TYPE_COLORHUG_DEVICE, NULL);
+ fu_device_incorporate (FU_DEVICE (self), FU_DEVICE (device));
+ return self;
}
diff -Nru fwupd-1.0.6/plugins/colorhug/fu-colorhug-device.h fwupd-1.2.10/plugins/colorhug/fu-colorhug-device.h
--- fwupd-1.0.6/plugins/colorhug/fu-colorhug-device.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/fu-colorhug-device.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,58 +1,23 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016-2017 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_COLORHUG_DEVICE_H
-#define __FU_COLORHUG_DEVICE_H
-
-#include
-#include
+#pragma once
#include "fu-plugin.h"
G_BEGIN_DECLS
#define FU_TYPE_COLORHUG_DEVICE (fu_colorhug_device_get_type ())
-G_DECLARE_DERIVABLE_TYPE (FuColorhugDevice, fu_colorhug_device, FU, COLORHUG_DEVICE, FuUsbDevice)
-
-struct _FuColorhugDeviceClass
-{
- FuUsbDeviceClass parent_class;
-};
+G_DECLARE_FINAL_TYPE (FuColorhugDevice, fu_colorhug_device, FU, COLORHUG_DEVICE, FuUsbDevice)
-FuColorhugDevice *fu_colorhug_device_new (GUsbDevice *usb_device);
-gboolean fu_colorhug_device_get_is_bootloader (FuColorhugDevice *device);
+FuColorhugDevice *fu_colorhug_device_new (FuUsbDevice *device);
/* object methods */
-gboolean fu_colorhug_device_detach (FuColorhugDevice *device,
- GError **error);
-gboolean fu_colorhug_device_attach (FuColorhugDevice *device,
- GError **error);
gboolean fu_colorhug_device_set_flash_success (FuColorhugDevice *device,
- GError **error);
-gboolean fu_colorhug_device_write_firmware (FuColorhugDevice *device,
- GBytes *fw,
- GError **error);
-gboolean fu_colorhug_device_verify_firmware (FuColorhugDevice *device,
+ gboolean val,
GError **error);
G_END_DECLS
-
-#endif /* __FU_COLORHUG_DEVICE_H */
diff -Nru fwupd-1.0.6/plugins/colorhug/fu-plugin-colorhug.c fwupd-1.2.10/plugins/colorhug/fu-plugin-colorhug.c
--- fwupd-1.0.6/plugins/colorhug/fu-plugin-colorhug.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/fu-plugin-colorhug.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,30 +1,11 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2017 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include
-#include
-
-#include "fu-plugin.h"
#include "fu-plugin-vfuncs.h"
#include "fu-colorhug-device.h"
@@ -32,20 +13,15 @@
void
fu_plugin_init (FuPlugin *plugin)
{
- g_autofree gchar *tmp = g_strdup_printf ("%i.%i.%i",
- CH_MAJOR_VERSION,
- CH_MINOR_VERSION,
- CH_MICRO_VERSION);
- fu_plugin_add_report_metadata (plugin, "ColorhugVersion", tmp);
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.hughski.colorhug");
}
gboolean
fu_plugin_update_detach (FuPlugin *plugin, FuDevice *device, GError **error)
{
- FuColorhugDevice *colorhug_dev = FU_COLORHUG_DEVICE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
g_autoptr(FuDeviceLocker) locker = NULL;
- g_autoptr(GUsbDevice) usb_device2 = NULL;
/* open device */
locker = fu_device_locker_new (device, error);
@@ -53,39 +29,24 @@
return FALSE;
/* switch to bootloader mode is not required */
- if (fu_colorhug_device_get_is_bootloader (colorhug_dev)) {
+ if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_IS_BOOTLOADER)) {
g_debug ("already in bootloader mode, skipping");
return TRUE;
}
/* reset */
- if (!fu_colorhug_device_detach (colorhug_dev, error))
+ if (!fu_device_detach (FU_DEVICE (device), error))
return FALSE;
/* wait for replug */
- g_clear_object (&locker);
- usb_device2 = g_usb_context_wait_for_replug (fu_plugin_get_usb_context (plugin),
- usb_device,
- 10000, error);
- if (usb_device2 == NULL) {
- g_prefix_error (error, "device did not come back: ");
- return FALSE;
- }
-
- /* set the new device until we can use a new FuDevice */
- fu_usb_device_set_dev (FU_USB_DEVICE (colorhug_dev), usb_device2);
-
- /* success */
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG);
return TRUE;
}
gboolean
fu_plugin_update_attach (FuPlugin *plugin, FuDevice *device, GError **error)
{
- FuColorhugDevice *colorhug_dev = FU_COLORHUG_DEVICE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
g_autoptr(FuDeviceLocker) locker = NULL;
- g_autoptr(GUsbDevice) usb_device2 = NULL;
/* open device */
locker = fu_device_locker_new (device, error);
@@ -93,43 +54,31 @@
return FALSE;
/* switch to runtime mode is not required */
- if (!fu_colorhug_device_get_is_bootloader (colorhug_dev)) {
+ if (!fu_device_has_flag (device, FWUPD_DEVICE_FLAG_IS_BOOTLOADER)) {
g_debug ("already in runtime mode, skipping");
return TRUE;
}
/* reset */
- if (!fu_colorhug_device_attach (colorhug_dev, error))
+ if (!fu_device_attach (device, error))
return FALSE;
/* wait for replug */
- g_clear_object (&locker);
- usb_device2 = g_usb_context_wait_for_replug (fu_plugin_get_usb_context (plugin),
- usb_device,
- 10000, error);
- if (usb_device2 == NULL) {
- g_prefix_error (error, "device did not come back: ");
- return FALSE;
- }
-
- /* set the new device until we can use a new FuDevice */
- fu_usb_device_set_dev (FU_USB_DEVICE (colorhug_dev), usb_device2);
-
- /* success */
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG);
return TRUE;
}
gboolean
fu_plugin_update_reload (FuPlugin *plugin, FuDevice *device, GError **error)
{
- FuColorhugDevice *colorhug_dev = FU_COLORHUG_DEVICE (device);
+ FuColorhugDevice *self = FU_COLORHUG_DEVICE (device);
g_autoptr(FuDeviceLocker) locker = NULL;
/* also set flash success */
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
- if (!fu_colorhug_device_set_flash_success (colorhug_dev, error))
+ if (!fu_colorhug_device_set_flash_success (self, TRUE, error))
return FALSE;
return TRUE;
}
@@ -141,60 +90,28 @@
FwupdInstallFlags flags,
GError **error)
{
- FuColorhugDevice *colorhug_dev = FU_COLORHUG_DEVICE (device);
- GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
- g_autoptr(FuDeviceLocker) locker = NULL;
- g_autoptr(GError) error_local = NULL;
-
- /* check this firmware is actually for this device */
- if (!ch_device_check_firmware (usb_device,
- g_bytes_get_data (blob_fw, NULL),
- g_bytes_get_size (blob_fw),
- &error_local)) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "firmware is not suitable: %s",
- error_local->message);
- return FALSE;
- }
-
- /* write firmware */
- locker = fu_device_locker_new (device, error);
- if (locker == NULL)
- return FALSE;
- return fu_colorhug_device_write_firmware (colorhug_dev, blob_fw, error);
-}
-
-gboolean
-fu_plugin_verify (FuPlugin *plugin,
- FuDevice *device,
- FuPluginVerifyFlags flags,
- GError **error)
-{
- FuColorhugDevice *colorhug_dev = FU_COLORHUG_DEVICE (device);
g_autoptr(FuDeviceLocker) locker = NULL;
/* write firmware */
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
- return fu_colorhug_device_verify_firmware (colorhug_dev, error);
+ return fu_device_write_firmware (device, blob_fw, flags, error);
}
gboolean
-fu_plugin_usb_device_added (FuPlugin *plugin, GUsbDevice *usb_device, GError **error)
+fu_plugin_usb_device_added (FuPlugin *plugin, FuUsbDevice *device, GError **error)
{
g_autoptr(FuDeviceLocker) locker = NULL;
- g_autoptr(FuColorhugDevice) device = NULL;
+ g_autoptr(FuColorhugDevice) dev = NULL;
/* open the device */
- device = fu_colorhug_device_new (usb_device);
- locker = fu_device_locker_new (device, error);
+ dev = fu_colorhug_device_new (device);
+ locker = fu_device_locker_new (dev, error);
if (locker == NULL)
return FALSE;
/* insert to hash */
- fu_plugin_device_add (plugin, FU_DEVICE (device));
+ fu_plugin_device_add (plugin, FU_DEVICE (dev));
return TRUE;
}
diff -Nru fwupd-1.0.6/plugins/colorhug/meson.build fwupd-1.2.10/plugins/colorhug/meson.build
--- fwupd-1.0.6/plugins/colorhug/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,7 +1,15 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginColorHug"']
+install_data([
+ 'colorhug.quirk',
+ ],
+ install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
+)
+
shared_module('fu_plugin_colorhug',
+ fu_hash,
sources : [
+ 'fu-colorhug-common.c',
'fu-colorhug-device.c',
'fu-plugin-colorhug.c',
],
@@ -12,9 +20,11 @@
],
install : true,
install_dir: plugin_dir,
+ link_with : [
+ libfwupdprivate,
+ ],
c_args : cargs,
dependencies : [
plugin_deps,
- colorhug,
],
)
diff -Nru fwupd-1.0.6/plugins/colorhug/README.md fwupd-1.2.10/plugins/colorhug/README.md
--- fwupd-1.0.6/plugins/colorhug/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/colorhug/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -11,14 +11,21 @@
ColorHug versions 1 and 2 support a custom HID-based flashing protocol, but
version 3 (ColorHug+) has now switched to DFU.
-Build Requirements
-------------------
+Firmware Format
+---------------
-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
+The daemon will decompress the cabinet archive and extract a firmware blob in
+a packed binary file format.
-If you don't want or need this functionality you can use the
-`--disable-colorhug` option.
+This plugin supports the following protocol ID:
+
+ * com.hughski.colorhug
+
+GUID Generation
+---------------
+
+These devices use the standard USB DeviceInstanceId values, e.g.
+
+ * `USB\VID_273F&PID_1001&REV_0001`
+ * `USB\VID_273F&PID_1001`
+ * `USB\VID_273F`
diff -Nru fwupd-1.0.6/plugins/csr/csr-aiaiai-h05.quirk fwupd-1.2.10/plugins/csr/csr-aiaiai-h05.quirk
--- fwupd-1.0.6/plugins/csr/csr-aiaiai-h05.quirk 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/csr-aiaiai-h05.quirk 1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +0,0 @@
-[FuCsrDevice]
-
-# AIAIAI H05 bluetooth headphones
-USB\VID_0A12&PID_1337=none
-
-[FuUsbDevice:name]
-USB\VID_0A12&PID_1337=H05
-
-[FuUsbDevice:summary]
-USB\VID_0A12&PID_1337=Bluetooth headphones
-
-[FuUsbDevice:icon]
-USB\VID_0A12&PID_1337=audio-headphones
-
-[FuUsbDevice:vendor]
-USB\VID_0A12&PID_1337=AIAIAI
-
-[FuUsbDevice:version]
-USB\VID_0A12&PID_1337&REV_2520=1.2
diff -Nru fwupd-1.0.6/plugins/csr/csr-aiaiai-h60.quirk fwupd-1.2.10/plugins/csr/csr-aiaiai-h60.quirk
--- fwupd-1.0.6/plugins/csr/csr-aiaiai-h60.quirk 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/csr-aiaiai-h60.quirk 1970-01-01 00:00:00.000000000 +0000
@@ -1,16 +0,0 @@
-[FuCsrDevice]
-
-# AIAIAI H60 bluetooth headphones
-USB\VID_0A12&PID_4004=none
-
-[FuUsbDevice:name]
-USB\VID_0A12&PID_4004=H60
-
-[FuUsbDevice:summary]
-USB\VID_0A12&PID_4004=Bluetooth headphones
-
-[FuUsbDevice:icon]
-USB\VID_0A12&PID_4004=audio-headphones
-
-[FuUsbDevice:vendor]
-USB\VID_0A12&PID_4004=AIAIAI
diff -Nru fwupd-1.0.6/plugins/csr/csr-aiaiai.quirk fwupd-1.2.10/plugins/csr/csr-aiaiai.quirk
--- fwupd-1.0.6/plugins/csr/csr-aiaiai.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/csr-aiaiai.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,15 @@
+[DeviceInstanceId=USB\VID_0A12&PID_1337]
+Plugin = csr
+Name = H05
+Summary = Bluetooth Headphones
+Icon = audio-headphones
+Vendor = AIAIAI
+[DeviceInstanceId=USB\VID_0A12&PID_1337&REV_2520]
+Version = 1.2
+
+[DeviceInstanceId=USB\VID_0A12&PID_4004]
+Plugin = csr
+Name = H60
+Summary = Bluetooth Headphones
+Icon = audio-headphones
+Vendor = AIAIAI
diff -Nru fwupd-1.0.6/plugins/csr/fu-csr-device.c fwupd-1.2.10/plugins/csr/fu-csr-device.c
--- fwupd-1.0.6/plugins/csr/fu-csr-device.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/fu-csr-device.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,34 +1,35 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2017-2018 Richard Hughes
*
- * Copyright (C) 2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include
+#include "fu-chunk.h"
#include "fu-csr-device.h"
#include "dfu-common.h"
-#include "dfu-chunked.h"
#include "dfu-firmware.h"
+/**
+ * FU_CSR_DEVICE_QUIRK_FLAG_REQUIRE_DELAY:
+ *
+ * Respect the write timeout value when performing actions. This is sometimes
+ * set to a huge amount of time, and so is not used by default.
+ *
+ * Since: 1.0.3
+ */
+#define FU_CSR_DEVICE_FLAG_REQUIRE_DELAY "require-delay"
+
+typedef enum {
+ FU_CSR_DEVICE_QUIRK_NONE = 0,
+ FU_CSR_DEVICE_QUIRK_REQUIRE_DELAY = (1 << 0),
+ FU_CSR_DEVICE_QUIRK_LAST
+} FuCsrDeviceQuirks;
+
struct _FuCsrDevice
{
FuUsbDevice parent_instance;
@@ -39,15 +40,6 @@
G_DEFINE_TYPE (FuCsrDevice, fu_csr_device, FU_TYPE_USB_DEVICE)
-#define HID_REPORT_GET 0x01
-#define HID_REPORT_SET 0x09
-
-#define HID_REPORT_TYPE_INPUT 0x01
-#define HID_REPORT_TYPE_OUTPUT 0x02
-#define HID_REPORT_TYPE_FEATURE 0x03
-
-#define HID_FEATURE 0x0300
-
#define FU_CSR_REPORT_ID_COMMAND 0x01
#define FU_CSR_REPORT_ID_STATUS 0x02
#define FU_CSR_REPORT_ID_CONTROL 0x03
@@ -75,31 +67,16 @@
g_string_append_printf (str, " timeout:\t\t%" G_GUINT32_FORMAT "\n", self->dnload_timeout);
}
-static void
-fu_csr_device_dump (const gchar *title, const guint8 *buf, gsize sz)
-{
- if (g_getenv ("FWUPD_CSR_VERBOSE") == NULL)
- return;
- g_print ("%s (%" G_GSIZE_FORMAT "):\n", title, sz);
- for (gsize i = 0; i < sz; i++)
- g_print ("%02x ", buf[i]);
- g_print ("\n");
-}
-
-void
-fu_csr_device_set_quirks (FuCsrDevice *self, FuCsrDeviceQuirks quirks)
-{
- self->quirks = quirks;
-}
-
-gboolean
-fu_csr_device_attach (FuCsrDevice *self, GError **error)
+static gboolean
+fu_csr_device_attach (FuDevice *device, GError **error)
{
+ FuCsrDevice *self = FU_CSR_DEVICE (device);
GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
gsize sz = 0;
guint8 buf[] = { FU_CSR_REPORT_ID_CONTROL, FU_CSR_CONTROL_RESET };
- fu_csr_device_dump ("Reset", buf, sz);
+ if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "Reset", buf, sz);
if (!g_usb_device_control_transfer (usb_device,
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
G_USB_DEVICE_REQUEST_TYPE_CLASS,
@@ -148,7 +125,8 @@
g_prefix_error (error, "Failed to GetStatus: ");
return FALSE;
}
- fu_csr_device_dump ("GetStatus", buf, sz);
+ if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "GetStatus", buf, sz);
/* check packet */
if (sz != FU_CSR_STATUS_HEADER_SIZE) {
@@ -192,7 +170,8 @@
return TRUE;
/* hit hardware */
- fu_csr_device_dump ("ClearStatus", buf, sz);
+ if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "ClearStatus", buf, sz);
if (!g_usb_device_control_transfer (usb_device,
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
G_USB_DEVICE_REQUEST_TYPE_CLASS,
@@ -243,7 +222,8 @@
g_prefix_error (error, "Failed to ReadFirmware: ");
return NULL;
}
- fu_csr_device_dump ("ReadFirmware", buf, sz);
+ if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "ReadFirmware", buf, sz);
/* too small to parse */
if (sz < FU_CSR_COMMAND_HEADER_SIZE) {
@@ -280,15 +260,16 @@
sz - FU_CSR_COMMAND_HEADER_SIZE);
}
-GBytes *
-fu_csr_device_upload (FuCsrDevice *self, GError **error)
+static GBytes *
+fu_csr_device_upload (FuDevice *device, GError **error)
{
+ FuCsrDevice *self = FU_CSR_DEVICE (device);
g_autoptr(GPtrArray) chunks = NULL;
guint32 total_sz = 0;
gsize done_sz = 0;
/* notify UI */
- fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_DEVICE_READ);
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_READ);
chunks = g_ptr_array_new_with_free_func ((GDestroyNotify) g_bytes_unref);
for (guint32 i = 0; i < 0x3ffffff; i++) {
@@ -298,7 +279,7 @@
/* hit hardware */
chunk = fu_csr_device_upload_chunk (self, error);
if (chunk == NULL)
- return FALSE;
+ return NULL;
chunk_sz = g_bytes_get_size (chunk);
/* get the total size using the CSR header */
@@ -335,7 +316,7 @@
/* add to chunk array */
done_sz += chunk_sz;
g_ptr_array_add (chunks, g_steal_pointer (&chunk));
- fu_device_set_progress_full (FU_DEVICE (self), done_sz, (gsize) total_sz);
+ fu_device_set_progress_full (device, done_sz, (gsize) total_sz);
/* we're done */
if (chunk_sz < 64 - FU_CSR_COMMAND_HEADER_SIZE)
@@ -343,7 +324,6 @@
}
/* notify UI */
- fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_IDLE);
return dfu_utils_bytes_join_array (chunks);
}
@@ -375,7 +355,8 @@
memcpy (buf + FU_CSR_COMMAND_HEADER_SIZE, chunk_data, chunk_sz);
/* hit hardware */
- fu_csr_device_dump ("Upgrade", buf, sizeof(buf));
+ if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL)
+ fu_common_dump_raw (G_LOG_DOMAIN, "Upgrade", buf, sizeof(buf));
if (!g_usb_device_control_transfer (usb_device,
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
G_USB_DEVICE_REQUEST_TYPE_CLASS,
@@ -449,24 +430,19 @@
return dfu_element_get_contents (element);
}
-gboolean
-fu_csr_device_download (FuCsrDevice *self, GBytes *blob, GError **error)
+static GBytes *
+fu_csr_device_prepare_firmware (FuDevice *device,
+ GBytes *fw,
+ FwupdInstallFlags flags,
+ GError **error)
{
GBytes *blob_noftr;
- const guint8 *data;
- gsize sz = 0;
- guint16 idx;
g_autoptr(DfuFirmware) dfu_firmware = dfu_firmware_new ();
- g_autoptr(GBytes) blob_empty = NULL;
- g_autoptr(GPtrArray) packets = NULL;
-
- /* notify UI */
- fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_DEVICE_WRITE);
/* parse the file */
- if (!dfu_firmware_parse_data (dfu_firmware, blob,
+ if (!dfu_firmware_parse_data (dfu_firmware, fw,
DFU_FIRMWARE_PARSE_FLAG_NONE, error))
- return FALSE;
+ return NULL;
if (g_getenv ("FWUPD_CSR_VERBOSE") != NULL) {
g_autofree gchar *fw_str = NULL;
fw_str = dfu_firmware_to_string (dfu_firmware);
@@ -477,7 +453,7 @@
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"expected DFU firmware");
- return FALSE;
+ return NULL;
}
/* get the blob from the firmware file */
@@ -487,57 +463,59 @@
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"firmware contained no data");
- return FALSE;
+ return NULL;
}
- /* create packets */
- data = g_bytes_get_data (blob_noftr, &sz);
- packets = dfu_chunked_new (data, (guint32) sz, 0x0, 0x0,
- FU_CSR_PACKET_DATA_SIZE - FU_CSR_COMMAND_HEADER_SIZE);
+ /* success */
+ return g_bytes_ref (blob_noftr);
+}
+
+static gboolean
+fu_csr_device_download (FuDevice *device,
+ GBytes *blob,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuCsrDevice *self = FU_CSR_DEVICE (device);
+ guint16 idx;
+ g_autoptr(GBytes) blob_empty = NULL;
+ g_autoptr(GPtrArray) chunks = NULL;
+
+ /* notify UI */
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+
+ /* create chunks */
+ chunks = fu_chunk_array_new_from_bytes (blob, 0x0, 0x0,
+ FU_CSR_PACKET_DATA_SIZE - FU_CSR_COMMAND_HEADER_SIZE);
/* send to hardware */
- for (idx = 0; idx < packets->len; idx++) {
- DfuChunkedPacket *pkt = g_ptr_array_index (packets, idx);
- g_autoptr(GBytes) blob_tmp = g_bytes_new_static (pkt->data, pkt->data_sz);
+ for (idx = 0; idx < chunks->len; idx++) {
+ FuChunk *chk = g_ptr_array_index (chunks, idx);
+ g_autoptr(GBytes) blob_tmp = g_bytes_new_static (chk->data, chk->data_sz);
/* send packet */
if (!fu_csr_device_download_chunk (self, idx, blob_tmp, error))
return FALSE;
/* update progress */
- fu_device_set_progress_full (FU_DEVICE (self),
- (gsize) idx, (gsize) packets->len);
+ fu_device_set_progress_full (device,
+ (gsize) idx, (gsize) chunks->len);
}
/* all done */
blob_empty = g_bytes_new (NULL, 0);
- if (!fu_csr_device_download_chunk (self, idx, blob_empty, error))
- return FALSE;
-
- /* notify UI */
- fu_device_set_status (FU_DEVICE (self), FWUPD_STATUS_IDLE);
-
- return TRUE;
+ return fu_csr_device_download_chunk (self, idx, blob_empty, error);
}
static gboolean
fu_csr_device_probe (FuUsbDevice *device, GError **error)
{
- const gchar *quirk_str;
+ FuCsrDevice *self = FU_CSR_DEVICE (device);
/* devices have to be whitelisted */
- quirk_str = fu_device_get_plugin_hints (FU_DEVICE (device));
- if (quirk_str == NULL) {
- g_set_error_literal (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "not supported with this device");
- return FALSE;
- }
- if (g_strcmp0 (quirk_str, "require-delay") == 0) {
- fu_csr_device_set_quirks (FU_CSR_DEVICE (device),
- FU_CSR_DEVICE_QUIRK_REQUIRE_DELAY);
- }
+ if (fu_device_has_custom_flag (FU_DEVICE (device),
+ FU_CSR_DEVICE_FLAG_REQUIRE_DELAY))
+ self->quirks = FU_CSR_DEVICE_QUIRK_REQUIRE_DELAY;
/* hardcoded */
fu_device_add_flag (FU_DEVICE (device), FWUPD_DEVICE_FLAG_UPDATABLE);
@@ -549,7 +527,6 @@
static gboolean
fu_csr_device_open (FuUsbDevice *device, GError **error)
{
- FuCsrDevice *self = FU_CSR_DEVICE (device);
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
/* open device and clear status */
@@ -559,6 +536,16 @@
g_prefix_error (error, "failed to claim HID interface: ");
return FALSE;
}
+
+ /* success */
+ return TRUE;
+}
+
+static gboolean
+fu_csr_device_setup (FuDevice *device, GError **error)
+{
+ FuCsrDevice *self = FU_CSR_DEVICE (device);
+
if (!fu_csr_device_clear_status (self, error))
return FALSE;
@@ -594,17 +581,20 @@
FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
FuUsbDeviceClass *klass_usb_device = FU_USB_DEVICE_CLASS (klass);
klass_device->to_string = fu_csr_device_to_string;
+ klass_device->write_firmware = fu_csr_device_download;
+ klass_device->read_firmware = fu_csr_device_upload;
+ klass_device->prepare_firmware = fu_csr_device_prepare_firmware;
+ klass_device->attach = fu_csr_device_attach;
+ klass_device->setup = fu_csr_device_setup;
klass_usb_device->open = fu_csr_device_open;
klass_usb_device->close = fu_csr_device_close;
klass_usb_device->probe = fu_csr_device_probe;
}
FuCsrDevice *
-fu_csr_device_new (GUsbDevice *usb_device)
+fu_csr_device_new (FuUsbDevice *device)
{
- FuCsrDevice *device = NULL;
- device = g_object_new (FU_TYPE_CSR_DEVICE,
- "usb-device", usb_device,
- NULL);
- return device;
+ FuCsrDevice *self = g_object_new (FU_TYPE_CSR_DEVICE, NULL);
+ fu_device_incorporate (FU_DEVICE (self), FU_DEVICE (device));
+ return self;
}
diff -Nru fwupd-1.0.6/plugins/csr/fu-csr-device.h fwupd-1.2.10/plugins/csr/fu-csr-device.h
--- fwupd-1.0.6/plugins/csr/fu-csr-device.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/fu-csr-device.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,29 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2017-2018 Richard Hughes
*
- * Copyright (C) 2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_CSR_DEVICE_H
-#define __FU_CSR_DEVICE_H
-
-#include
-#include
+#pragma once
#include "fu-plugin.h"
@@ -32,23 +13,6 @@
#define FU_TYPE_CSR_DEVICE (fu_csr_device_get_type ())
G_DECLARE_FINAL_TYPE (FuCsrDevice, fu_csr_device, FU, CSR_DEVICE, FuUsbDevice)
-typedef enum {
- FU_CSR_DEVICE_QUIRK_NONE = 0,
- FU_CSR_DEVICE_QUIRK_REQUIRE_DELAY = (1 << 0),
- FU_CSR_DEVICE_QUIRK_LAST
-} FuCsrDeviceQuirks;
-
-FuCsrDevice *fu_csr_device_new (GUsbDevice *usb_device);
-gboolean fu_csr_device_attach (FuCsrDevice *self,
- GError **error);
-gboolean fu_csr_device_download (FuCsrDevice *self,
- GBytes *blob,
- GError **error);
-GBytes *fu_csr_device_upload (FuCsrDevice *self,
- GError **error);
-void fu_csr_device_set_quirks (FuCsrDevice *self,
- FuCsrDeviceQuirks quirks);
+FuCsrDevice *fu_csr_device_new (FuUsbDevice *device);
G_END_DECLS
-
-#endif /* __FU_CSR_DEVICE_H */
diff -Nru fwupd-1.0.6/plugins/csr/fu-csr-tool.c fwupd-1.2.10/plugins/csr/fu-csr-tool.c
--- fwupd-1.0.6/plugins/csr/fu-csr-tool.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/fu-csr-tool.c 1970-01-01 00:00:00.000000000 +0000
@@ -1,388 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2017 Richard Hughes
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-
-#include "dfu-firmware.h"
-
-#include "fu-progressbar.h"
-#include "fu-csr-device.h"
-
-typedef struct {
- FuQuirks *quirks;
- GPtrArray *cmd_array;
- FuProgressbar *progressbar;
-} FuCsrToolPrivate;
-
-static void
-fu_csr_tool_private_free (FuCsrToolPrivate *priv)
-{
- if (priv == NULL)
- return;
- g_object_unref (priv->quirks);
- g_object_unref (priv->progressbar);
- if (priv->cmd_array != NULL)
- g_ptr_array_unref (priv->cmd_array);
- g_free (priv);
-}
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuCsrToolPrivate, fu_csr_tool_private_free)
-
-typedef gboolean (*FuCsrToolPrivateCb) (FuCsrToolPrivate *util,
- gchar **values,
- GError **error);
-
-typedef struct {
- gchar *name;
- gchar *arguments;
- gchar *description;
- FuCsrToolPrivateCb callback;
-} FuCsrToolItem;
-
-static void
-fu_csr_tool_item_free (FuCsrToolItem *item)
-{
- g_free (item->name);
- g_free (item->arguments);
- g_free (item->description);
- g_free (item);
-}
-
-static gint
-fu_csr_tool_sort_command_name_cb (FuCsrToolItem **item1, FuCsrToolItem **item2)
-{
- return g_strcmp0 ((*item1)->name, (*item2)->name);
-}
-
-static void
-fu_csr_tool_add (GPtrArray *array,
- const gchar *name,
- const gchar *arguments,
- const gchar *description,
- FuCsrToolPrivateCb callback)
-{
- g_auto(GStrv) names = NULL;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (description != NULL);
- g_return_if_fail (callback != NULL);
-
- /* add each one */
- names = g_strsplit (name, ",", -1);
- for (guint i = 0; names[i] != NULL; i++) {
- FuCsrToolItem *item = g_new0 (FuCsrToolItem, 1);
- item->name = g_strdup (names[i]);
- if (i == 0) {
- item->description = g_strdup (description);
- } else {
- item->description = g_strdup_printf ("Alias to %s", names[0]);
- }
- item->arguments = g_strdup (arguments);
- item->callback = callback;
- g_ptr_array_add (array, item);
- }
-}
-
-static gchar *
-fu_csr_tool_get_descriptions (GPtrArray *array)
-{
- const gsize max_len = 31;
- GString *str;
-
- /* print each command */
- str = g_string_new ("");
- for (guint i = 0; i < array->len; i++) {
- FuCsrToolItem *item = g_ptr_array_index (array, i);
- gsize len;
- g_string_append (str, " ");
- g_string_append (str, item->name);
- len = strlen (item->name) + 2;
- if (item->arguments != NULL) {
- g_string_append (str, " ");
- g_string_append (str, item->arguments);
- len += strlen (item->arguments) + 1;
- }
- if (len < max_len) {
- for (guint j = len; j < max_len + 1; j++)
- g_string_append_c (str, ' ');
- g_string_append (str, item->description);
- g_string_append_c (str, '\n');
- } else {
- g_string_append_c (str, '\n');
- for (guint j = 0; j < max_len + 1; j++)
- g_string_append_c (str, ' ');
- g_string_append (str, item->description);
- g_string_append_c (str, '\n');
- }
- }
-
- /* remove trailing newline */
- if (str->len > 0)
- g_string_set_size (str, str->len - 1);
-
- return g_string_free (str, FALSE);
-}
-
-static gboolean
-fu_csr_tool_run (FuCsrToolPrivate *priv, const gchar *command, gchar **values, GError **error)
-{
- /* find command */
- for (guint i = 0; i < priv->cmd_array->len; i++) {
- FuCsrToolItem *item = g_ptr_array_index (priv->cmd_array, i);
- if (g_strcmp0 (item->name, command) == 0)
- return item->callback (priv, values, error);
- }
-
- /* not found */
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_NOT_FOUND,
- "Command not found");
- return FALSE;
-}
-
-static FuCsrDevice *
-fu_csr_get_default_device (FuCsrToolPrivate *priv, GError **error)
-{
- g_autoptr(GUsbContext) usb_context = NULL;
- g_autoptr(GPtrArray) devices = NULL;
-
- /* get all the DFU devices */
- usb_context = g_usb_context_new (error);
- if (usb_context == NULL)
- return NULL;
- devices = g_usb_context_get_devices (usb_context);
- for (guint i = 0; i < devices->len; i++) {
- GUsbDevice *usb_device = g_ptr_array_index (devices, i);
- g_autoptr(FuCsrDevice) device = fu_csr_device_new (usb_device);
- fu_device_set_quirks (FU_DEVICE (device), priv->quirks);
- if (fu_usb_device_probe (FU_USB_DEVICE (device), NULL))
- return g_steal_pointer (&device);
- }
-
- /* unsupported */
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_NOT_SUPPORTED,
- "no supported devices found");
- return NULL;
-}
-
-static gboolean
-fu_csr_tool_info (FuCsrToolPrivate *priv, gchar **values, GError **error)
-{
- g_autoptr(FuCsrDevice) device = fu_csr_get_default_device (priv, error);
- g_autofree gchar *str = NULL;
- if (device == NULL)
- return FALSE;
- if (!fu_usb_device_open (FU_USB_DEVICE (device), error))
- return FALSE;
- str = fu_device_to_string (FU_DEVICE (device));
- g_print ("%s", str);
- return TRUE;
-}
-
-static void
-fu_csr_tool_progress_cb (FuDevice *device, GParamSpec *pspec, FuCsrToolPrivate *priv)
-{
- fu_progressbar_update (priv->progressbar,
- fu_device_get_status (device),
- fu_device_get_progress (device));
-}
-
-static gboolean
-fu_csr_tool_dump (FuCsrToolPrivate *priv, gchar **values, GError **error)
-{
- GUsbDevice *usb_device;
- g_autoptr(DfuElement) dfu_element = dfu_element_new ();
- g_autoptr(DfuFirmware) dfu_firmware = dfu_firmware_new ();
- g_autoptr(DfuImage) dfu_image = dfu_image_new ();
- g_autoptr(FuCsrDevice) device = NULL;
- g_autoptr(GBytes) blob = NULL;
- g_autoptr(GFile) file = NULL;
-
- /* check args */
- if (g_strv_length (values) != 1) {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_FAILED,
- "Invalid arguments, expected FILENAME"
- " -- e.g. `firmware.hex`");
- return FALSE;
- }
-
- /* upload from the device */
- device = fu_csr_get_default_device (priv, error);
- if (device == NULL)
- return FALSE;
- if (!fu_usb_device_open (FU_USB_DEVICE (device), error))
- return FALSE;
- g_signal_connect (device, "notify::status",
- G_CALLBACK (fu_csr_tool_progress_cb), priv);
- g_signal_connect (device, "notify::progress",
- G_CALLBACK (fu_csr_tool_progress_cb), priv);
- blob = fu_csr_device_upload (device, error);
- if (blob == NULL)
- return FALSE;
-
- /* create DFU file */
- usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (device));
- dfu_element_set_contents (dfu_element, blob);
- dfu_image_add_element (dfu_image, dfu_element);
- dfu_firmware_add_image (dfu_firmware, dfu_image);
- dfu_firmware_set_format (dfu_firmware, DFU_FIRMWARE_FORMAT_DFU);
- dfu_firmware_set_vid (dfu_firmware, g_usb_device_get_vid (usb_device));
- dfu_firmware_set_pid (dfu_firmware, g_usb_device_get_pid (usb_device));
-
- /* save file */
- file = g_file_new_for_path (values[0]);
- return dfu_firmware_write_file (dfu_firmware, file, error);
-}
-
-static gboolean
-fu_csr_tool_write (FuCsrToolPrivate *priv, gchar **values, GError **error)
-{
- g_autoptr(FuCsrDevice) device = NULL;
- g_autoptr(GBytes) blob = NULL;
-
- /* check args */
- if (g_strv_length (values) != 1) {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_FAILED,
- "Invalid arguments, expected "
- "FILENAME -- e.g. `firmware.hex`");
- return FALSE;
- }
-
- /* get device */
- device = fu_csr_get_default_device (priv, error);
- if (device == NULL)
- return FALSE;
-
- /* load firmware file */
- blob = fu_common_get_contents_bytes (values[0], error);
- if (blob == NULL)
- return FALSE;
-
- /* write new firmware */
- if (!fu_usb_device_open (FU_USB_DEVICE (device), error))
- return FALSE;
- g_signal_connect (device, "notify::status",
- G_CALLBACK (fu_csr_tool_progress_cb), priv);
- g_signal_connect (device, "notify::progress",
- G_CALLBACK (fu_csr_tool_progress_cb), priv);
- return fu_csr_device_download (device, blob, error);
-}
-
-static gboolean
-fu_csr_tool_attach (FuCsrToolPrivate *priv, gchar **values, GError **error)
-{
- g_autoptr(FuCsrDevice) device = NULL;
- device = fu_csr_get_default_device (priv, error);
- if (device == NULL)
- return FALSE;
- if (!fu_usb_device_open (FU_USB_DEVICE (device), error))
- return FALSE;
- return fu_csr_device_attach (device, error);
-}
-
-int
-main (int argc, char **argv)
-{
- gboolean verbose = FALSE;
- g_autofree gchar *cmd_descriptions = NULL;
- g_autoptr(GError) error = NULL;
- g_autoptr(GOptionContext) context = NULL;
- g_autoptr(FuCsrToolPrivate) priv = g_new0 (FuCsrToolPrivate, 1);
- const GOptionEntry options[] = {
- { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
- "Print verbose debug statements", NULL },
- { NULL}
- };
- setlocale (LC_ALL, "");
-
- priv->progressbar = fu_progressbar_new ();
- fu_progressbar_set_length_percentage (priv->progressbar, 50);
- fu_progressbar_set_length_status (priv->progressbar, 20);
-
- /* add commands */
- priv->cmd_array = g_ptr_array_new_with_free_func ((GDestroyNotify) fu_csr_tool_item_free);
- fu_csr_tool_add (priv->cmd_array,
- "info", NULL,
- "Show information about the device",
- fu_csr_tool_info);
- fu_csr_tool_add (priv->cmd_array,
- "write", "FILENAME",
- "Update the firmware",
- fu_csr_tool_write);
- fu_csr_tool_add (priv->cmd_array,
- "dump", "FILENAME",
- "Dump the firmware",
- fu_csr_tool_dump);
- fu_csr_tool_add (priv->cmd_array,
- "attach", NULL,
- "Attach to firmware mode",
- fu_csr_tool_attach);
-
- /* sort by command name */
- g_ptr_array_sort (priv->cmd_array,
- (GCompareFunc) fu_csr_tool_sort_command_name_cb);
-
- /* get a list of the commands */
- context = g_option_context_new (NULL);
- cmd_descriptions = fu_csr_tool_get_descriptions (priv->cmd_array);
- g_option_context_set_summary (context, cmd_descriptions);
- g_set_application_name ("CSR Debug Tool");
- g_option_context_add_main_entries (context, options, NULL);
- if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_print ("%s: %s\n", "Failed to parse arguments", error->message);
- return EXIT_FAILURE;
- }
-
- /* set verbose? */
- if (verbose)
- g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
-
- /* use quirks */
- priv->quirks = fu_quirks_new ();
- if (!fu_quirks_load (priv->quirks, &error)) {
- g_print ("Failed to load quirks: %s\n", error->message);
- return EXIT_FAILURE;
- }
-
- /* run the specified command */
- if (!fu_csr_tool_run (priv, argv[1], (gchar**) &argv[2], &error)) {
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
- g_autofree gchar *tmp = NULL;
- tmp = g_option_context_get_help (context, TRUE, NULL);
- g_print ("%s\n\n%s", error->message, tmp);
- } else {
- g_print ("%s\n", error->message);
- }
- return EXIT_FAILURE;
- }
-
- return 0;
-}
diff -Nru fwupd-1.0.6/plugins/csr/fu-plugin-csr.c fwupd-1.2.10/plugins/csr/fu-plugin-csr.c
--- fwupd-1.0.6/plugins/csr/fu-plugin-csr.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/fu-plugin-csr.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,42 +1,33 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2017 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include "fu-plugin.h"
#include "fu-plugin-vfuncs.h"
#include "fu-csr-device.h"
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN);
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.qualcomm.dfu");
+}
+
gboolean
-fu_plugin_usb_device_added (FuPlugin *plugin, GUsbDevice *usb_device, GError **error)
+fu_plugin_usb_device_added (FuPlugin *plugin, FuUsbDevice *device, GError **error)
{
- g_autoptr(FuCsrDevice) device = NULL;
+ g_autoptr(FuCsrDevice) dev = NULL;
g_autoptr(FuDeviceLocker) locker = NULL;
- device = fu_csr_device_new (usb_device);
- fu_device_set_quirks (FU_DEVICE (device), fu_plugin_get_quirks (plugin));
- locker = fu_device_locker_new (device, error);
+ dev = fu_csr_device_new (device);
+ locker = fu_device_locker_new (dev, error);
if (locker == NULL)
return FALSE;
- fu_plugin_device_add (plugin, FU_DEVICE (device));
+ fu_plugin_device_add (plugin, FU_DEVICE (dev));
return TRUE;
}
@@ -55,7 +46,7 @@
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
- blob_fw = fu_csr_device_upload (FU_CSR_DEVICE (device), error);
+ blob_fw = fu_device_read_firmware (device, error);
if (blob_fw == NULL)
return FALSE;
for (guint i = 0; checksum_types[i] != 0; i++) {
@@ -74,7 +65,7 @@
locker = fu_device_locker_new (device, error);
if (locker == NULL)
return FALSE;
- if (!fu_csr_device_download (FU_CSR_DEVICE (device), blob_fw, error))
+ if (!fu_device_write_firmware (device, blob_fw, flags, error))
return FALSE;
- return fu_csr_device_attach (FU_CSR_DEVICE (device), error);
+ return fu_device_attach (device, error);
}
diff -Nru fwupd-1.0.6/plugins/csr/meson.build fwupd-1.2.10/plugins/csr/meson.build
--- fwupd-1.0.6/plugins/csr/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -1,13 +1,11 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginCsr"']
-install_data([
- 'csr-aiaiai-h05.quirk',
- 'csr-aiaiai-h60.quirk',
- ],
+install_data(['csr-aiaiai.quirk'],
install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
)
shared_module('fu_plugin_csr',
+ fu_hash,
sources : [
'fu-csr-device.c',
'fu-plugin-csr.c',
@@ -25,29 +23,7 @@
plugin_deps,
],
link_with : [
- dfu,
- ],
-)
-
-executable(
- 'fu-csr-tool',
- sources : [
- 'fu-csr-device.c',
- 'fu-csr-tool.c',
- ],
- include_directories : [
- include_directories('../..'),
- include_directories('../dfu'),
- include_directories('../../libfwupd'),
- include_directories('../../src'),
- ],
- dependencies : [
- plugin_deps,
- ],
- link_with : [
- dfu,
- fwupd,
libfwupdprivate,
+ dfu,
],
- c_args : cargs,
)
diff -Nru fwupd-1.0.6/plugins/csr/README.md fwupd-1.2.10/plugins/csr/README.md
--- fwupd-1.0.6/plugins/csr/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/csr/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,36 @@
+CSR Support
+===========
+
+Introduction
+------------
+
+CSR is often called “driverless DFU” and is used only by BlueCore chips from
+Cambridge Silicon Radio (now owned by Qualcomm). The driverless just means that
+it's DFU like, and is routed over HID.
+
+CSR is a ODM that makes most of the Bluetooth audio chips in vendor hardware.
+The hardware vendor can enable or disable features on the CSR microcontroller
+depending on licensing options (for instance echo cancellation), and there’s
+even a little virtual machine to do simple vendor-specific things.
+
+All the CSR chips are updatable in-field, and most vendors issue updates to fix
+sound quality issues or to add support for new protocols or devices.
+
+Firmware Format
+---------------
+
+The daemon will decompress the cabinet archive and extract a firmware blob in
+DFU file format.
+
+This plugin supports the following protocol ID:
+
+ * com.qualcomm.dfu
+
+GUID Generation
+---------------
+
+These devices use the standard USB DeviceInstanceId values, e.g.
+
+ * `USB\VID_0A12&PID_1337&REV_2520`
+ * `USB\VID_0A12&PID_1337`
+ * `USB\VID_0A12`
diff -Nru fwupd-1.0.6/plugins/dell/dell.quirk fwupd-1.2.10/plugins/dell/dell.quirk
--- fwupd-1.0.6/plugins/dell/dell.quirk 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/dell.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -1,8 +1,40 @@
-[fwupd-uefi-version-format]
+# Realtek NIC in Dell docks
+[DeviceInstanceId=USB\VID_0BDA&PID_8153]
+Plugin = dell
-# Dell & Alienware use AA.BB.CC.DD rather than AA.BB.CCDD
-Dell Inc.=none
-Alienware=none
+# Dell TB16/TB18 cable
+[Guid=TBT-00d4b051]
+Plugin = thunderbolt
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
-[fwupd-daemon-version-format]
-com.dell.uefi*.firmware=none
+# Dell TB16/TB18 dock
+[Guid=TBT-00d4b054]
+Plugin = thunderbolt
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+
+# Dell WD15 dock
+[Guid=MST-wd15-vmm3332-274]
+Plugin = synapticsmst
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+
+# Dell TB16 dock
+[Guid=MST-tb16-vmm3320-274]
+Plugin = synapticsmst
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+[Guid=MST-tb16-vmm3330-274]
+Plugin = synapticsmst
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+
+#Dell TB18 dock
+[Guid=MST-tb18-vmm3320-274]
+Plugin = synapticsmst
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+[Guid=MST-tb18-vmm3330-274]
+Plugin = synapticsmst
+ParentGuid = e7ca1f36-bf73-4574-afe6-a4ccacabf479
+
+[SmbiosManufacturer=Dell Inc.]
+UefiVersionFormat = quad
+
+[SmbiosManufacturer=Alienware]
+UefiVersionFormat = quad
diff -Nru fwupd-1.0.6/plugins/dell/fu-dell-smi.c fwupd-1.2.10/plugins/dell/fu-dell-smi.c
--- fwupd-1.0.6/plugins/dell/fu-dell-smi.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/fu-dell-smi.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,27 +1,11 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2017 Mario Limonciello
*
- * Copyright (C) 2017 Mario Limonciello
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include
#include "fu-dell-smi.h"
/* These are for dock query capabilities */
@@ -53,7 +37,10 @@
g_free(obj);
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FuDellSmiObj, _dell_smi_obj_free);
+#pragma clang diagnostic pop
/* don't actually clear if we're testing */
gboolean
@@ -275,4 +262,4 @@
return FALSE;
}
return TRUE;
-}
\ No newline at end of file
+}
diff -Nru fwupd-1.0.6/plugins/dell/fu-dell-smi.h fwupd-1.2.10/plugins/dell/fu-dell-smi.h
--- fwupd-1.0.6/plugins/dell/fu-dell-smi.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/fu-dell-smi.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2017 Mario Limonciello
*
- * Copyright (C) 2017 Mario Limonciello
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_DELL_COMMON_H
-#define __FU_DELL_COMMON_H
+#pragma once
#include "fu-device.h"
#include
@@ -141,5 +125,3 @@
/* VID/PID of ethernet controller on dock */
#define DOCK_NIC_VID 0x0bda
#define DOCK_NIC_PID 0x8153
-
-#endif /* __FU_DELL_COMMON_H */
diff -Nru fwupd-1.0.6/plugins/dell/fu-plugin-dell.c fwupd-1.2.10/plugins/dell/fu-plugin-dell.c
--- fwupd-1.0.6/plugins/dell/fu-plugin-dell.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/fu-plugin-dell.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,35 +1,19 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016 Richard Hughes
- * Copyright (C) 2016 Mario Limonciello
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (C) 2016 Mario Limonciello
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
-#include
-#include
#include
#include
#include
#include
#include
+#include "fwupd-common.h"
#include "fu-plugin-dell.h"
#include "fu-plugin-vfuncs.h"
#include "fu-device-metadata.h"
@@ -56,11 +40,21 @@
typedef struct _DOCK_DESCRIPTION
{
- const efi_guid_t guid;
+ const gchar * guid;
const gchar * query;
const gchar * desc;
} DOCK_DESCRIPTION;
+struct da_structure {
+ guint8 type;
+ guint8 length;
+ guint16 handle;
+ guint16 cmd_address;
+ guint8 cmd_code;
+ guint32 supported_cmds;
+ guint8 *tokens;
+} __attribute__((packed));
+
/* These are for matching the components */
#define WD15_EC_STR "2 0 2 2 0"
#define TB16_EC_STR "2 0 2 1 0"
@@ -70,17 +64,19 @@
#define LEGACY_CBL_STR "2 2 2 1 0"
#define UNIV_CBL_STR "2 2 2 2 0"
#define TBT_CBL_STR "2 2 2 3 0"
+#define FUTURE_EC_STR "3 0 2 4 0"
+#define FUTURE_EC_STR2 "4 0 2 4 0"
/* supported dock related GUIDs */
-#define DOCK_FLASH_GUID EFI_GUID (0xE7CA1F36, 0xBF73, 0x4574, 0xAFE6, 0xA4, 0xCC, 0xAC, 0xAB, 0xF4, 0x79)
-#define WD15_EC_GUID EFI_GUID (0xE8445370, 0x0211, 0x449D, 0x9FAA, 0x10, 0x79, 0x06, 0xAB, 0x18, 0x9F)
-#define TB16_EC_GUID EFI_GUID (0x33CC8870, 0xB1FC, 0x4EC7, 0x948A, 0xC0, 0x74, 0x96, 0x87, 0x4F, 0xAF)
-#define TB16_PC2_GUID EFI_GUID (0x1B52C630, 0x86F6, 0x4AEE, 0x9F0C, 0x47, 0x4D, 0xC6, 0xBE, 0x49, 0xB6)
-#define TB16_PC1_GUID EFI_GUID (0x8FE183DA, 0xC94E, 0x4804, 0xB319, 0x0F, 0x1B, 0xA5, 0x45, 0x7A, 0x69)
-#define WD15_PC1_GUID EFI_GUID (0x8BA2B709, 0x6F97, 0x47FC, 0xB7E7, 0x6A, 0x87, 0xB5, 0x78, 0xFE, 0x25)
-#define LEGACY_CBL_GUID EFI_GUID (0xFECE1537, 0xD683, 0x4EA8, 0xB968, 0x15, 0x45, 0x30, 0xBB, 0x6F, 0x73)
-#define UNIV_CBL_GUID EFI_GUID (0xE2BF3AAD, 0x61A3, 0x44BF, 0x91EF, 0x34, 0x9B, 0x39, 0x51, 0x5D, 0x29)
-#define TBT_CBL_GUID EFI_GUID (0x6DC832FC, 0x5BB0, 0x4E63, 0xA2FF, 0x02, 0xAA, 0xBA, 0x5B, 0xC1, 0xDC)
+#define DOCK_FLASH_GUID "e7ca1f36-bf73-4574-afe6-a4ccacabf479"
+#define WD15_EC_GUID "e8445370-0211-449d-9faa-107906ab189f"
+#define TB16_EC_GUID "33cc8870-b1fc-4ec7-948a-c07496874faf"
+#define TB16_PC2_GUID "1b52c630-86f6-4aee-9f0c-474dc6be49b6"
+#define TB16_PC1_GUID "8fe183da-c94e-4804-b319-0f1ba5457a69"
+#define WD15_PC1_GUID "8ba2b709-6f97-47fc-b7e7-6a87b578fe25"
+#define LEGACY_CBL_GUID "fece1537-d683-4ea8-b968-154530bb6f73"
+#define UNIV_CBL_GUID "e2bf3aad-61a3-44bf-91ef-349b39515d29"
+#define TBT_CBL_GUID "6dc832fc-5bb0-4e63-a2ff-02aaba5bc1dc"
#define EC_DESC "EC"
#define PC1_DESC "Port Controller 1"
@@ -122,13 +118,6 @@
0x22, /* embedded PC */};
/**
- * System blacklist on older libsmbios
- */
-static guint16 system_blacklist [] = { 0x071E, /* latitude 5414 */
- 0x07A8, /* latitude 5580 */
- 0x077A, /* xps 9365 */ };
-
-/**
* Systems containing host MST device
*/
static guint16 systems_host_mst [] = { 0x062d, /* Latitude E7250 */
@@ -146,14 +135,6 @@
0x071e, /* Latitude Rugged 5414 */
0x071c, /* Latitude Rugged 7414 */};
-static void
-_fwup_resource_iter_free (fwup_resource_iter *iter)
-{
- fwup_resource_iter_destroy (&iter);
-}
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (fwup_resource_iter, _fwup_resource_iter_free);
-
static guint16
fu_dell_get_system_id (FuPlugin *plugin)
{
@@ -188,11 +169,11 @@
static gboolean
fu_dell_supported (FuPlugin *plugin)
{
- FuPluginData *data = fu_plugin_get_data (plugin);
GBytes *de_table = NULL;
+ GBytes *da_table = NULL;
GBytes *enclosure = NULL;
- guint16 system_id = 0;
const guint8 *value;
+ const struct da_structure *da_values;
gsize len;
/* make sure that Dell SMBIOS methods are available */
@@ -204,17 +185,16 @@
return FALSE;
if (*value != 0xDE)
return FALSE;
-
- /* skip blacklisted hw on libsmbios 2.3 or less */
- if (data->libsmbios_major <= 2 &&
- data->libsmbios_minor <= 3) {
- system_id = fu_dell_get_system_id (plugin);
- if (system_id == 0)
- return FALSE;
- for (guint i = 0; i < G_N_ELEMENTS (system_blacklist); i++) {
- if (system_blacklist[i] == system_id)
- return FALSE;
- }
+ da_table = fu_plugin_get_smbios_data (plugin, 0xDA);
+ if (da_table == NULL)
+ return FALSE;
+ da_values = (struct da_structure *) g_bytes_get_data (da_table, &len);
+ if (len == 0)
+ return FALSE;
+ if (!(da_values->supported_cmds & (1 << DACI_FLASH_INTERFACE_CLASS))) {
+ g_debug ("unable to access flash interface. supported commands: 0x%x",
+ da_values->supported_cmds);
+ return FALSE;
}
/* only run on intended Dell hw types */
@@ -235,7 +215,7 @@
static gboolean
fu_plugin_dell_match_dock_component (const gchar *query_str,
- efi_guid_t *guid_out,
+ const gchar **guid_out,
const gchar **name_out)
{
const DOCK_DESCRIPTION list[] = {
@@ -247,12 +227,14 @@
{TBT_CBL_GUID, TBT_CBL_STR, TBT_CBL_DESC},
{UNIV_CBL_GUID, UNIV_CBL_STR, UNIV_CBL_DESC},
{LEGACY_CBL_GUID, LEGACY_CBL_STR, LEGACY_CBL_DESC},
+ {NULL, FUTURE_EC_STR, NULL},
+ {NULL, FUTURE_EC_STR2, NULL},
};
for (guint i = 0; i < G_N_ELEMENTS (list); i++) {
if (g_strcmp0 (query_str,
list[i].query) == 0) {
- memcpy (guid_out, &list[i].guid, sizeof (efi_guid_t));
+ *guid_out = list[i].guid;
*name_out = list[i].desc;
return TRUE;
}
@@ -277,39 +259,24 @@
data->can_switch_modes = TRUE;
}
-static AsVersionParseFlag
+static FwupdVersionFormat
fu_plugin_dell_get_version_format (FuPlugin *plugin)
{
const gchar *content;
const gchar *quirk;
+ g_autofree gchar *group = NULL;
content = fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_MANUFACTURER);
if (content == NULL)
- return AS_VERSION_PARSE_FLAG_USE_TRIPLET;
+ return FWUPD_VERSION_FORMAT_TRIPLET;
/* any quirks match */
- quirk = fu_plugin_lookup_quirk_by_id (plugin,
- FU_QUIRKS_UEFI_VERSION_FORMAT,
- content);
- if (g_strcmp0 (quirk, "none") == 0)
- return AS_VERSION_PARSE_FLAG_NONE;
-
- /* fall back */
- return AS_VERSION_PARSE_FLAG_USE_TRIPLET;
-}
-
-static gchar *
-fu_plugin_get_dock_key (FuPlugin *plugin,
- GUsbDevice *device, const gchar *guid)
-{
- FuPluginData *data = fu_plugin_get_data (plugin);
- const gchar* platform_id;
-
- if (data->smi_obj->fake_smbios)
- platform_id = "fake";
- else
- platform_id = g_usb_device_get_platform_id (device);
- return g_strdup_printf ("%s_%s", platform_id, guid);
+ group = g_strdup_printf ("SmbiosManufacturer=%s", content);
+ quirk = fu_plugin_lookup_quirk_by_id (plugin, group,
+ FU_QUIRKS_UEFI_VERSION_FORMAT);
+ if (quirk == NULL)
+ return FWUPD_VERSION_FORMAT_TRIPLET;
+ return fwupd_version_format_from_string (quirk);
}
static gboolean
@@ -321,14 +288,12 @@
}
static gboolean
-fu_plugin_dock_node (FuPlugin *plugin, GUsbDevice *device,
- guint8 type, const efi_guid_t *guid_raw,
- const gchar *component_desc, const gchar *version)
+fu_plugin_dock_node (FuPlugin *plugin, const gchar *platform,
+ guint8 type, const gchar *component_guid,
+ const gchar *component_desc, const gchar *version,
+ FwupdVersionFormat version_format)
{
const gchar *dock_type;
- g_autofree gchar *dock_id = NULL;
- g_autofree gchar *guid_str = NULL;
- g_autofree gchar *dock_key = NULL;
g_autofree gchar *dock_name = NULL;
g_autoptr(FuDevice) dev = NULL;
@@ -338,89 +303,90 @@
return FALSE;
}
- guid_str = g_strdup ("00000000-0000-0000-0000-000000000000");
- if (efi_guid_to_str (guid_raw, &guid_str) < 0) {
- g_debug ("Failed to convert GUID.");
- return FALSE;
- }
-
- dock_key = fu_plugin_get_dock_key (plugin, device,
- guid_str);
- if (fu_plugin_cache_lookup (plugin, dock_key) != NULL) {
- g_debug ("%s is already registered.", dock_key);
- return FALSE;
- }
-
dev = fu_device_new ();
- dock_id = g_strdup_printf ("DELL-%s" G_GUINT64_FORMAT, guid_str);
- dock_name = g_strdup_printf ("Dell %s %s", dock_type,
- component_desc);
- fu_device_set_id (dev, dock_id);
+ fu_device_set_physical_id (dev, platform);
+ fu_device_set_logical_id (dev, component_guid);
+ if (component_desc != NULL) {
+ dock_name = g_strdup_printf ("Dell %s %s", dock_type,
+ component_desc);
+ fu_device_add_parent_guid (dev, DOCK_FLASH_GUID);
+ } else {
+ dock_name = g_strdup_printf ("Dell %s", dock_type);
+ }
fu_device_set_vendor (dev, "Dell Inc.");
fu_device_set_name (dev, dock_name);
+ fu_device_set_metadata (dev, FU_DEVICE_METADATA_UEFI_DEVICE_KIND, "device-firmware");
if (type == DOCK_TYPE_TB16) {
fu_device_set_summary (dev, "A Thunderbolt™ 3 docking station");
} else if (type == DOCK_TYPE_WD15) {
fu_device_set_summary (dev, "A USB type-C docking station");
}
fu_device_add_icon (dev, "computer");
- fu_device_add_guid (dev, guid_str);
+ fu_device_add_guid (dev, component_guid);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
if (version != NULL) {
- fu_device_set_version (dev, version);
+ fu_device_set_version (dev, version, version_format);
if (fu_plugin_dell_capsule_supported (plugin)) {
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
+ } else {
+ fu_device_set_update_error (dev,
+ "UEFI capsule updates turned off in BIOS setup");
}
}
- fu_plugin_device_add (plugin, dev);
- fu_plugin_cache_add (plugin, dock_key, dev);
+ fu_plugin_device_register (plugin, dev);
return TRUE;
}
-
-void
-fu_plugin_dell_device_added_cb (GUsbContext *ctx,
- GUsbDevice *device,
- FuPlugin *plugin)
+gboolean
+fu_plugin_usb_device_added (FuPlugin *plugin,
+ FuUsbDevice *device,
+ GError **error)
{
FuPluginData *data = fu_plugin_get_data (plugin);
- AsVersionParseFlag parse_flags;
+ FwupdVersionFormat version_format;
guint16 pid;
guint16 vid;
const gchar *query_str;
+ const gchar *component_guid = NULL;
const gchar *component_name = NULL;
+ const gchar *platform;
DOCK_UNION buf;
DOCK_INFO *dock_info;
- efi_guid_t guid_raw;
- efi_guid_t tmpguid;
gboolean old_ec = FALSE;
+ g_autofree gchar *flash_ver_str = NULL;
/* don't look up immediately if a dock is connected as that would
mean a SMI on every USB device that showed up on the system */
if (!data->smi_obj->fake_smbios) {
- vid = g_usb_device_get_vid (device);
- pid = g_usb_device_get_pid (device);
+ vid = fu_usb_device_get_vid (device);
+ pid = fu_usb_device_get_pid (device);
+ platform = fu_device_get_physical_id (FU_DEVICE (device));
} else {
vid = data->fake_vid;
pid = data->fake_pid;
+ platform = "fake";
}
/* we're going to match on the Realtek NIC in the dock */
- if (vid != DOCK_NIC_VID || pid != DOCK_NIC_PID)
- return;
+ if (vid != DOCK_NIC_VID || pid != DOCK_NIC_PID) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,
+ "wrong VID/PID %04x:%04x", vid, pid);
+ return FALSE;
+ }
buf.buf = NULL;
if (!fu_dell_query_dock (data->smi_obj, &buf)) {
- g_debug ("No dock detected.");
- return;
+ g_debug ("no dock detected");
+ return TRUE;
}
if (buf.record->dock_info_header.dir_version != 1) {
- g_debug ("Dock info header version unknown: %d",
- buf.record->dock_info_header.dir_version);
- return;
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,
+ "dock info header version unknown %d",
+ buf.record->dock_info_header.dir_version);
+ return FALSE;
}
dock_info = &buf.record->dock_info;
@@ -432,7 +398,7 @@
g_debug ("Dock cable type: %" G_GUINT32_FORMAT, dock_info->cable_type);
g_debug ("Dock location: %d", dock_info->location);
g_debug ("Dock component count: %d", dock_info->component_count);
- parse_flags = fu_plugin_dell_get_version_format (plugin);
+ version_format = fu_plugin_dell_get_version_format (plugin);
for (guint i = 0; i < dock_info->component_count; i++) {
g_autofree gchar *fw_str = NULL;
@@ -446,15 +412,20 @@
query_str = g_strrstr (dock_info->components[i].description,
"Query ");
if (query_str == NULL) {
- g_debug ("Invalid dock component request");
- return;
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,
+ "invalid dock component request");
+ return FALSE;
}
if (!fu_plugin_dell_match_dock_component (query_str + 6,
- &guid_raw,
+ &component_guid,
&component_name)) {
- g_debug ("Unable to match dock component %s",
- query_str);
- return;
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,
+ "invalid dock component request %s", query_str);
+ return FALSE;
+ }
+ if (component_guid == NULL || component_name == NULL) {
+ g_debug ("%s is supported by another plugin", query_str);
+ return TRUE;
}
/* dock EC hasn't been updated for first time */
@@ -470,87 +441,42 @@
continue;
}
- fw_str = as_utils_version_from_uint32 (dock_info->components[i].fw_version,
- parse_flags);
+ fw_str = fu_common_version_from_uint32 (dock_info->components[i].fw_version,
+ version_format);
if (!fu_plugin_dock_node (plugin,
- device,
- buf.record->dock_info_header.dock_type,
- &guid_raw,
- component_name,
- fw_str)) {
- g_debug ("Failed to create %s", component_name);
- return;
+ platform,
+ buf.record->dock_info_header.dock_type,
+ component_guid,
+ component_name,
+ fw_str,
+ version_format)) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "failed to create %s", component_name);
+ return FALSE;
}
}
/* if an old EC or invalid EC version found, create updatable parent */
- if (old_ec) {
- g_autofree gchar *fw_str = NULL;
- tmpguid = DOCK_FLASH_GUID;
- fw_str = as_utils_version_from_uint32 (dock_info->flash_pkg_version,
- parse_flags);
- if (!fu_plugin_dock_node (plugin,
- device,
- buf.record->dock_info_header.dock_type,
- &tmpguid,
- "",
- fw_str)) {
- g_debug ("Failed to create top dock node");
- return;
- }
- }
-
-#if defined (HAVE_SYNAPTICS)
- fu_plugin_request_recoldplug (plugin);
-#endif
-}
-
-void
-fu_plugin_dell_device_removed_cb (GUsbContext *ctx,
- GUsbDevice *device,
- FuPlugin *plugin)
-{
- FuPluginData *data = fu_plugin_get_data (plugin);
- const efi_guid_t guids[] = { WD15_EC_GUID, TB16_EC_GUID, TB16_PC2_GUID,
- TB16_PC1_GUID, WD15_PC1_GUID,
- LEGACY_CBL_GUID, UNIV_CBL_GUID,
- TBT_CBL_GUID, DOCK_FLASH_GUID};
- const efi_guid_t *guid_raw;
- guint16 pid;
- guint16 vid;
- FuDevice *dev = NULL;
+ if (old_ec)
+ flash_ver_str = fu_common_version_from_uint32 (dock_info->flash_pkg_version,
+ version_format);
+ if (!fu_plugin_dock_node (plugin,
+ platform,
+ buf.record->dock_info_header.dock_type,
+ DOCK_FLASH_GUID,
+ NULL,
+ flash_ver_str,
+ version_format)) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "failed to create top dock node");
- if (!data->smi_obj->fake_smbios) {
- vid = g_usb_device_get_vid (device);
- pid = g_usb_device_get_pid (device);
- } else {
- vid = data->fake_vid;
- pid = data->fake_pid;
+ return FALSE;
}
- /* we're going to match on the Realtek NIC in the dock */
- if (vid != DOCK_NIC_VID || pid != DOCK_NIC_PID)
- return;
-
- /* remove any components already in database? */
- for (guint i = 0; i < G_N_ELEMENTS (guids); i++) {
- g_autofree gchar *dock_key = NULL;
- g_autofree gchar *guid_str = NULL;
- guid_raw = &guids[i];
- guid_str = g_strdup ("00000000-0000-0000-0000-000000000000");
- efi_guid_to_str (guid_raw, &guid_str);
- dock_key = fu_plugin_get_dock_key (plugin, device,
- guid_str);
- dev = fu_plugin_cache_lookup (plugin, dock_key);
- if (dev != NULL) {
- fu_plugin_device_remove (plugin,
- dev);
- fu_plugin_cache_remove (plugin, dock_key);
- }
- }
#if defined (HAVE_SYNAPTICS)
fu_plugin_request_recoldplug (plugin);
#endif
+ return TRUE;
}
gboolean
@@ -576,7 +502,7 @@
if (completion_code[3] == DELL_SUCCESS) {
fu_device_set_update_state (device, FWUPD_UPDATE_STATE_SUCCESS);
} else {
- fu_device_set_update_state (device, FWUPD_UPDATE_STATE_FAILED);
+ FwupdUpdateState update_state = FWUPD_UPDATE_STATE_FAILED;
switch (completion_code[3]) {
case DELL_CONSISTENCY_FAIL:
tmp = "The image failed one or more consistency checks.";
@@ -592,12 +518,15 @@
break;
case DELL_BATTERY_MISSING:
tmp = "A battery must be installed for the operation to complete.";
+ update_state = FWUPD_UPDATE_STATE_FAILED_TRANSIENT;
break;
case DELL_BATTERY_DEAD:
tmp = "A fully-charged battery must be present for the operation to complete.";
+ update_state = FWUPD_UPDATE_STATE_FAILED_TRANSIENT;
break;
case DELL_AC_MISSING:
tmp = "An external power adapter must be connected for the operation to complete.";
+ update_state = FWUPD_UPDATE_STATE_FAILED_TRANSIENT;
break;
case DELL_CANT_SET_12V:
tmp = "The 12V required to program the flash-memory could not be set.";
@@ -623,6 +552,7 @@
default:
break;
}
+ fu_device_set_update_state (device, update_state);
if (tmp != NULL)
fu_device_set_update_error (device, tmp);
}
@@ -650,7 +580,7 @@
struct tpm_status *out = NULL;
g_autoptr (FuDevice) dev_alt = NULL;
g_autoptr (FuDevice) dev = NULL;
- const gchar *product_name = NULL;
+ const gchar *product_name = "Unknown";
fu_dell_clear_smi (data->smi_obj);
out = (struct tpm_status *) data->smi_obj->output;
@@ -704,17 +634,17 @@
}
tpm_guid_raw = g_strdup_printf ("%04x-%s", system_id, tpm_mode);
- tpm_guid = as_utils_guid_from_string (tpm_guid_raw);
+ tpm_guid = fwupd_guid_hash_string (tpm_guid_raw);
tpm_id = g_strdup_printf ("DELL-%s" G_GUINT64_FORMAT, tpm_guid);
tpm_guid_raw_alt = g_strdup_printf ("%04x-%s", system_id, tpm_mode_alt);
- tpm_guid_alt = as_utils_guid_from_string (tpm_guid_raw_alt);
+ tpm_guid_alt = fwupd_guid_hash_string (tpm_guid_raw_alt);
tpm_id_alt = g_strdup_printf ("DELL-%s" G_GUINT64_FORMAT, tpm_guid_alt);
g_debug ("Creating primary TPM GUID %s and secondary TPM GUID %s",
tpm_guid_raw, tpm_guid_raw_alt);
- version_str = as_utils_version_from_uint32 (out->fw_version,
- AS_VERSION_PARSE_FLAG_NONE);
+ version_str = fu_common_version_from_uint32 (out->fw_version,
+ FWUPD_VERSION_FORMAT_QUAD);
/* make it clear that the TPM is a discrete device of the product */
if (!data->smi_obj->fake_smbios) {
@@ -730,21 +660,25 @@
fu_device_set_vendor (dev, "Dell Inc.");
fu_device_set_name (dev, pretty_tpm_name);
fu_device_set_summary (dev, "Platform TPM device");
- fu_device_set_version (dev, version_str);
+ fu_device_set_version (dev, version_str, FWUPD_VERSION_FORMAT_QUAD);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
fu_device_add_icon (dev, "computer");
+ fu_device_set_metadata (dev, FU_DEVICE_METADATA_UEFI_DEVICE_KIND, "dell-tpm-firmware");
if ((out->status & TPM_OWN_MASK) == 0 && out->flashes_left > 0) {
if (fu_plugin_dell_capsule_supported (plugin)) {
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
+ } else {
+ fu_device_set_update_error (dev,
+ "UEFI capsule updates turned off in BIOS setup");
}
fu_device_set_flashes_left (dev, out->flashes_left);
} else {
g_debug ("%s updating disabled due to TPM ownership",
pretty_tpm_name);
}
- fu_plugin_device_add (plugin, dev);
+ fu_plugin_device_register (plugin, dev);
/* build alternate device node */
if (can_switch_modes) {
@@ -758,7 +692,9 @@
fu_device_add_flag (dev_alt, FWUPD_DEVICE_FLAG_REQUIRE_AC);
fu_device_add_flag (dev_alt, FWUPD_DEVICE_FLAG_LOCKED);
fu_device_add_icon (dev_alt, "computer");
- fu_device_set_alternate (dev_alt, dev);
+ fu_device_set_alternate_id (dev_alt, fu_device_get_id (dev));
+ fu_device_set_metadata (dev_alt, FU_DEVICE_METADATA_UEFI_DEVICE_KIND, "dell-tpm-firmware");
+ fu_device_add_parent_guid (dev_alt, tpm_guid);
/* If TPM is not owned and at least 1 flash left allow mode switching
*
@@ -771,7 +707,7 @@
g_debug ("%s mode switch disabled due to TPM ownership",
pretty_tpm_name);
}
- fu_plugin_device_add (plugin, dev_alt);
+ fu_plugin_device_register (plugin, dev_alt);
}
else
g_debug ("System %04x does not offer TPM modeswitching",
@@ -780,165 +716,6 @@
return TRUE;
}
-gboolean
-fu_plugin_unlock (FuPlugin *plugin, FuDevice *device, GError **error)
-{
- FuDevice *device_alt = NULL;
- FwupdDeviceFlags device_flags_alt = 0;
- guint flashes_left = 0;
- guint flashes_left_alt = 0;
-
- /* for unlocking TPM1.2 <-> TPM2.0 switching */
- g_debug ("Unlocking upgrades for: %s (%s)", fu_device_get_name (device),
- fu_device_get_id (device));
- device_alt = fu_device_get_alternate (device);
-
- if (!device_alt)
- return FALSE;
- g_debug ("Preventing upgrades for: %s (%s)", fu_device_get_name (device_alt),
- fu_device_get_id (device_alt));
-
- flashes_left = fu_device_get_flashes_left (device);
- flashes_left_alt = fu_device_get_flashes_left (device_alt);
- if (flashes_left == 0) {
- /* flashes left == 0 on both means no flashes left */
- if (flashes_left_alt == 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "ERROR: %s has no flashes left.",
- fu_device_get_name (device));
- /* flashes left == 0 on just unlocking device is ownership */
- } else {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "ERROR: %s is currently OWNED. "
- "Ownership must be removed to switch modes.",
- fu_device_get_name (device_alt));
- }
- return FALSE;
- }
-
-
- /* clone the info from real device but prevent it from being flashed */
- device_flags_alt = fu_device_get_flags (device_alt);
- fu_device_set_flags (device, device_flags_alt);
- fu_device_set_flags (device_alt, device_flags_alt & ~FWUPD_DEVICE_FLAG_UPDATABLE);
-
- /* make sure that this unlocked device can be updated */
- fu_device_set_version (device, "0.0.0.0");
-
- return TRUE;
-}
-
-gboolean
-fu_plugin_update (FuPlugin *plugin,
- FuDevice *device,
- GBytes *blob_fw,
- FwupdInstallFlags flags,
- GError **error)
-{
- FuPluginData *data = fu_plugin_get_data (plugin);
- g_autoptr (fwup_resource_iter) iter = NULL;
- fwup_resource *re = NULL;
- const gchar *name = NULL;
- gint rc;
- guint flashes_left;
- const gchar *guidstr = NULL;
- efi_guid_t guid;
-
- /* test the flash counter
- * - devices with 0 left at setup aren't allowed offline updates
- * - devices greater than 0 should show a warning when near 0
- */
- flashes_left = fu_device_get_flashes_left (device);
- if (flashes_left > 0) {
- name = fu_device_get_name (device);
- g_debug ("%s has %u flashes left", name, flashes_left);
- if ((flags & FWUPD_INSTALL_FLAG_FORCE) == 0 &&
- flashes_left <= 2) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "WARNING: %s only has %u flashes left. "
- "See https://github.com/hughsie/fwupd/wiki/Dell-TPM:-flashes-left for more information.",
- name, flashes_left);
- return FALSE;
- }
- }
-
- if (data->smi_obj->fake_smbios)
- return TRUE;
-
- /* perform the update */
- g_debug ("Performing capsule update");
-
- /* Stuff the payload into a different GUID
- * - with fwup 0.5 this uses the ESRT GUID
- * - with fwup 0.6 this uses the payload's GUID
- * it's preferable to use payload GUID to avoid
- * a corner case scenario of UEFI BIOS and non-ESRT
- * update happening at same time
- */
- fwup_resource_iter_create (&iter);
- fwup_resource_iter_next (iter, &re);
- guidstr = fu_device_get_guid_default (device);
- rc = efi_str_to_guid (guidstr, &guid);
- if (rc < 0) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_INTERNAL,
- "Failed to convert guid to string");
- return FALSE;
- }
- rc = fwup_set_guid (iter, &re, &guid);
- if (rc < 0 || re == NULL) {
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_INTERNAL,
- "Failed to update GUID %s",
- strerror (rc));
- return FALSE;
- }
-
- /* NOTE: if there are problems with this working, adjust the
- * GUID in the capsule header to match something in ESRT.
- * This won't actually cause any bad behavior because the real
- * payload GUID is extracted later on.
- */
- fu_device_set_status (device, FWUPD_STATUS_SCHEDULING);
- rc = fwup_set_up_update_with_buf (re, 0,
- g_bytes_get_data (blob_fw, NULL),
- g_bytes_get_size (blob_fw));
- if (rc < 0) {
- g_autoptr(GString) err_string = g_string_new ("Dell firmware update failed:\n");
-
- rc = 1;
- for (int i = 0; rc > 0; i++) {
- char *filename = NULL;
- char *function = NULL;
- char *message = NULL;
- int line = 0;
- int err = 0;
-
- rc = efi_error_get (i, &filename, &function, &line, &message, &err);
- if (rc <= 0)
- break;
- g_string_append_printf (err_string,
- "{error #%d} %s:%d %s(): %s: %s \n",
- i, filename, line, function, message, strerror(err));
- }
- g_set_error (error,
- FWUPD_ERROR,
- FWUPD_ERROR_NOT_SUPPORTED,
- "%s",
- err_string->str);
- return FALSE;
- }
- return TRUE;
-}
-
void
fu_plugin_device_registered (FuPlugin *plugin, FuDevice *device)
{
@@ -959,7 +736,7 @@
device_id = g_strdup_printf ("TBT-%04x%04x", 0x00d4u,
(unsigned) system_id);
fu_device_set_vendor_id (device, vendor_id);
- fu_device_add_guid (device, device_id);
+ fu_device_add_instance_id (device, device_id);
fu_device_add_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
}
}
@@ -1012,6 +789,7 @@
gboolean
fu_plugin_update_prepare (FuPlugin *plugin,
+ FwupdInstallFlags flags,
FuDevice *device,
GError **error)
{
@@ -1021,6 +799,7 @@
gboolean
fu_plugin_update_cleanup (FuPlugin *plugin,
+ FwupdInstallFlags flags,
FuDevice *device,
GError **error)
{
@@ -1045,13 +824,12 @@
FuPluginData *data = fu_plugin_alloc_data (plugin, sizeof (FuPluginData));
g_autofree gchar *tmp = NULL;
- data->libsmbios_major = smbios_get_library_version_major();
- data->libsmbios_minor = smbios_get_library_version_minor();
- g_debug ("Using libsmbios %u.%u", data->libsmbios_major,
- data->libsmbios_minor);
- tmp = g_strdup_printf ("%u.%u", data->libsmbios_major,
- data->libsmbios_minor);
- fu_plugin_add_report_metadata (plugin, "LibsmbiosVersion", tmp);
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+ tmp = g_strdup_printf ("%d.%d",
+ smbios_get_library_version_major(),
+ smbios_get_library_version_minor());
+ fu_plugin_add_runtime_version (plugin, "com.dell.libsmbios", tmp);
+ g_debug ("Using libsmbios %s", tmp);
data->smi_obj = g_malloc0 (sizeof (FuDellSmiObj));
if (g_getenv ("FWUPD_DELL_VERBOSE") != NULL)
@@ -1061,6 +839,10 @@
data->smi_obj->fake_smbios = FALSE;
if (g_getenv ("FWUPD_DELL_FAKE_SMBIOS") != NULL)
data->smi_obj->fake_smbios = TRUE;
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN);
+
+ /* make sure that UEFI plugin is ready to receive devices */
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_RUN_AFTER, "uefi");
}
void
@@ -1076,8 +858,8 @@
fu_plugin_startup (FuPlugin *plugin, GError **error)
{
FuPluginData *data = fu_plugin_get_data (plugin);
- GUsbContext *usb_ctx = fu_plugin_get_usb_context (plugin);
- gint uefi_supported;
+ g_autofree gchar *sysfsfwdir = NULL;
+ g_autofree gchar *esrtdir = NULL;
if (data->smi_obj->fake_smbios) {
g_debug ("Called with fake SMBIOS implementation. "
@@ -1103,26 +885,16 @@
}
/* If ESRT is not turned on, fwupd will have already created an
- * unlock device (if compiled with support).
+ * unlock device.
*
* Once unlocked, that will enable flashing capsules here too.
- *
- * that means we should only look for supported = 1
*/
- uefi_supported = fwup_supported ();
- data->capsule_supported = (uefi_supported == 1);
- if (!data->capsule_supported) {
- g_debug ("UEFI capsule firmware updating not supported (%x)",
- (guint) uefi_supported);
- }
-
- if (usb_ctx != NULL) {
- g_signal_connect (usb_ctx, "device-added",
- G_CALLBACK (fu_plugin_dell_device_added_cb),
- plugin);
- g_signal_connect (usb_ctx, "device-removed",
- G_CALLBACK (fu_plugin_dell_device_removed_cb),
- plugin);
+ sysfsfwdir = fu_common_get_path (FU_PATH_KIND_SYSFSDIR_FW);
+ esrtdir = g_build_filename (sysfsfwdir, "efi", "esrt", NULL);
+ if (g_file_test (esrtdir, G_FILE_TEST_EXISTS)) {
+ data->capsule_supported = TRUE;
+ } else {
+ g_debug ("UEFI capsule firmware updating not supported");
}
return TRUE;
diff -Nru fwupd-1.0.6/plugins/dell/fu-plugin-dell.h fwupd-1.2.10/plugins/dell/fu-plugin-dell.h
--- fwupd-1.0.6/plugins/dell/fu-plugin-dell.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/fu-plugin-dell.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,28 +1,11 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/*
+ * Copyright (C) 2016 Mario Limonciello
*
- * Copyright (C) 2016 Mario Limonciello
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __FU_PLUGIN_DELL_H
-#define __FU_PLUGIN_DELL_H
+#pragma once
-#include
#include "fu-plugin.h"
#include "fu-dell-smi.h"
@@ -32,8 +15,6 @@
guint16 fake_pid;
gboolean can_switch_modes;
gboolean capsule_supported;
- guint libsmbios_major;
- guint libsmbios_minor;
};
void
@@ -44,16 +25,6 @@
gboolean
fu_plugin_dell_detect_tpm (FuPlugin *plugin, GError **error);
-void
-fu_plugin_dell_device_added_cb (GUsbContext *ctx,
- GUsbDevice *device,
- FuPlugin *plugin);
-
-void
-fu_plugin_dell_device_removed_cb (GUsbContext *ctx,
- GUsbDevice *device,
- FuPlugin *plugin);
-
/* These are nodes that will indicate information about
* the TPM status
*/
@@ -68,5 +39,3 @@
#define TPM_TYPE_MASK 0x0F00
#define TPM_1_2_MODE 0x0001
#define TPM_2_0_MODE 0x0002
-
-#endif /* __FU_PLUGIN_DELL_H */
diff -Nru fwupd-1.0.6/plugins/dell/fu-self-test.c fwupd-1.2.10/plugins/dell/fu-self-test.c
--- fwupd-1.0.6/plugins/dell/fu-self-test.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/fu-self-test.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,76 +1,116 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2017 Richard Hughes
*
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include
-#include
#include
#include
+#include "fu-device-private.h"
#include "fu-plugin-private.h"
#include "fu-plugin-dell.h"
+#include "fu-plugin-vfuncs.h"
+
+static FuDevice *
+_find_device_by_id (GPtrArray *devices, const gchar *device_id)
+{
+ for (guint i = 0; i < devices->len; i++) {
+ FuDevice *device = g_ptr_array_index (devices, i);
+ if (g_strcmp0 (fu_device_get_id (device), device_id) == 0)
+ return device;
+ }
+ return NULL;
+}
+
+static FuDevice *
+_find_device_by_name (GPtrArray *devices, const gchar *device_id)
+{
+ for (guint i = 0; i < devices->len; i++) {
+ FuDevice *device = g_ptr_array_index (devices, i);
+ if (g_strcmp0 (fu_device_get_name (device), device_id) == 0)
+ return device;
+ }
+ return NULL;
+}
static void
_plugin_device_added_cb (FuPlugin *plugin, FuDevice *device, gpointer user_data)
{
- FuDevice **dev = (FuDevice **) user_data;
- g_set_object (dev, device);
+ GPtrArray *devices = (GPtrArray *) user_data;
+ if (fu_device_get_alternate_id (device) != NULL) {
+ FuDevice *device_alt = _find_device_by_id (devices, fu_device_get_alternate_id (device));
+ if (device_alt != NULL)
+ fu_device_set_alternate (device, device_alt);
+ }
+ g_ptr_array_add (devices, g_object_ref (device));
+}
+
+static void
+fu_engine_plugin_device_register_cb (FuPlugin *plugin_dell,
+ FuDevice *device,
+ gpointer user_data)
+{
+ FuPlugin *plugin_uefi = FU_PLUGIN (user_data);
+ g_autofree gchar *dbg = fu_device_to_string (device);
+ g_debug ("registering device: %s", dbg);
+ fu_plugin_runner_device_register (plugin_uefi, device);
}
static void
fu_plugin_dell_tpm_func (void)
{
+ FuDevice *device_v12;
+ FuDevice *device_v20;
+ const guint8 fw[30] = { 'F', 'W', 0x00 };
gboolean ret;
struct tpm_status tpm_out;
- FuDevice *device_alt = NULL;
+ g_autoptr(FuPlugin) plugin_dell = NULL;
+ g_autoptr(FuPlugin) plugin_uefi = NULL;
+ g_autoptr(GBytes) blob_fw = g_bytes_new_static (fw, sizeof(fw));
g_autoptr(GError) error = NULL;
- g_autoptr(FuDevice) device = NULL;
- g_autoptr(FuPlugin) plugin = NULL;
+ g_autoptr(GPtrArray) devices = NULL;
memset (&tpm_out, 0x0, sizeof(tpm_out));
- g_setenv ("FWUPD_DELL_FAKE_SMBIOS", "1", FALSE);
- plugin = fu_plugin_new ();
- ret = fu_plugin_open (plugin, PLUGINBUILDDIR "/libfu_plugin_dell.so", &error);
+ plugin_uefi = fu_plugin_new ();
+ ret = fu_plugin_open (plugin_uefi, PLUGINBUILDDIR "/../uefi/libfu_plugin_uefi.so", &error);
g_assert_no_error (error);
g_assert (ret);
- ret = fu_plugin_runner_startup (plugin, &error);
+ ret = fu_plugin_runner_startup (plugin_uefi, &error);
g_assert_no_error (error);
g_assert (ret);
- ret = fu_plugin_runner_coldplug(plugin, &error);
- g_signal_connect (plugin, "device-added",
+ devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ g_signal_connect (plugin_uefi, "device-added",
G_CALLBACK (_plugin_device_added_cb),
- &device);
+ devices);
+
+ plugin_dell = fu_plugin_new ();
+ ret = fu_plugin_open (plugin_dell, PLUGINBUILDDIR "/libfu_plugin_dell.so", &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ ret = fu_plugin_runner_startup (plugin_dell, &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ g_signal_connect (plugin_dell, "device-register",
+ G_CALLBACK (fu_engine_plugin_device_register_cb),
+ plugin_uefi);
+ ret = fu_plugin_runner_coldplug (plugin_dell, &error);
g_assert_no_error (error);
g_assert (ret);
/* inject fake data (no TPM) */
tpm_out.ret = -2;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &tpm_out, 0, 0,
NULL, FALSE);
- ret = fu_plugin_dell_detect_tpm (plugin, &error);
+ ret = fu_plugin_dell_detect_tpm (plugin_dell, &error);
g_assert_no_error (error);
- g_assert (!ret);
+ g_assert_false (ret);
+ g_assert_cmpint (devices->len, ==, 0);
/* inject fake data:
* - that is out of flashes
@@ -82,64 +122,62 @@
tpm_out.fw_version = 0;
tpm_out.status = TPM_EN_MASK | (TPM_1_2_MODE << 8);
tpm_out.flashes_left = 0;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &tpm_out, 0, 0,
NULL, TRUE);
- ret = fu_plugin_dell_detect_tpm (plugin, &error);
- device_alt = fu_device_get_alternate (device);
- g_assert_no_error (error);
- g_assert (ret);
- g_assert (device != NULL);
- g_assert (device_alt != NULL);
+ ret = fu_plugin_dell_detect_tpm (plugin_dell, &error);
+ g_assert_true (ret);
+ g_assert_cmpint (devices->len, ==, 2);
/* make sure 2.0 is locked */
- g_assert_true (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_LOCKED));
+ device_v20 = _find_device_by_name (devices, "Unknown TPM 2.0");
+ g_assert_nonnull (device_v20);
+ g_assert_true (fu_device_has_flag (device_v20, FWUPD_DEVICE_FLAG_LOCKED));
/* make sure not allowed to flash 1.2 */
- g_assert_false (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v12 = _find_device_by_name (devices, "Unknown TPM 1.2");
+ g_assert_nonnull (device_v12);
+ g_assert_false (fu_device_has_flag (device_v12, FWUPD_DEVICE_FLAG_UPDATABLE));
/* try to unlock 2.0 */
- ret = fu_plugin_runner_unlock (plugin, device, &error);
+ ret = fu_plugin_runner_unlock (plugin_uefi, device_v20, &error);
g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED);
- g_assert (!ret);
+ g_assert_false (ret);
g_clear_error (&error);
/* cleanup */
- fu_plugin_device_remove (plugin, device_alt);
- fu_plugin_device_remove (plugin, device);
- g_clear_object (&device);
+ g_ptr_array_set_size (devices, 0);
/* inject fake data:
- * - that hasflashes
+ * - that has flashes
* - owned
* - TPM 1.2
* dev will be the locked 2.0, alt will be the orig 1.2
*/
tpm_out.status = TPM_EN_MASK | TPM_OWN_MASK | (TPM_1_2_MODE << 8);
tpm_out.flashes_left = 125;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &tpm_out, 0, 0,
NULL, TRUE);
- ret = fu_plugin_dell_detect_tpm (plugin, &error);
- device_alt = fu_device_get_alternate (device);
+ ret = fu_plugin_dell_detect_tpm (plugin_dell, &error);
g_assert_no_error (error);
g_assert (ret);
- g_assert (device != NULL);
- g_assert (device_alt != NULL);
/* make sure not allowed to flash 1.2 */
- g_assert_false (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v12 = _find_device_by_name (devices, "Unknown TPM 1.2");
+ g_assert_nonnull (device_v12);
+ g_assert_false (fu_device_has_flag (device_v12, FWUPD_DEVICE_FLAG_UPDATABLE));
/* try to unlock 2.0 */
- ret = fu_plugin_runner_unlock (plugin, device, &error);
+ device_v20 = _find_device_by_name (devices, "Unknown TPM 2.0");
+ g_assert_nonnull (device_v20);
+ ret = fu_plugin_runner_unlock (plugin_uefi, device_v20, &error);
g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED);
- g_assert (!ret);
+ g_assert_false (ret);
g_clear_error (&error);
/* cleanup */
- fu_plugin_device_remove (plugin, device_alt);
- fu_plugin_device_remove (plugin, device);
- g_clear_object (&device);
+ g_ptr_array_set_size (devices, 0);
/* inject fake data:
* - that has flashes
@@ -149,33 +187,32 @@
*/
tpm_out.status = TPM_EN_MASK | (TPM_1_2_MODE << 8);
tpm_out.flashes_left = 125;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &tpm_out, 0, 0,
NULL, TRUE);
- ret = fu_plugin_dell_detect_tpm (plugin, &error);
- device_alt = fu_device_get_alternate (device);
+ ret = fu_plugin_dell_detect_tpm (plugin_dell, &error);
g_assert_no_error (error);
g_assert (ret);
- g_assert (device != NULL);
- g_assert (device_alt != NULL);
/* make sure allowed to flash 1.2 but not 2.0 */
- g_assert_true (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
- g_assert_false (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v12 = _find_device_by_name (devices, "Unknown TPM 1.2");
+ g_assert_nonnull (device_v12);
+ g_assert_true (fu_device_has_flag (device_v12, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v20 = _find_device_by_name (devices, "Unknown TPM 2.0");
+ g_assert_nonnull (device_v20);
+ g_assert_false (fu_device_has_flag (device_v20, FWUPD_DEVICE_FLAG_UPDATABLE));
/* try to unlock 2.0 */
- ret = fu_plugin_runner_unlock (plugin, device, &error);
+ ret = fu_plugin_runner_unlock (plugin_uefi, device_v20, &error);
g_assert_no_error (error);
g_assert (ret);
/* make sure no longer allowed to flash 1.2 but can flash 2.0 */
- g_assert_false (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
- g_assert_true (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE));
+ g_assert_false (fu_device_has_flag (device_v12, FWUPD_DEVICE_FLAG_UPDATABLE));
+ g_assert_true (fu_device_has_flag (device_v20, FWUPD_DEVICE_FLAG_UPDATABLE));
/* cleanup */
- fu_plugin_device_remove (plugin, device_alt);
- fu_plugin_device_remove (plugin, device);
- g_clear_object (&device);
+ g_ptr_array_set_size (devices, 0);
/* inject fake data:
* - that has 1 flash left
@@ -185,37 +222,36 @@
*/
tpm_out.status = TPM_EN_MASK | (TPM_2_0_MODE << 8);
tpm_out.flashes_left = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &tpm_out, 0, 0,
NULL, TRUE);
- ret = fu_plugin_dell_detect_tpm (plugin, &error);
- device_alt = fu_device_get_alternate (device);
+ ret = fu_plugin_dell_detect_tpm (plugin_dell, &error);
g_assert_no_error (error);
g_assert (ret);
- g_assert (device != NULL);
- g_assert (device_alt != NULL);
/* make sure allowed to flash 2.0 but not 1.2 */
- g_assert_true (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
- g_assert_false (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v20 = _find_device_by_name (devices, "Unknown TPM 2.0");
+ g_assert_nonnull (device_v20);
+ g_assert_true (fu_device_has_flag (device_v20, FWUPD_DEVICE_FLAG_UPDATABLE));
+ device_v12 = _find_device_by_name (devices, "Unknown TPM 1.2");
+ g_assert_nonnull (device_v12);
+ g_assert_false (fu_device_has_flag (device_v12, FWUPD_DEVICE_FLAG_UPDATABLE));
/* With one flash left we need an override */
- ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
- FWUPD_INSTALL_FLAG_NONE, &error);
- g_assert (!ret);
+ ret = fu_plugin_runner_update (plugin_uefi, device_v20, blob_fw,
+ FWUPD_INSTALL_FLAG_NONE, &error);
g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED);
+ g_assert_false (ret);
g_clear_error (&error);
/* test override */
- ret = fu_plugin_runner_update (plugin, device_alt, NULL, NULL,
- FWUPD_INSTALL_FLAG_FORCE, &error);
- g_assert (ret);
+ g_test_expect_message ("FuPluginUefi", G_LOG_LEVEL_WARNING,
+ "missing or invalid embedded capsule header");
+ ret = fu_plugin_runner_update (plugin_uefi, device_v20, blob_fw,
+ FWUPD_INSTALL_FLAG_FORCE, &error);
+ g_test_assert_expected_messages ();
g_assert_no_error (error);
-
- /* cleanup */
- fu_plugin_device_remove (plugin, device_alt);
- fu_plugin_device_remove (plugin, device);
- g_clear_object (&device);
+ g_assert (ret);
}
static void
@@ -226,40 +262,53 @@
DOCK_UNION buf;
DOCK_INFO *dock_info;
g_autoptr(GError) error = NULL;
- g_autoptr(FuDevice) device = NULL;
- g_autoptr(FuPlugin) plugin = NULL;
+ g_autoptr(GPtrArray) devices = NULL;
+ g_autoptr(FuPlugin) plugin_uefi = fu_plugin_new ();
+ g_autoptr(FuPlugin) plugin_dell = fu_plugin_new ();
- g_setenv ("FWUPD_DELL_FAKE_SMBIOS", "1", FALSE);
- plugin = fu_plugin_new ();
- ret = fu_plugin_open (plugin, PLUGINBUILDDIR "/libfu_plugin_dell.so", &error);
+ ret = fu_plugin_open (plugin_uefi, PLUGINBUILDDIR "/../uefi/libfu_plugin_uefi.so", &error);
g_assert_no_error (error);
g_assert (ret);
- ret = fu_plugin_runner_startup (plugin, &error);
+ ret = fu_plugin_runner_startup (plugin_uefi, &error);
g_assert_no_error (error);
g_assert (ret);
- g_signal_connect (plugin, "device-added",
+ devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ g_signal_connect (plugin_uefi, "device-added",
G_CALLBACK (_plugin_device_added_cb),
- &device);
- ret = fu_plugin_runner_coldplug (plugin, &error);
+ devices);
+ ret = fu_plugin_open (plugin_dell, PLUGINBUILDDIR "/libfu_plugin_dell.so", &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ ret = fu_plugin_runner_startup (plugin_dell, &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+ g_signal_connect (plugin_dell, "device-register",
+ G_CALLBACK (fu_engine_plugin_device_register_cb),
+ plugin_uefi);
+ ret = fu_plugin_runner_coldplug (plugin_dell, &error);
g_assert_no_error (error);
g_assert (ret);
/* make sure bad device doesn't trigger this */
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
0x1234, 0x4321, NULL, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL, plugin);
- g_assert (device == NULL);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, &error);
+ g_assert_false (ret);
+ g_clear_error (&error);
+ g_assert_cmpint (devices->len, ==, 0);
/* inject a USB dongle matching correct VID/PID */
out[0] = 0;
out[1] = 0;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
NULL, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL, plugin);
- g_assert (device == NULL);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, &error);
+ g_assert_true (ret);
+ g_clear_error (&error);
+ g_assert_cmpint (devices->len, ==, 0);
/* inject valid TB16 dock w/ invalid flash pkg version */
buf.record = g_malloc0 (sizeof(DOCK_INFO_RECORD));
@@ -286,17 +335,15 @@
"Dock1,Cable,Cyp,TBT_Cable,0 :Query 2 2 2 3 0", 44);
out[0] = 0;
out[1] = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
buf.buf, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL,
- plugin);
- g_assert (device != NULL);
- g_clear_object (&device);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, NULL);
+ g_assert (ret);
+ g_assert_cmpint (devices->len, ==, 4);
+ g_ptr_array_set_size (devices, 0);
g_free (buf.record);
- fu_plugin_dell_device_removed_cb (NULL, NULL,
- plugin);
/* inject valid TB16 dock w/ older system EC */
buf.record = g_malloc0 (sizeof(DOCK_INFO_RECORD));
@@ -323,18 +370,15 @@
"Dock1,Cable,Cyp,TBT_Cable,0 :Query 2 2 2 3 0", 44);
out[0] = 0;
out[1] = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
buf.buf, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL,
- plugin);
- g_assert (device != NULL);
- g_clear_object (&device);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, NULL);
+ g_assert (ret);
+ g_assert_cmpint (devices->len, ==, 3);
+ g_ptr_array_set_size (devices, 0);
g_free (buf.record);
- fu_plugin_dell_device_removed_cb (NULL, NULL,
- plugin);
-
/* inject valid WD15 dock w/ invalid flash pkg version */
buf.record = g_malloc0 (sizeof(DOCK_INFO_RECORD));
@@ -358,18 +402,16 @@
"Dock1,Cable,Cyp,IE_Cable,0 :Query 2 2 2 1 0", 43);
out[0] = 0;
out[1] = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
buf.buf, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL,
- plugin);
- g_assert (device != NULL);
- g_clear_object (&device);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, &error);
+ g_assert (ret);
+ g_assert_no_error (error);
+ g_assert_cmpint (devices->len, ==, 3);
+ g_ptr_array_set_size (devices, 0);
g_free (buf.record);
- fu_plugin_dell_device_removed_cb (NULL, NULL,
- plugin);
-
/* inject valid WD15 dock w/ older system EC */
buf.record = g_malloc0 (sizeof(DOCK_INFO_RECORD));
@@ -393,17 +435,16 @@
"Dock1,Cable,Cyp,IE_Cable,0 :Query 2 2 2 1 0", 43);
out[0] = 0;
out[1] = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
buf.buf, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL,
- plugin);
- g_assert (device != NULL);
- g_clear_object (&device);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, &error);
+ g_assert (ret);
+ g_assert_no_error (error);
+ g_assert_cmpint (devices->len, ==, 2);
+ g_ptr_array_set_size (devices, 0);
g_free (buf.record);
- fu_plugin_dell_device_removed_cb (NULL, NULL,
- plugin);
/* inject an invalid future dock */
buf.record = g_malloc0 (sizeof(DOCK_INFO_RECORD));
@@ -421,21 +462,30 @@
"Dock1,EC,MIPS32,FUT_Dock,0 :Query 2 0 2 2 0", 43);
out[0] = 0;
out[1] = 1;
- fu_plugin_dell_inject_fake_data (plugin,
+ fu_plugin_dell_inject_fake_data (plugin_dell,
(guint32 *) &out,
DOCK_NIC_VID, DOCK_NIC_PID,
buf.buf, FALSE);
- fu_plugin_dell_device_added_cb (NULL, NULL,
- plugin);
- g_assert (device == NULL);
+ ret = fu_plugin_usb_device_added (plugin_dell, NULL, &error);
+ g_assert_false (ret);
+ g_assert_cmpint (devices->len, ==, 0);
g_free (buf.record);
}
int
main (int argc, char **argv)
{
+ g_autofree gchar *sysfsdir = NULL;
g_test_init (&argc, &argv, NULL);
+ /* change path */
+ g_setenv ("FWUPD_SYSFSFWDIR", TESTDATADIR, TRUE);
+
+ /* change behaviour */
+ sysfsdir = fu_common_get_path (FU_PATH_KIND_SYSFSDIR_FW);
+ g_setenv ("FWUPD_UEFI_ESP_PATH", sysfsdir, TRUE);
+ g_setenv ("FWUPD_DELL_FAKE_SMBIOS", "1", FALSE);
+
/* only critical and error are fatal */
g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
diff -Nru fwupd-1.0.6/plugins/dell/meson.build fwupd-1.2.10/plugins/dell/meson.build
--- fwupd-1.0.6/plugins/dell/meson.build 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -5,6 +5,7 @@
)
shared_module('fu_plugin_dell',
+ fu_hash,
sources : [
'fu-plugin-dell.c',
'fu-dell-smi.c',
@@ -16,23 +17,27 @@
],
install : true,
install_dir: plugin_dir,
+ link_with : [
+ libfwupdprivate,
+ ],
c_args : [
- cargs,
- '-DLOCALSTATEDIR="' + localstatedir + '"',
- ],
+ cargs,
+ ],
dependencies : [
plugin_deps,
efivar,
libsmbios_c,
- fwup,
],
)
if get_option('tests')
+ testdatadir = join_paths(meson.current_source_dir(), 'tests')
+ cargs += '-DTESTDATADIR="' + testdatadir + '"'
cargs += '-DFU_OFFLINE_DESTDIR="/tmp/fwupd-self-test"'
cargs += '-DPLUGINBUILDDIR="' + meson.current_build_dir() + '"'
e = executable(
'dell-self-test',
+ fu_hash,
sources : [
'fu-self-test.c',
'fu-dell-smi.c',
@@ -46,19 +51,15 @@
dependencies : [
plugin_deps,
efivar,
- fwup,
sqlite,
- gudev,
libsmbios_c,
valgrind,
],
link_with : [
- fwupd,
libfwupdprivate,
],
c_args : [
cargs,
- '-DLOCALSTATEDIR="/tmp/fwupd-self-test/var"',
],
)
test('dell-self-test', e)
diff -Nru fwupd-1.0.6/plugins/dell/README.md fwupd-1.2.10/plugins/dell/README.md
--- fwupd-1.0.6/plugins/dell/README.md 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -6,24 +6,32 @@
This allows installing Dell capsules that are not part of the ESRT table.
+GUID Generation
+---------------
+
+These devices uses custom GUIDs for Dell-specific hardware.
+
+ * Thunderbolt devices: `TBT-0x00d4u$(system-id)`
+ * TPM devices `$(system-id)-$(mode)`, where `mode` is either `2.0` or `1.2`
+
+In both cases the `system-id` is derived from the SMBIOS Product SKU property.
+
Build Requirements
------------------
-For Dell support you will need libsmbios_c version 2.3.0 or later and
-efivar.
-* source: http://linux.dell.com/cgi-bin/cgit.cgi/libsmbios.git/
-* rpms: https://apps.fedoraproject.org/packages/libsmbios
-* debs (Debian): http://tracker.debian.org/pkg/libsmbios
-* debs (Ubuntu): http://launchpad.net/ubuntu/+source/libsmbios
+For Dell support you will need libsmbios_c version 2.4.0 or later.
+
+* source: https://github.com/dell/libsmbios
+* binaries: https://github.com/dell/libsmbios/releases
If you don't want or need this functionality you can use the
-`--disable-dell` option.
+`-Dplugin_dell=false` option.
# Devices powered by the Dell Plugin
The Dell plugin creates device nodes for PC's that have switchable TPMs as
well as the Type-C docks (WD15/TB16).
-These device nodes can be flashed using UEFI capsule (and fwupdate) but don't
+These device nodes can be flashed using UEFI capsule but don't
use the ESRT table to communicate device status or version information.
This is intentional behavior because more complicated decisions need to be made
Binary files /tmp/tmpQQbJCR/7rYBbtNFzp/fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/image and /tmp/tmpQQbJCR/GMbZcPqOnn/fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/image differ
diff -Nru fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/status fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/status
--- fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/status 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/status 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/type fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/type
--- fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/type 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/type 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0
diff -Nru fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/version fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/version
--- fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/xoffset fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/xoffset
--- fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/xoffset 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/xoffset 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+123
diff -Nru fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/yoffset fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/yoffset
--- fwupd-1.0.6/plugins/dell/tests/acpi/bgrt/yoffset 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/acpi/bgrt/yoffset 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+456
Binary files /tmp/tmpQQbJCR/7rYBbtNFzp/fwupd-1.0.6/plugins/dell/tests/efi/efivars/fwupd-ddc0ee61-e7f0-4e7d-acc5-c070a398838e-0-0abba7dc-e516-4167-bbf5-4d9d1c739416 and /tmp/tmpQQbJCR/GMbZcPqOnn/fwupd-1.2.10/plugins/dell/tests/efi/efivars/fwupd-ddc0ee61-e7f0-4e7d-acc5-c070a398838e-0-0abba7dc-e516-4167-bbf5-4d9d1c739416 differ
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c fwupd-1.2.10/plugins/dell/tests/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c
--- fwupd-1.0.6/plugins/dell/tests/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
\ No newline at end of file
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/capsule_flags fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/capsule_flags
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/capsule_flags 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/capsule_flags 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0xfe
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_class fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_class
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_class 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_class 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+ddc0ee61-e7f0-4e7d-acc5-c070a398838e
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_type fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_type
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_type 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_type 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+65586
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_status fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_status
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_status 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_status 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/last_attempt_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+18472960
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/lowest_supported_fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/lowest_supported_fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry0/lowest_supported_fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry0/lowest_supported_fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+65582
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/capsule_flags fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/capsule_flags
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/capsule_flags 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/capsule_flags 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0x8010
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_class fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_class
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_class 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_class 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+671d19d0-d43c-4852-98d9-1ce16f9967e4
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_type fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_type
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_type 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_type 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+2
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+3090287969
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_status fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_status
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_status 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_status 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/last_attempt_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/lowest_supported_fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/lowest_supported_fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry1/lowest_supported_fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry1/lowest_supported_fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/capsule_flags fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/capsule_flags
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/capsule_flags 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/capsule_flags 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0x8010
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_class fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_class
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_class 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_class 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+00000000-0000-0000-0000-000000000000
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_type fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_type
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_type 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_type 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+2
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+3090287969
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_status fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_status
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_status 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_status 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/last_attempt_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+0
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/lowest_supported_fw_version fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/lowest_supported_fw_version
--- fwupd-1.0.6/plugins/dell/tests/efi/esrt/entries/entry2/lowest_supported_fw_version 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/esrt/entries/entry2/lowest_supported_fw_version 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi/fw_platform_size fwupd-1.2.10/plugins/dell/tests/efi/fw_platform_size
--- fwupd-1.0.6/plugins/dell/tests/efi/fw_platform_size 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi/fw_platform_size 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+64
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/height fwupd-1.2.10/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/height
--- fwupd-1.0.6/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/height 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/height 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+789
diff -Nru fwupd-1.0.6/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/width fwupd-1.2.10/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/width
--- fwupd-1.0.6/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/width 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/efi-framebuffer/efi-framebuffer.0/width 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+456
diff -Nru fwupd-1.0.6/plugins/dell/tests/.gitignore fwupd-1.2.10/plugins/dell/tests/.gitignore
--- fwupd-1.0.6/plugins/dell/tests/.gitignore 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/.gitignore 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,2 @@
+EFI
+efi/efivars/fwupd-c34cb672-a81e-5d32-9d89-cbcabe8ec37b-0-0abba7dc-e516-4167-bbf5-4d9d1c739416
Binary files /tmp/tmpQQbJCR/7rYBbtNFzp/fwupd-1.0.6/plugins/dell/tests/test.bmp and /tmp/tmpQQbJCR/GMbZcPqOnn/fwupd-1.2.10/plugins/dell/tests/test.bmp differ
diff -Nru fwupd-1.0.6/plugins/dell/tests/tpm0/active fwupd-1.2.10/plugins/dell/tests/tpm0/active
--- fwupd-1.0.6/plugins/dell/tests/tpm0/active 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/tpm0/active 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/tpm0/caps fwupd-1.2.10/plugins/dell/tests/tpm0/caps
--- fwupd-1.0.6/plugins/dell/tests/tpm0/caps 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/tpm0/caps 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,3 @@
+Manufacturer: 0x49465800
+TCG version: 1.2
+Firmware version: 6.40
diff -Nru fwupd-1.0.6/plugins/dell/tests/tpm0/enabled fwupd-1.2.10/plugins/dell/tests/tpm0/enabled
--- fwupd-1.0.6/plugins/dell/tests/tpm0/enabled 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/tpm0/enabled 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/tpm0/owned fwupd-1.2.10/plugins/dell/tests/tpm0/owned
--- fwupd-1.0.6/plugins/dell/tests/tpm0/owned 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/tpm0/owned 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1 @@
+1
diff -Nru fwupd-1.0.6/plugins/dell/tests/tpm0/pcrs fwupd-1.2.10/plugins/dell/tests/tpm0/pcrs
--- fwupd-1.0.6/plugins/dell/tests/tpm0/pcrs 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell/tests/tpm0/pcrs 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,24 @@
+PCR-00: 3C 97 99 20 C9 00 99 60 09 27 D5 DA B3 81 EB 95 1E 7F C8 68
+PCR-01: CE 9F A4 B2 01 09 D8 81 14 EA 1A 6D 13 94 CD 45 5F 52 69 23
+PCR-02: 47 09 7A 9A AD C3 26 A4 93 91 26 63 A1 6F DF 53 D7 88 96 8E
+PCR-03: B2 A8 3B 0E BF 2F 83 74 29 9A 5B 2B DF C3 1E A9 55 AD 72 36
+PCR-04: A4 A5 87 4C 59 94 8D 9B 93 66 0A F4 19 D8 6F F8 94 36 20 CC
+PCR-05: 00 0B 58 00 89 72 EF 6C 2A AC 79 33 C4 AE 67 6B A6 EF CF 6A
+PCR-06: B2 A8 3B 0E BF 2F 83 74 29 9A 5B 2B DF C3 1E A9 55 AD 72 36
+PCR-07: 0A 2A 68 15 85 0D AC B2 D1 F4 E0 C1 F4 56 D5 E2 81 08 6D EA
+PCR-08: DB A7 29 4E 49 BA D7 9E 53 99 0A 6E 3A CB 52 97 B9 08 3A 66
+PCR-09: 19 F9 6F 10 83 F5 5B 50 98 26 C3 14 73 43 35 21 1F E6 39 E9
+PCR-10: 37 3D 89 9E 10 0D DD 2D 21 B5 F4 96 8D 4F DC A7 6D 1A C7 BD
+PCR-11: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-12: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-13: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-14: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-15: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-16: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+PCR-17: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-18: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-19: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-21: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-22: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+PCR-23: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff -Nru fwupd-1.0.6/plugins/dell-dock/dell-dock.quirk fwupd-1.2.10/plugins/dell-dock/dell-dock.quirk
--- fwupd-1.0.6/plugins/dell-dock/dell-dock.quirk 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/dell-dock.quirk 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,115 @@
+#
+# Copyright (C) 2018 Dell Inc.
+# All rights reserved.
+#
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license.
+#
+# This file is provided under a dual MIT/LGPLv2 license. When using or
+# redistributing this file, you may do so under either license.
+# Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+#
+# SPDX-License-Identifier: LGPL-2.1+ OR MIT
+#
+
+[DellDockUnlockTargets]
+synapticsmst = 9
+
+# Used to make plugin probe the devices
+[DeviceInstanceId=USB\VID_413C&PID_B06F]
+Name = Unprobed Dell accessory endpoint
+Plugin = dell_dock
+[DeviceInstanceId=USB\VID_413C&PID_B06E]
+Name = Unprobed Dell accessory endpoint
+Plugin = dell_dock
+
+# USB hub1
+[DeviceInstanceId=USB\VID_413C&PID_B06F&hub]
+Name = RTS5413 in Dell dock
+Summary = USB 3.1 Generation 1 Hub
+ParentGuid = USB\VID_413C&PID_B06E&hub&embedded
+Plugin = dell_dock
+Vendor = Dell Inc
+Icon = dock-usb
+FirmwareSize = 0x10000
+Flags = require-ac,updatable
+DellDockUnlockTarget = 8
+DellDockBlobMajorOffset = 0x7F6E
+DellDockBlobMinorOffset = 0x7F6F
+InstallDuration = 14
+
+# USB hub2
+[DeviceInstanceId=USB\VID_413C&PID_B06E&hub]
+Name = RTS5487 in Dell dock
+Summary = USB 3.1 Generation 2 Hub
+ParentGuid = USB\VID_413C&PID_B06E&hub&embedded
+Vendor = Dell Inc
+Plugin = dell_dock
+Icon = dock-usb
+FirmwareSize = 0x10000
+Flags = require-ac,updatable,has-bridge
+DellDockUnlockTarget = 7
+DellDockBlobMajorOffset = 0x7F52
+DellDockBlobMinorOffset = 0x7F53
+InstallDuration = 3
+
+# Embedded Controller
+# Name is intentionally not set (it's queried by dock)
+[Guid=USB\VID_413C&PID_B06E&hub&embedded]
+Name = Dell dock
+Summary = High performance dock
+Plugin = dell_dock
+Vendor = Dell Inc
+Icon = dock-usb
+FirmwareSizeMin = 0x1FFC0
+FirmwareSizeMax = 0x20000
+Flags = require-ac
+Children = FuDellDockStatus|USB\VID_413C&PID_B06E&hub&status,FuDellDockMst|MST-panamera-vmm5331-259
+DellDockUnlockTarget = 1
+DellDockBoardMin = 6
+DellDockVersionLowest = 01.00.00.00
+DellDockBlobVersionOffset = 0x1AFC0
+InstallDuration = 60
+
+# Representation of overall dock update
+[DeviceInstanceId=USB\VID_413C&PID_B06E&hub&status]
+Name = Package level of Dell dock
+Summary = A representation of dock update status
+Plugin = dell_dock
+Vendor = Dell Inc
+FirmwareSize = 24
+InstallDuration = 5
+DellDockBlobVersionOffset = 0x14
+
+# MST Hub
+[Guid=MST-panamera-vmm5331-259]
+Name = VMM5331 in Dell dock
+Summary = Multi Stream Transport controller
+Vendor = Dell Inc
+Plugin = synapticsmst
+ParentGuid = USB\VID_413C&PID_B06E&hub&embedded
+Flags = skip-restart,require-ac
+FirmwareSize=524288
+DellDockUnlockTarget = 9
+InstallDuration = 95
+DellDockInstallDurationI2C=360
+DellDockBlobMajorOffset = 0x18400
+DellDockBlobMinorOffset = 0x18401
+DellDockBlobBuildOffset = 0x18402
+
+# Thunderbolt controller
+[Guid=TBT-00d4b070]
+Name = Thunderbolt controller in Dell dock
+Summary = Thunderbolt controller
+Vendor = Dell Inc
+ParentGuid = USB\VID_413C&PID_B06E&hub&embedded
+FirmwareSizeMin=0x40000
+FirmwareSizeMax=0x80000
+Flags = require-ac
+InstallDuration = 22
+DellDockInstallDurationI2C = 181
+DellDockUnlockTarget = 10
+DellDockHubVersionLowest = 1.31
+DellDockBlobMajorOffset = 0x400a
+DellDockBlobMinorOffset = 0x4009
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-common.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-common.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-common.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-common.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include "fu-dell-dock-common.h"
+#include "fu-device-locker.h"
+#include "fu-dell-dock-i2c-ec.h"
+
+gboolean
+fu_dell_dock_set_power (FuDevice *device, guint8 target,
+ gboolean enabled, GError **error)
+{
+ FuDevice *parent;
+ g_autoptr(FuDeviceLocker) locker = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ parent = FU_IS_DELL_DOCK_EC (device) ? device : fu_device_get_parent (device);
+
+ if (parent == NULL) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "Couldn't find parent for %s",
+ fu_device_get_name (device));
+ return FALSE;
+ }
+
+ locker = fu_device_locker_new (parent, error);
+ if (locker == NULL)
+ return FALSE;
+
+ return fu_dell_dock_ec_modify_lock (parent, target, enabled, error);
+}
+
+void
+fu_dell_dock_will_replug (FuDevice *device)
+{
+ guint64 timeout = fu_device_get_install_duration (device);
+
+ g_return_if_fail (FU_IS_DEVICE (device));
+
+ g_debug ("Activated %" G_GUINT64_FORMAT "s replug delay for %s",
+ timeout, fu_device_get_name (device));
+ fu_device_set_remove_delay (device, timeout * 1000);
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG);
+}
+
+void
+fu_dell_dock_clone_updatable (FuDevice *device)
+{
+ FuDevice *parent;
+ parent = fu_device_get_parent (device);
+ if (parent == NULL)
+ return;
+ if (fu_device_has_flag (parent, FWUPD_DEVICE_FLAG_UPDATABLE)) {
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
+ } else {
+ const gchar *message = fu_device_get_update_error (parent);
+ if (message != NULL)
+ fu_device_set_update_error (device, message);
+ fu_device_remove_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
+ }
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-common.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-common.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-common.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-common.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include "fu-device.h"
+#include "fu-dell-dock-i2c-ec.h"
+#include "fu-dell-dock-i2c-mst.h"
+#include "fu-dell-dock-i2c-tbt.h"
+#include "fu-dell-dock-hub.h"
+#include "fu-dell-dock-hid.h"
+#include "fu-dell-dock-status.h"
+
+#define DELL_DOCK_EC_INSTANCE_ID "USB\\VID_413C&PID_B06E&hub&embedded"
+#define DELL_DOCK_TBT_INSTANCE_ID "TBT-00d4b070"
+
+gboolean fu_dell_dock_set_power (FuDevice *device,
+ guint8 target,
+ gboolean enabled,
+ GError **error);
+void fu_dell_dock_will_replug (FuDevice *device);
+
+void fu_dell_dock_clone_updatable (FuDevice *device);
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hid.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hid.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hid.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hid.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,535 @@
+/*
+ * Copyright (C) 2018 Realtek Semiconductor Corporation
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#include "fu-usb-device.h"
+#include "fwupd-error.h"
+
+#include "fu-dell-dock-hid.h"
+
+#define HIDI2C_MAX_REGISTER 4
+#define HID_MAX_RETRIES 5
+#define TBT_MAX_RETRIES 2
+#define HIDI2C_TRANSACTION_TIMEOUT 2000
+
+#define HUB_CMD_READ_DATA 0xC0
+#define HUB_CMD_WRITE_DATA 0x40
+#define HUB_EXT_READ_STATUS 0x09
+#define HUB_EXT_MCUMODIFYCLOCK 0x06
+#define HUB_EXT_I2C_WRITE 0xC6
+#define HUB_EXT_WRITEFLASH 0xC8
+#define HUB_EXT_I2C_READ 0xD6
+#define HUB_EXT_VERIFYUPDATE 0xD9
+#define HUB_EXT_ERASEBANK 0xE8
+#define HUB_EXT_WRITE_TBT_FLASH 0xFF
+
+#define TBT_COMMAND_WAKEUP 0x00000000
+#define TBT_COMMAND_AUTHENTICATE 0xFFFFFFFF
+#define TBT_COMMAND_AUTHENTICATE_STATUS 0xFFFFFFFE
+
+typedef struct __attribute__ ((packed)) {
+ guint8 cmd;
+ guint8 ext;
+ union {
+ guint32 dwregaddr;
+ struct {
+ guint8 cmd_data0;
+ guint8 cmd_data1;
+ guint8 cmd_data2;
+ guint8 cmd_data3;
+ };
+ };
+ guint16 bufferlen;
+ FuHIDI2CParameters parameters;
+ guint8 extended_cmdarea[53];
+ guint8 data[192];
+} FuHIDCmdBuffer;
+
+typedef struct __attribute__ ((packed)) {
+ guint8 cmd;
+ guint8 ext;
+ guint8 i2cslaveaddr;
+ guint8 i2cspeed;
+ union {
+ guint32 startaddress;
+ guint32 tbt_command;
+ };
+ guint8 bufferlen;
+ guint8 extended_cmdarea[55];
+ guint8 data[192];
+} FuTbtCmdBuffer;
+
+static gboolean
+fu_dell_dock_hid_set_report (FuDevice *self,
+ guint8 *outbuffer,
+ GError **error)
+{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
+ gboolean ret;
+ gsize actual_len = 0;
+ for (gint i = 1; i <= HID_MAX_RETRIES; i++) {
+ g_autoptr(GError) error_local = NULL;
+ ret = g_usb_device_control_transfer (
+ usb_device, G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
+ G_USB_DEVICE_REQUEST_TYPE_CLASS,
+ G_USB_DEVICE_RECIPIENT_INTERFACE, HID_REPORT_SET, 0x0200,
+ 0x0000, outbuffer, 192, &actual_len,
+ HIDI2C_TRANSACTION_TIMEOUT, NULL, &error_local);
+ if (ret)
+ break;
+ if (i == HID_MAX_RETRIES ||
+ g_error_matches (error_local,
+ G_USB_DEVICE_ERROR,
+ G_USB_DEVICE_ERROR_NO_DEVICE)) {
+ g_propagate_error (error, g_steal_pointer (&error_local));
+ return FALSE;
+ } else {
+ g_debug ("attempt %d/%d: set control transfer failed: %s",
+ i, HID_MAX_RETRIES,
+ error_local->message);
+ sleep (1);
+ }
+ }
+ if (actual_len != 192) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "only wrote %" G_GSIZE_FORMAT "bytes", actual_len);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_hid_get_report (FuDevice *self,
+ guint8 *inbuffer,
+ GError **error)
+{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (FU_USB_DEVICE (self));
+ gboolean ret;
+ gsize actual_len = 0;
+ for (gint i = 1; i <= HID_MAX_RETRIES; i++) {
+ g_autoptr(GError) error_local = NULL;
+ ret = g_usb_device_control_transfer (
+ usb_device, G_USB_DEVICE_DIRECTION_DEVICE_TO_HOST,
+ G_USB_DEVICE_REQUEST_TYPE_CLASS,
+ G_USB_DEVICE_RECIPIENT_INTERFACE, HID_REPORT_GET, 0x0100,
+ 0x0000, inbuffer, 192, &actual_len,
+ HIDI2C_TRANSACTION_TIMEOUT, NULL, &error_local);
+ if (ret)
+ break;
+ if (i == HID_MAX_RETRIES ||
+ g_error_matches (error_local,
+ G_USB_DEVICE_ERROR,
+ G_USB_DEVICE_ERROR_NO_DEVICE)) {
+ g_propagate_error (error, g_steal_pointer (&error_local));
+ return FALSE;
+ } else {
+ g_debug ("attempt %d/%d: get control transfer failed: %s",
+ i, HID_MAX_RETRIES,
+ error_local->message);
+ }
+ }
+ if (actual_len != 192) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "only read %" G_GSIZE_FORMAT "bytes", actual_len);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_get_hub_version (FuDevice *self,
+ GError **error)
+{
+ g_autofree gchar *version = NULL;
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_READ_DATA,
+ .ext = HUB_EXT_READ_STATUS,
+ .cmd_data0 = 0,
+ .cmd_data1 = 0,
+ .cmd_data2 = 0,
+ .cmd_data3 = 0,
+ .bufferlen = GUINT16_TO_LE (12),
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (error, "failed to query hub version: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to query hub version: ");
+ return FALSE;
+ }
+
+ version = g_strdup_printf ("%02x.%02x",
+ cmd_buffer.data[10],
+ cmd_buffer.data[11]);
+ fu_device_set_version (self, version, FWUPD_VERSION_FORMAT_PAIR);
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_raise_mcu_clock (FuDevice *self,
+ gboolean enable,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_MCUMODIFYCLOCK,
+ .cmd_data0 = (guint8) enable,
+ .cmd_data1 = 0,
+ .cmd_data2 = 0,
+ .cmd_data3 = 0,
+ .bufferlen = 0,
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (error,
+ "failed to set mcu clock to %d: ",
+ enable);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_get_ec_status (FuDevice *self,
+ guint8 *status1,
+ guint8 *status2,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_READ_STATUS,
+ .cmd_data0 = 0,
+ .cmd_data1 = 0,
+ .cmd_data2 = 0,
+ .cmd_data3 = 0,
+ .bufferlen = GUINT16_TO_LE (27),
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (error, "failed to get EC status: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to get EC status: ");
+ return FALSE;
+ }
+
+ *status1 = cmd_buffer.data[25];
+ *status2 = cmd_buffer.data[26];
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_erase_bank (FuDevice *self, guint8 idx, GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_ERASEBANK,
+ .cmd_data0 = 0,
+ .cmd_data1 = idx,
+ .cmd_data2 = 0,
+ .cmd_data3 = 0,
+ .bufferlen = 0,
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (error, "failed to erase bank: ");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_write_flash (FuDevice *self,
+ guint32 dwAddr,
+ const guint8 *input,
+ gsize write_size,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_WRITEFLASH,
+ .dwregaddr = GUINT32_TO_LE (dwAddr),
+ .bufferlen = GUINT16_TO_LE (write_size),
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ g_return_val_if_fail (write_size <= HIDI2C_MAX_WRITE, FALSE);
+
+ memcpy (cmd_buffer.data, input, write_size);
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (
+ error, "failed to write %" G_GSIZE_FORMAT " flash to %x: ",
+ write_size, dwAddr);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_verify_update (FuDevice *self,
+ gboolean *result,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_VERIFYUPDATE,
+ .cmd_data0 = 1,
+ .cmd_data1 = 0,
+ .cmd_data2 = 0,
+ .cmd_data3 = 0,
+ .bufferlen = GUINT16_TO_LE (1),
+ .parameters = {.i2cslaveaddr = 0, .regaddrlen = 0, .i2cspeed = 0},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer,
+ error)) {
+ g_prefix_error (error, "failed to verify update: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to verify update: ");
+ return FALSE;
+ }
+ *result = cmd_buffer.data[0];
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_i2c_write (FuDevice *self,
+ const guint8 *input,
+ gsize write_size,
+ const FuHIDI2CParameters *parameters,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_I2C_WRITE,
+ .dwregaddr = 0,
+ .bufferlen = GUINT16_TO_LE (write_size),
+ .parameters = {.i2cslaveaddr = parameters->i2cslaveaddr,
+ .regaddrlen = 0,
+ .i2cspeed = parameters->i2cspeed | 0x80},
+ .extended_cmdarea[0 ... 52] = 0,
+ };
+
+ g_return_val_if_fail (write_size <= HIDI2C_MAX_WRITE, FALSE);
+
+ memcpy (cmd_buffer.data, input, write_size);
+
+ return fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error);
+}
+
+gboolean
+fu_dell_dock_hid_i2c_read (FuDevice *self,
+ guint32 cmd,
+ gsize read_size,
+ GBytes **bytes,
+ const FuHIDI2CParameters *parameters,
+ GError **error)
+{
+ FuHIDCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_WRITE_DATA,
+ .ext = HUB_EXT_I2C_READ,
+ .dwregaddr = GUINT32_TO_LE (cmd),
+ .bufferlen = GUINT16_TO_LE (read_size),
+ .parameters = {.i2cslaveaddr = parameters->i2cslaveaddr,
+ .regaddrlen = parameters->regaddrlen,
+ .i2cspeed = parameters->i2cspeed | 0x80},
+ .extended_cmdarea[0 ... 52] = 0,
+ .data[0 ... 191] = 0,
+ };
+
+ g_return_val_if_fail (read_size <= HIDI2C_MAX_READ, FALSE);
+ g_return_val_if_fail (bytes != NULL, FALSE);
+ g_return_val_if_fail (parameters->regaddrlen < HIDI2C_MAX_REGISTER, FALSE);
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error))
+ return FALSE;
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error))
+ return FALSE;
+
+ *bytes = g_bytes_new (cmd_buffer.data, read_size);
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_tbt_wake (FuDevice *self,
+ const FuHIDI2CParameters *parameters,
+ GError **error)
+{
+ FuTbtCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_READ_DATA, /* special write command that reads status result */
+ .ext = HUB_EXT_WRITE_TBT_FLASH,
+ .i2cslaveaddr = parameters->i2cslaveaddr,
+ .i2cspeed = parameters->i2cspeed, /* unlike other commands doesn't need | 0x80 */
+ .tbt_command = TBT_COMMAND_WAKEUP,
+ .bufferlen = 0,
+ .extended_cmdarea[0 ... 53] = 0,
+ .data[0 ... 191] = 0,
+ };
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error)) {
+ g_prefix_error (error, "failed to set wake thunderbolt: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to get wake thunderbolt status: ");
+ return FALSE;
+ }
+ g_debug ("thunderbolt wake result: 0x%x", cmd_buffer.data[1]);
+
+ return TRUE;
+}
+
+static const gchar *
+fu_dell_dock_hid_tbt_map_error (guint32 code)
+{
+ if (code == 1)
+ return g_strerror (EINVAL);
+ else if (code == 2)
+ return g_strerror (EPERM);
+
+ return g_strerror (EIO);
+}
+
+gboolean
+fu_dell_dock_hid_tbt_write (FuDevice *self,
+ guint32 start_addr,
+ const guint8 *input,
+ gsize write_size,
+ const FuHIDI2CParameters *parameters,
+ GError **error)
+{
+ FuTbtCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_READ_DATA, /* It's a special write command that reads status result */
+ .ext = HUB_EXT_WRITE_TBT_FLASH,
+ .i2cslaveaddr = parameters->i2cslaveaddr,
+ .i2cspeed = parameters->i2cspeed, /* unlike other commands doesn't need | 0x80 */
+ .startaddress = GUINT32_TO_LE (start_addr),
+ .bufferlen = write_size,
+ .extended_cmdarea[0 ... 53] = 0,
+ };
+ guint8 result;
+
+ g_return_val_if_fail (input != NULL, FALSE);
+ g_return_val_if_fail (write_size <= HIDI2C_MAX_WRITE, FALSE);
+
+ memcpy (cmd_buffer.data, input, write_size);
+
+ for (gint i = 1; i <= TBT_MAX_RETRIES; i++) {
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error)) {
+ g_prefix_error (error, "failed to run TBT update: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to get TBT flash status: ");
+ return FALSE;
+ }
+ result = cmd_buffer.data[1] & 0xf;
+ if (result == 0)
+ break;
+ g_debug ("attempt %d/%d: Thunderbolt write failed: %x",
+ i, TBT_MAX_RETRIES, result);
+ }
+ if (result != 0) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "Writing address 0x%04x failed: %s",
+ start_addr, fu_dell_dock_hid_tbt_map_error (result));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_dell_dock_hid_tbt_authenticate (FuDevice *self,
+ const FuHIDI2CParameters *parameters,
+ GError **error)
+{
+ FuTbtCmdBuffer cmd_buffer = {
+ .cmd = HUB_CMD_READ_DATA, /* It's a special write command that reads status result */
+ .ext = HUB_EXT_WRITE_TBT_FLASH,
+ .i2cslaveaddr = parameters->i2cslaveaddr,
+ .i2cspeed = parameters->i2cspeed, /* unlike other commands doesn't need | 0x80 */
+ .tbt_command = GUINT32_TO_LE (TBT_COMMAND_AUTHENTICATE),
+ .bufferlen = 0,
+ .extended_cmdarea[0 ... 53] = 0,
+ };
+ guint8 result;
+
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error)) {
+ g_prefix_error (error, "failed to send authentication: ");
+ return FALSE;
+ }
+
+ cmd_buffer.tbt_command = GUINT32_TO_LE (TBT_COMMAND_AUTHENTICATE_STATUS);
+ /* needs at least 2 seconds */
+ g_usleep (2000000);
+ for (gint i = 1; i <= TBT_MAX_RETRIES; i++) {
+ if (!fu_dell_dock_hid_set_report (self, (guint8 *) &cmd_buffer, error)) {
+ g_prefix_error (error, "failed to set check authentication: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_hid_get_report (self, cmd_buffer.data, error)) {
+ g_prefix_error (error, "failed to get check authentication: ");
+ return FALSE;
+ }
+ result = cmd_buffer.data[1] & 0xf;
+ if (result == 0)
+ break;
+ g_debug ("attempt %d/%d: Thunderbolt authenticate failed: %x",
+ i, TBT_MAX_RETRIES, result);
+ g_usleep (500000);
+ }
+ if (result != 0) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Thunderbolt authentication failed: %s",
+ fu_dell_dock_hid_tbt_map_error (result));
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hid.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hid.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hid.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hid.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2018 Realtek Semiconductor Corporation
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include
+
+#include "fu-device.h"
+
+typedef struct __attribute__ ((packed)) {
+ guint8 i2cslaveaddr;
+ guint8 regaddrlen;
+ guint8 i2cspeed;
+} FuHIDI2CParameters;
+
+typedef enum {
+ I2C_SPEED_250K,
+ I2C_SPEED_400K,
+ I2C_SPEED_800K,
+ /* */
+ I2C_SPEED_LAST,
+} BridgedI2CSpeed;
+
+#define HIDI2C_MAX_READ 192
+#define HIDI2C_MAX_WRITE 128
+
+gboolean fu_dell_dock_hid_i2c_write (FuDevice *self,
+ const guint8 *input,
+ gsize write_size,
+ const FuHIDI2CParameters *parameters,
+ GError **error);
+gboolean fu_dell_dock_hid_i2c_read (FuDevice *self,
+ guint32 cmd,
+ gsize read_size,
+ GBytes **bytes,
+ const FuHIDI2CParameters *parameters,
+ GError **error);
+
+gboolean fu_dell_dock_hid_get_hub_version (FuDevice *self,
+ GError **error);
+
+gboolean fu_dell_dock_hid_raise_mcu_clock (FuDevice *self,
+ gboolean enable,
+ GError **error);
+
+gboolean fu_dell_dock_hid_get_ec_status (FuDevice *self,
+ guint8 *status1,
+ guint8 *status2,
+ GError **error);
+
+gboolean fu_dell_dock_hid_erase_bank (FuDevice *self,
+ guint8 idx,
+ GError **error);
+
+gboolean fu_dell_dock_hid_write_flash (FuDevice *self,
+ guint32 addr,
+ const guint8 *input,
+ gsize write_size,
+ GError **error);
+
+gboolean fu_dell_dock_hid_verify_update (FuDevice *self,
+ gboolean *result,
+ GError **error);
+
+gboolean fu_dell_dock_hid_tbt_wake (FuDevice *self,
+ const FuHIDI2CParameters *parameters,
+ GError **error);
+
+gboolean fu_dell_dock_hid_tbt_write (FuDevice *self,
+ guint32 start_addr,
+ const guint8 *input,
+ gsize write_size,
+ const FuHIDI2CParameters *parameters,
+ GError **error);
+
+gboolean fu_dell_dock_hid_tbt_authenticate (FuDevice *self,
+ const FuHIDI2CParameters *parameters,
+ GError **error);
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hub.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hub.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hub.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hub.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include "fu-usb-device.h"
+#include "fwupd-error.h"
+
+#include "fu-dell-dock-common.h"
+
+struct _FuDellDockHub {
+ FuUsbDevice parent_instance;
+ guint8 unlock_target;
+ guint64 blob_major_offset;
+ guint64 blob_minor_offset;
+};
+
+G_DEFINE_TYPE (FuDellDockHub, fu_dell_dock_hub, FU_TYPE_USB_DEVICE)
+
+static gboolean
+fu_dell_dock_hub_probe (FuDevice *device, GError **error)
+{
+ g_autofree gchar *devid = NULL;
+
+ devid = g_strdup_printf ("USB\\VID_%04X&PID_%04X&hub",
+ (guint) fu_usb_device_get_vid (FU_USB_DEVICE (device)),
+ (guint) fu_usb_device_get_pid (FU_USB_DEVICE (device)));
+
+ fu_device_set_logical_id (device, "hub");
+ fu_device_add_instance_id (device, devid);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_hub_write_fw (FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuDellDockHub *self = FU_DELL_DOCK_HUB (device);
+ gsize fw_size = 0;
+ const guint8 *data = g_bytes_get_data (blob_fw, &fw_size);
+ gsize write_size =
+ (fw_size / HIDI2C_MAX_WRITE) >= 1 ? HIDI2C_MAX_WRITE : fw_size;
+ gsize nwritten = 0;
+ guint32 address = 0;
+ gboolean result = FALSE;
+ g_autofree gchar *dynamic_version = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ dynamic_version = g_strdup_printf ("%02x.%02x",
+ data[self->blob_major_offset],
+ data[self->blob_minor_offset]);
+ g_debug ("writing hub firmware version %s", dynamic_version);
+
+ if (!fu_dell_dock_set_power (device, self->unlock_target, TRUE, error))
+ return FALSE;
+
+ if (!fu_dell_dock_hid_raise_mcu_clock (device, TRUE, error))
+ return FALSE;
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
+ if (!fu_dell_dock_hid_erase_bank (device, 1, error))
+ return FALSE;
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ do {
+ /* last packet */
+ if (fw_size - nwritten < write_size)
+ write_size = fw_size - nwritten;
+
+ if (!fu_dell_dock_hid_write_flash (device, address, data,
+ write_size, error))
+ return FALSE;
+ nwritten += write_size;
+ data += write_size;
+ address += write_size;
+ fu_device_set_progress_full (device, nwritten, fw_size);
+ } while (nwritten < fw_size);
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_BUSY);
+ if (!fu_dell_dock_hid_verify_update (device, &result, error))
+ return FALSE;
+ if (!result) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "Failed to verify the update");
+ return FALSE;
+ }
+
+ /* dock will reboot to re-read; this is to appease the daemon */
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_PAIR);
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_hub_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuDellDockHub *self = FU_DELL_DOCK_HUB (device);
+
+ if (g_strcmp0 (key, "DellDockUnlockTarget") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp < G_MAXUINT8) {
+ self->unlock_target = tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "invalid DellDockUnlockTarget");
+ return FALSE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobMajorOffset") == 0) {
+ self->blob_major_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobMinorOffset") == 0) {
+ self->blob_minor_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+
+ /* failed */
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+static gboolean
+fu_dell_dock_hub_open (FuUsbDevice *fu_usb_device, GError **error)
+{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (fu_usb_device);
+
+ /* open device and clear status */
+ if (!g_usb_device_claim_interface (
+ usb_device, 0, /* HID */
+ G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER, error)) {
+ g_prefix_error (error, "failed to claim HID interface: ");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_hub_close (FuUsbDevice *fu_usb_device, GError **error)
+{
+ GUsbDevice *usb_device = fu_usb_device_get_dev (fu_usb_device);
+
+ if (!g_usb_device_release_interface (
+ usb_device, 0, /* HID */
+ G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER, error)) {
+ g_prefix_error (error, "failed to release interface: ");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+fu_dell_dock_hub_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (fu_dell_dock_hub_parent_class)->finalize (object);
+}
+
+static void
+fu_dell_dock_hub_init (FuDellDockHub *self)
+{
+}
+
+static void
+fu_dell_dock_hub_class_init (FuDellDockHubClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ FuUsbDeviceClass *klass_usb_device = FU_USB_DEVICE_CLASS (klass);
+ object_class->finalize = fu_dell_dock_hub_finalize;
+ klass_usb_device->open = fu_dell_dock_hub_open;
+ klass_usb_device->close = fu_dell_dock_hub_close;
+ klass_device->setup = fu_dell_dock_hid_get_hub_version;
+ klass_device->probe = fu_dell_dock_hub_probe;
+ klass_device->write_firmware = fu_dell_dock_hub_write_fw;
+ klass_device->set_quirk_kv = fu_dell_dock_hub_set_quirk_kv;
+}
+
+FuDellDockHub *
+fu_dell_dock_hub_new (FuUsbDevice *device)
+{
+ FuDellDockHub *self = g_object_new (FU_TYPE_DELL_DOCK_HUB, NULL);
+ fu_device_incorporate (FU_DEVICE (self), FU_DEVICE (device));
+ return self;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hub.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hub.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-hub.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-hub.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include "fu-usb-device.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_DELL_DOCK_HUB (fu_dell_dock_hub_get_type ())
+G_DECLARE_FINAL_TYPE (FuDellDockHub, fu_dell_dock_hub, FU, DELL_DOCK_HUB, FuUsbDevice)
+
+FuDellDockHub *fu_dell_dock_hub_new (FuUsbDevice *device);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-ec.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-ec.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-ec.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-ec.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,1027 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include
+
+#include "fu-common-version.h"
+#include "fu-usb-device.h"
+#include "fwupd-error.h"
+
+#include "fu-dell-dock-common.h"
+
+#define I2C_EC_ADDRESS 0xec
+
+#define EC_CMD_SET_DOCK_PKG 0x01
+#define EC_CMD_GET_DOCK_INFO 0x02
+#define EC_CMD_GET_DOCK_DATA 0x03
+#define EC_CMD_GET_DOCK_TYPE 0x05
+#define EC_CMD_MODIFY_LOCK 0x0a
+#define EC_CMD_RESET 0x0b
+#define EC_CMD_REBOOT 0x0c
+#define EC_CMD_PASSIVE 0x0d
+#define EC_GET_FW_UPDATE_STATUS 0x0f
+
+#define EXPECTED_DOCK_INFO_SIZE 0xb7
+#define EXPECTED_DOCK_TYPE 0x04
+
+#define TBT_MODE_MASK 0x01
+
+#define BIT_SET(x,y) (x |= (1<data->board_id);
+ summary = fu_device_get_metadata (device, board_type_str);
+ if (summary != NULL)
+ fu_device_set_summary (device, summary);
+}
+
+FuDevice *
+fu_dell_dock_ec_get_symbiote (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ return self->symbiote;
+}
+
+gboolean
+fu_dell_dock_ec_needs_tbt (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ gboolean port0_tbt_mode = self->data->port0_dock_status & TBT_MODE_MASK;
+
+ /* check for TBT module type */
+ if (self->data->module_type != MODULE_TYPE_TBT)
+ return FALSE;
+ g_debug ("found thunderbolt dock, port mode: %d", port0_tbt_mode);
+
+ return !port0_tbt_mode;
+}
+
+gboolean
+fu_dell_dock_ec_tbt_passive (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ if (self->passive_flow > 0) {
+ self->passive_flow |= PASSIVE_TBT_MASK;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static const gchar*
+fu_dell_dock_devicetype_to_str (guint device_type, guint sub_type)
+{
+ switch (device_type) {
+ case FU_DELL_DOCK_DEVICETYPE_MAIN_EC:
+ return "EC";
+ case FU_DELL_DOCK_DEVICETYPE_MST:
+ return "MST";
+ case FU_DELL_DOCK_DEVICETYPE_TBT:
+ return "Thunderbolt";
+ case FU_DELL_DOCK_DEVICETYPE_HUB:
+ if (sub_type == SUBTYPE_GEN2)
+ return "USB 3.1 Gen2";
+ else if (sub_type == SUBTYPE_GEN1)
+ return "USB 3.1 Gen1";
+ return NULL;
+ case FU_DELL_DOCK_DEVICETYPE_PD:
+ return "PD";
+ default:
+ return NULL;
+ }
+}
+
+static gboolean
+fu_dell_dock_ec_read (FuDevice *device, guint32 cmd, gsize length,
+ GBytes **bytes, GError **error)
+{
+ /* The first byte of result data will be the size of the return,
+ hide this from callers */
+ guint8 result_length = length + 1;
+ g_autoptr(GBytes) bytes_local = NULL;
+ const guint8 *result;
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (self->symbiote != NULL, FALSE);
+ g_return_val_if_fail (bytes != NULL, FALSE);
+
+ if (!fu_dell_dock_hid_i2c_read (self->symbiote, cmd, result_length,
+ &bytes_local, &ec_base_settings, error)) {
+ g_prefix_error (error, "read over HID-I2C failed: ");
+ return FALSE;
+ }
+ result = g_bytes_get_data (bytes_local, NULL);
+ /* first byte of result should be size of our data */
+ if (result[0] != length) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "Invalid result data: %d expected %" G_GSIZE_FORMAT,
+ result[0], length);
+ return FALSE;
+ }
+ *bytes = g_bytes_new (result + 1, length);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_write (FuDevice *device, gsize length, guint8 *data, GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (self->symbiote != NULL, FALSE);
+ g_return_val_if_fail (length > 1, FALSE);
+
+ if (!fu_dell_dock_hid_i2c_write (self->symbiote, data, length,
+ &ec_base_settings, error)) {
+ g_prefix_error (error, "write over HID-I2C failed: ");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_is_valid_dock (FuDevice *device, GError **error)
+{
+ g_autoptr(GBytes) data = NULL;
+ const guint8 *result = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ if (!fu_dell_dock_ec_read (device, EC_CMD_GET_DOCK_TYPE, 1, &data, error)) {
+ g_prefix_error (error, "Failed to query dock type: ");
+ return FALSE;
+ }
+ result = g_bytes_get_data (data, NULL);
+
+ if (result == NULL || *result != EXPECTED_DOCK_TYPE) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "No valid dock was found");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_get_dock_info (FuDevice *device,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ const FuDellDockDockInfoHeader *header = NULL;
+ const FuDellDockEcQueryEntry *device_entry = NULL;
+ const FuDellDockEcAddrMap *map = NULL;
+ const gchar *hub_version;
+ guint32 oldest_base_pd = 0;
+ g_autoptr(GBytes) data = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ if (!fu_dell_dock_ec_read (device, EC_CMD_GET_DOCK_INFO,
+ EXPECTED_DOCK_INFO_SIZE,
+ &data, error)) {
+ g_prefix_error (error, "Failed to query dock info: ");
+ return FALSE;
+ }
+ if (!g_bytes_get_data (data, NULL)) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "Failed to read dock info");
+ return FALSE;
+ }
+
+ header = (FuDellDockDockInfoHeader *) g_bytes_get_data (data, NULL);
+ if (!header) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "Failed to parse dock info");
+ return FALSE;
+ }
+
+ /* guard against EC not yet ready and fail init */
+ if (header->total_devices == 0) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_SIGNATURE_INVALID,
+ "No bridge devices detected, dock may be booting up");
+ return FALSE;
+ }
+ g_debug ("%u devices [%u->%u]",
+ header->total_devices,
+ header->first_index,
+ header->last_index);
+ device_entry =
+ (FuDellDockEcQueryEntry *) ((guint8 *) header + sizeof(FuDellDockDockInfoHeader));
+ for (guint i = 0; i < header->total_devices; i++) {
+ const gchar *type_str;
+ map = &(device_entry[i].ec_addr_map);
+ type_str = fu_dell_dock_devicetype_to_str (map->device_type, map->sub_type);
+ if (type_str == NULL)
+ continue;
+ g_debug ("#%u: %s in %s (A: %u I: %u)", i, type_str,
+ (map->location == LOCATION_BASE) ? "Base" : "Module",
+ map->arg, map->instance);
+ g_debug ("\tVersion32: %08x\tVersion8: %x %x %x %x",
+ device_entry[i].version.version_32,
+ device_entry[i].version.version_8[0],
+ device_entry[i].version.version_8[1],
+ device_entry[i].version.version_8[2],
+ device_entry[i].version.version_8[3]);
+ /* BCD but guint32 */
+ if (map->device_type == FU_DELL_DOCK_DEVICETYPE_MAIN_EC) {
+ self->raw_versions->ec_version = device_entry[i].version.version_32;
+ self->ec_version = g_strdup_printf (
+ "%02x.%02x.%02x.%02x", device_entry[i].version.version_8[0],
+ device_entry[i].version.version_8[1],
+ device_entry[i].version.version_8[2],
+ device_entry[i].version.version_8[3]);
+ g_debug ("\tParsed version %s", self->ec_version);
+ fu_device_set_version (FU_DEVICE (self), self->ec_version, FWUPD_VERSION_FORMAT_QUAD);
+
+ } else if (map->device_type == FU_DELL_DOCK_DEVICETYPE_MST) {
+ self->raw_versions->mst_version = device_entry[i].version.version_32;
+ /* guard against invalid MST version read from EC */
+ if (!fu_dell_dock_test_valid_byte (device_entry[i].version.version_8, 1)) {
+ g_warning ("[EC Bug] EC read invalid MST version %08x",
+ device_entry[i].version.version_32);
+ continue;
+ }
+ self->mst_version = g_strdup_printf ("%02x.%02x.%02x",
+ device_entry[i].version.version_8[1],
+ device_entry[i].version.version_8[2],
+ device_entry[i].version.version_8[3]);
+ g_debug ("\tParsed version %s", self->mst_version);
+ } else if (map->device_type == FU_DELL_DOCK_DEVICETYPE_TBT &&
+ self->data->module_type == MODULE_TYPE_TBT) {
+ /* guard against invalid Thunderbolt version read from EC */
+ if (!fu_dell_dock_test_valid_byte (device_entry[i].version.version_8, 2)) {
+ g_warning ("[EC bug] EC read invalid Thunderbolt version %08x",
+ device_entry[i].version.version_32);
+ continue;
+ }
+ self->raw_versions->tbt_version = device_entry[i].version.version_32;
+ self->tbt_version = g_strdup_printf ("%02x.%02x",
+ device_entry[i].version.version_8[2],
+ device_entry[i].version.version_8[3]);
+ g_debug ("\tParsed version %s", self->tbt_version);
+ } else if (map->device_type == FU_DELL_DOCK_DEVICETYPE_HUB) {
+ g_debug ("\thub subtype: %u", map->sub_type);
+ if (map->sub_type == SUBTYPE_GEN2)
+ self->raw_versions->hub2_version = device_entry[i].version.version_32;
+ else if (map->sub_type == SUBTYPE_GEN1)
+ self->raw_versions->hub1_version = device_entry[i].version.version_32;
+ } else if (map->device_type == FU_DELL_DOCK_DEVICETYPE_PD &&
+ map->location == LOCATION_BASE &&
+ map->sub_type == 0) {
+ if (oldest_base_pd == 0 ||
+ device_entry[i].version.version_32 < oldest_base_pd)
+ oldest_base_pd = GUINT32_TO_BE (device_entry[i].version.version_32);
+ g_debug ("\tParsed version: %02x.%02x.%02x.%02x",
+ device_entry[i].version.version_8[0],
+ device_entry[i].version.version_8[1],
+ device_entry[i].version.version_8[2],
+ device_entry[i].version.version_8[3]);
+ }
+ }
+
+ /* Thunderbolt SKU takes a little longer */
+ if (self->data->module_type == MODULE_TYPE_TBT) {
+ guint64 tmp = fu_device_get_install_duration (device);
+ fu_device_set_install_duration (device, tmp + 20);
+ }
+
+ /* minimum EC version this code will support */
+ if (fu_common_vercmp (self->ec_version, self->ec_minimum_version) < 0) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED,
+ "dock containing EC version %s is not supported",
+ self->ec_version);
+ return FALSE;
+ }
+
+ fu_device_set_version_lowest (device, self->ec_minimum_version);
+
+
+ /* Determine if the passive flow should be used when flashing */
+ hub_version = fu_device_get_version (self->symbiote);
+ if (fu_common_vercmp (hub_version, "1.42") >= 0) {
+ g_debug ("using passive flow");
+ self->passive_flow = PASSIVE_REBOOT_MASK;
+ fu_device_set_custom_flags (device, "skip-restart");
+ } else {
+ g_debug ("not using passive flow (EC: %s Hub2: %s)",
+ self->ec_version, hub_version);
+ }
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_get_dock_data (FuDevice *device,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ g_autoptr(GBytes) data = NULL;
+ g_autoptr(GString) name = NULL;
+ gchar service_tag[8] = {0x00};
+ const guint8 *result;
+ gsize length = sizeof(FuDellDockDockDataStructure);
+ g_autofree gchar *bundled_serial = NULL;
+ FuDellDockECFWUpdateStatus status;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ if (!fu_dell_dock_ec_read (device, EC_CMD_GET_DOCK_DATA, length,
+ &data, error)) {
+ g_prefix_error (error, "Failed to query dock info: ");
+ return FALSE;
+ }
+ result = g_bytes_get_data (data, NULL);
+ if (result == NULL) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "Failed to read dock data");
+ return FALSE;
+ }
+ if (g_bytes_get_size (data) != length) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE,
+ "Unexpected dock data size %" G_GSIZE_FORMAT,
+ g_bytes_get_size (data));
+ return FALSE;
+ }
+ memcpy (self->data, result, length);
+
+ /* guard against EC not yet ready and fail init */
+ name = g_string_new (self->data->marketing_name);
+ if (name->len > 0)
+ fu_device_set_name (device, name->str);
+ else
+ g_warning ("[EC bug] Invalid dock name detected");
+
+ if (self->data->module_type >= 0xfe)
+ g_warning ("[EC bug] Invalid module type 0x%02x",
+ self->data->module_type);
+
+ /* set serial number */
+ memcpy (service_tag, self->data->service_tag, 7);
+ bundled_serial = g_strdup_printf ("%s/%08" G_GUINT64_FORMAT,
+ service_tag,
+ self->data->module_serial);
+ fu_device_set_serial (device, bundled_serial);
+
+ /* copy this for being able to send in next commit transaction */
+ self->raw_versions->pkg_version = self->data->dock_firmware_pkg_ver;
+
+ /* read if passive update pending */
+ if (!fu_dell_dock_get_ec_status (device, &status, error))
+ return FALSE;
+
+ /* make sure this hardware spin matches our expecations */
+ if (self->data->board_id >= self->board_min) {
+ if (status != FW_UPDATE_IN_PROGRESS) {
+ fu_dell_dock_ec_set_board (device);
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_UPDATABLE);
+ } else {
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION);
+ fu_device_set_update_error (device, "An update is pending "
+ "next time the dock is "
+ "unplugged");
+ }
+ } else {
+ g_warning ("This utility does not support this board, disabling updates for %s",
+ fu_device_get_name (device));
+ }
+
+ return TRUE;
+}
+
+static void
+fu_dell_dock_ec_to_string (FuDevice *device, GString *str)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ gchar service_tag[8] = {0x00};
+
+ g_string_append (str, " FuDellDellDockEc:\n");
+ g_string_append_printf (str, "\tboard ID: %u\n",
+ self->data->board_id);
+ g_string_append_printf (str, "\tpower supply: %uW\n",
+ self->data->power_supply_wattage);
+ g_string_append_printf (str, "\tstatus (port0): %x\n",
+ self->data->port0_dock_status);
+ g_string_append_printf (str, "\tstatus (port1): %x\n",
+ self->data->port1_dock_status);
+ memcpy (service_tag, self->data->service_tag, 7);
+ g_string_append_printf (str, "\tservice tag: %s\n",
+ service_tag);
+ g_string_append_printf (str, "\tconfiguration: %u\n",
+ self->data->dock_configuration);
+ g_string_append_printf (str, "\tpackage firmware version: %x\n",
+ self->data->dock_firmware_pkg_ver);
+ g_string_append_printf (str, "\tmodule serial #: %08" G_GUINT64_FORMAT "\n",
+ self->data->module_serial);
+ g_string_append_printf (str, "\toriginal module serial #: %08" G_GUINT64_FORMAT "\n",
+ self->data->original_module_serial);
+ g_string_append_printf (str, "\ttype: %u\n",
+ self->data->dock_type);
+ g_string_append_printf (str, "\tmodule type: %x\n",
+ self->data->module_type);
+ g_string_append_printf (str, "\tminimum ec: %s\n",
+ self->ec_minimum_version);
+ g_string_append_printf (str, "\tpassive flow: %d\n",
+ self->passive_flow);
+}
+
+gboolean
+fu_dell_dock_ec_modify_lock (FuDevice *device,
+ guint8 target,
+ gboolean unlocked,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ guint32 cmd;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (target != 0, FALSE);
+
+ cmd = EC_CMD_MODIFY_LOCK | /* cmd */
+ 2 << 8 | /* length of data arguments */
+ target << 16 | /* device to operate on */
+ unlocked << 24; /* unlock/lock */
+
+
+ if (!fu_dell_dock_ec_write (device, 4, (guint8 *) &cmd, error)) {
+ g_prefix_error (error, "Failed to unlock device %d: ", target);
+ return FALSE;
+ }
+ g_debug ("Modified lock for %d to %d through %s (%s)",
+ target, unlocked,
+ fu_device_get_name (device),
+ fu_device_get_id (device));
+
+ if (unlocked)
+ BIT_SET (self->dock_unlock_status, target);
+ else
+ BIT_CLEAR (self->dock_unlock_status, target);
+ g_debug ("current overall unlock status: 0x%08x", self->dock_unlock_status);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_reset (FuDevice *device, GError **error)
+{
+ guint16 cmd = EC_CMD_RESET;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ return fu_dell_dock_ec_write (device, 2, (guint8 *) &cmd, error);
+}
+
+static gboolean
+fu_dell_dock_ec_activate (FuDevice *device, GError **error)
+{
+ FuDellDockECFWUpdateStatus status;
+
+ /* read if passive update pending */
+ if (!fu_dell_dock_get_ec_status (device, &status, error))
+ return FALSE;
+
+ if (status != FW_UPDATE_IN_PROGRESS) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "No firmware update pending for %s",
+ fu_device_get_name (device));
+ return FALSE;
+ }
+
+ return fu_dell_dock_ec_reset (device, error);
+}
+
+gboolean
+fu_dell_dock_ec_reboot_dock (FuDevice *device, GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ if (self->passive_flow > 0) {
+ guint32 cmd = EC_CMD_PASSIVE | /* cmd */
+ 1 << 8 | /* length of data arguments */
+ self->passive_flow << 16;
+ g_debug ("activating passive flow (%x) for %s",
+ self->passive_flow,
+ fu_device_get_name (device));
+ return fu_dell_dock_ec_write (device, 3, (guint8 *) &cmd, error);
+ } else {
+ guint16 cmd = EC_CMD_REBOOT;
+ g_debug ("rebooting %s", fu_device_get_name (device));
+ return fu_dell_dock_ec_write (device, 2, (guint8 *) &cmd, error);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_get_ec_status (FuDevice *device,
+ FuDellDockECFWUpdateStatus *status_out,
+ GError **error)
+{
+ g_autoptr(GBytes) data = NULL;
+ const guint8 *result = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (status_out != NULL, FALSE);
+
+ if (!fu_dell_dock_ec_read (device, EC_GET_FW_UPDATE_STATUS, 1,
+ &data, error)) {
+ g_prefix_error (error, "Failed to read FW update status: ");
+ return FALSE;
+ }
+ result = g_bytes_get_data (data, NULL);
+
+ if (!result) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND,
+ "Failed to read FW update status");
+ return FALSE;
+ }
+ *status_out = *result;
+ return TRUE;
+}
+
+const gchar*
+fu_dell_dock_ec_get_tbt_version (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ return self->tbt_version;
+}
+
+const gchar*
+fu_dell_dock_ec_get_mst_version (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ return self->mst_version;
+}
+
+guint32
+fu_dell_dock_ec_get_status_version (FuDevice *device)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ return self->raw_versions->pkg_version;
+}
+
+gboolean
+fu_dell_dock_ec_commit_package (FuDevice *device, GBytes *blob_fw,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ gsize length = 0;
+ const guint8 *data = g_bytes_get_data (blob_fw, &length);
+ g_autofree guint8 *payload = g_malloc0 (length + 2);
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ if (length != sizeof(FuDellDockDockPackageFWVersion)) {
+ g_set_error (error, G_IO_ERR, G_IO_ERROR_INVALID_DATA,
+ "Invalid package size %" G_GSIZE_FORMAT,
+ length);
+ return FALSE;
+ }
+ memcpy (self->raw_versions, data, length);
+
+ g_debug ("Committing (%zu) bytes ", sizeof(FuDellDockDockPackageFWVersion));
+ g_debug ("\tec_version: %x", self->raw_versions->ec_version);
+ g_debug ("\tmst_version: %x", self->raw_versions->mst_version);
+ g_debug ("\thub1_version: %x", self->raw_versions->hub1_version);
+ g_debug ("\thub2_version: %x", self->raw_versions->hub2_version);
+ g_debug ("\ttbt_version: %x", self->raw_versions->tbt_version);
+ g_debug ("\tpkg_version: %x", self->raw_versions->pkg_version);
+
+ payload [0] = EC_CMD_SET_DOCK_PKG;
+ payload [1] = length;
+ memcpy (payload + 2, data, length);
+
+ if (!fu_dell_dock_ec_write (device, length + 2, payload, error)) {
+ g_prefix_error (error, "Failed to query dock info: ");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_write_fw (FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+ FuDellDockECFWUpdateStatus status = FW_UPDATE_IN_PROGRESS;
+ guint8 progress1 = 0, progress0 = 0;
+ gsize fw_size = 0;
+ const guint8 *data = g_bytes_get_data (blob_fw, &fw_size);
+ gsize write_size =
+ (fw_size / HIDI2C_MAX_WRITE) >= 1 ? HIDI2C_MAX_WRITE : fw_size;
+ gsize nwritten = 0;
+ guint32 address = 0 | 0xff << 24;
+ g_autofree gchar *dynamic_version = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ dynamic_version = g_strndup ((gchar *) data + self->blob_version_offset, 11);
+ g_debug ("writing EC firmware version %s", dynamic_version);
+
+ if (!fu_dell_dock_ec_modify_lock (device, self->unlock_target, TRUE, error))
+ return FALSE;
+
+ if (!fu_dell_dock_hid_raise_mcu_clock (self->symbiote, TRUE, error))
+ return FALSE;
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
+ if (!fu_dell_dock_hid_erase_bank (self->symbiote, 0xff, error))
+ return FALSE;
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ do {
+ /* last packet */
+ if (fw_size - nwritten < write_size)
+ write_size = fw_size - nwritten;
+
+ if (!fu_dell_dock_hid_write_flash (self->symbiote, address, data,
+ write_size, error)) {
+ g_prefix_error (error, "write over HID failed: ");
+ return FALSE;
+ }
+ fu_device_set_progress_full (device, nwritten, fw_size);
+ nwritten += write_size;
+ data += write_size;
+ address += write_size;
+ } while (nwritten < fw_size);
+
+ if (!fu_dell_dock_hid_raise_mcu_clock (self->symbiote, FALSE, error))
+ return FALSE;
+
+ /* dock will reboot to re-read; this is to appease the daemon */
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_QUAD);
+
+ /* activate passive behavior */
+ if (self->passive_flow)
+ self->passive_flow |= PASSIVE_RESET_MASK;
+
+ if (fu_device_has_custom_flag (device, "skip-restart")) {
+ g_debug ("Skipping EC reset per quirk request");
+ fu_device_add_flag (device, FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION);
+ return TRUE;
+ }
+
+ if (!fu_dell_dock_ec_reset (device, error))
+ return FALSE;
+
+ /* notify daemon that this device will need to replug */
+ fu_dell_dock_will_replug (device);
+
+ /* poll for completion status */
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_BUSY);
+ while (status != FW_UPDATE_COMPLETE) {
+ g_autoptr(GError) error_local = NULL;
+
+ if (!fu_dell_dock_hid_get_ec_status (self->symbiote, &progress1,
+ &progress0, error)) {
+ g_prefix_error (error, "Failed to read scratch: ");
+ return FALSE;
+ }
+ g_debug ("Read %u and %u from scratch", progress1, progress0);
+ if (progress0 > 100)
+ progress0 = 100;
+ fu_device_set_progress_full (device, progress0, 100);
+
+ /* This is expected to fail until update is done */
+ if (!fu_dell_dock_get_ec_status (device, &status,
+ &error_local)) {
+ g_debug ("Flash EC Received result: %s (status %u)",
+ error_local->message, status);
+ return TRUE;
+ }
+ if (status == FW_UPDATE_AUTHENTICATION_FAILED) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "invalid EC firmware image");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ if (g_strcmp0 (key, "DellDockUnlockTarget") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp < G_MAXUINT8) {
+ self->unlock_target = tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "invalid DellDockUnlockTarget");
+ return FALSE;
+ }
+ if (g_strcmp0 (key, "DellDockBoardMin") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp < G_MAXUINT8) {
+ self->board_min = tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "invalid DellDockBoardMin");
+ return FALSE;
+ }
+ if (g_strcmp0 (key, "DellDockVersionLowest") == 0) {
+ self->ec_minimum_version = g_strdup (value);
+ return TRUE;
+ }
+ if (g_str_has_prefix (key, "DellDockBoard")) {
+ fu_device_set_metadata (device, key, value);
+ return TRUE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobVersionOffset") == 0) {
+ self->blob_version_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+
+ /* failed */
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+static gboolean
+fu_dell_dock_ec_probe (FuDevice *device, GError **error)
+{
+ /* this will trigger setting up all the quirks */
+ fu_device_add_instance_id (device, DELL_DOCK_EC_INSTANCE_ID);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_query (FuDevice *device, GError **error)
+{
+ if (!fu_dell_dock_ec_get_dock_data (device, error))
+ return FALSE;
+
+ return fu_dell_dock_ec_get_dock_info (device, error);
+}
+
+static gboolean
+fu_dell_dock_ec_setup (FuDevice *device, GError **error)
+{
+ g_autoptr(GError) error_local = NULL;
+ GPtrArray *children;
+
+ /* if query looks bad, wait a few seconds and retry */
+ if (!fu_dell_dock_ec_query (device, &error_local)) {
+ if (g_error_matches (error_local,
+ FWUPD_ERROR,
+ FWUPD_ERROR_SIGNATURE_INVALID)) {
+ g_warning ("%s", error_local->message);
+ g_usleep (2 * G_USEC_PER_SEC);
+ if (!fu_dell_dock_ec_query (device, error))
+ return FALSE;
+ } else {
+ g_propagate_error (error, g_steal_pointer (&error_local));
+ return FALSE;
+ }
+ }
+
+ /* call setup on all the children we produced */
+ children = fu_device_get_children (device);
+ for (guint i=0 ; i < children->len; i++) {
+ FuDevice *child = g_ptr_array_index (children, i);
+ g_autoptr(FuDeviceLocker) locker = NULL;
+ g_debug ("setup %s",
+ fu_device_get_name (child));
+ locker = fu_device_locker_new (child, error);
+ if (locker == NULL)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_ec_open (FuDevice *device, GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ if (!fu_device_open (self->symbiote, error))
+ return FALSE;
+
+ return fu_dell_dock_is_valid_dock (device, error);
+}
+
+static gboolean
+fu_dell_dock_ec_close (FuDevice *device, GError **error)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (device);
+
+ return fu_device_close (self->symbiote, error);
+}
+
+static void
+fu_dell_dock_ec_finalize (GObject *object)
+{
+ FuDellDockEc *self = FU_DELL_DOCK_EC (object);
+ g_object_unref (self->symbiote);
+ g_free (self->ec_version);
+ g_free (self->mst_version);
+ g_free (self->tbt_version);
+ g_free (self->data);
+ g_free (self->raw_versions);
+ g_free (self->ec_minimum_version);
+ G_OBJECT_CLASS (fu_dell_dock_ec_parent_class)->finalize (object);
+}
+
+static void
+fu_dell_dock_ec_init (FuDellDockEc *self)
+{
+ self->data = g_new0 (FuDellDockDockDataStructure, 1);
+ self->raw_versions = g_new0 (FuDellDockDockPackageFWVersion, 1);
+}
+
+static void
+fu_dell_dock_ec_class_init (FuDellDockEcClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ object_class->finalize = fu_dell_dock_ec_finalize;
+ klass_device->activate = fu_dell_dock_ec_activate;
+ klass_device->to_string = fu_dell_dock_ec_to_string;
+ klass_device->probe = fu_dell_dock_ec_probe;
+ klass_device->setup = fu_dell_dock_ec_setup;
+ klass_device->open = fu_dell_dock_ec_open;
+ klass_device->close = fu_dell_dock_ec_close;
+ klass_device->write_firmware = fu_dell_dock_ec_write_fw;
+ klass_device->set_quirk_kv = fu_dell_dock_ec_set_quirk_kv;
+}
+
+FuDellDockEc *
+fu_dell_dock_ec_new (FuDevice *symbiote)
+{
+ FuDellDockEc *self = NULL;
+
+ self = g_object_new (FU_TYPE_DELL_DOCK_EC, NULL);
+ self->symbiote = g_object_ref (symbiote);
+ fu_device_set_physical_id (FU_DEVICE (self),
+ fu_device_get_physical_id (self->symbiote));
+ fu_device_set_logical_id (FU_DEVICE (self), "ec");
+
+ return self;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-ec.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-ec.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-ec.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-ec.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include
+
+#include "fu-device.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_DELL_DOCK_EC (fu_dell_dock_ec_get_type ())
+G_DECLARE_FINAL_TYPE (FuDellDockEc, fu_dell_dock_ec, FU, DELL_DOCK_EC, FuDevice)
+
+FuDellDockEc *fu_dell_dock_ec_new (FuDevice *symbiote);
+
+G_END_DECLS
+
+gboolean fu_dell_dock_ec_needs_tbt (FuDevice *device);
+gboolean fu_dell_dock_ec_tbt_passive (FuDevice *device);
+gboolean fu_dell_dock_ec_modify_lock (FuDevice *self,
+ guint8 target,
+ gboolean unlocked,
+ GError **error);
+
+gboolean fu_dell_dock_ec_reboot_dock (FuDevice *device,
+ GError **error);
+
+const gchar *fu_dell_dock_ec_get_mst_version (FuDevice *device);
+const gchar *fu_dell_dock_ec_get_tbt_version (FuDevice *device);
+guint32 fu_dell_dock_ec_get_status_version (FuDevice *device);
+gboolean fu_dell_dock_ec_commit_package (FuDevice *device,
+ GBytes *blob_fw,
+ GError **error);
+FuDevice *fu_dell_dock_ec_get_symbiote (FuDevice *device);
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-mst.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-mst.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-mst.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-mst.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,990 @@
+/*
+ * Copyright (C) 2018 Synaptics
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include
+
+#include "fu-common.h"
+
+#include "fu-dell-dock-common.h"
+
+#define I2C_MST_ADDRESS 0x72
+
+/* MST registers */
+#define MST_RC_TRIGGER_ADDR 0x2000fc
+#define MST_CORE_MCU_BOOTLOADER_STS 0x20010c
+#define MST_RC_COMMAND_ADDR 0x200110
+#define MST_RC_OFFSET_ADDR 0x200114
+#define MST_RC_LENGTH_ADDR 0x200118
+#define MST_RC_DATA_ADDR 0x200120
+#define MST_CORE_MCU_FW_VERSION 0x200160
+#define MST_REG_QUAD_DISABLE 0x200fc0
+#define MST_REG_HDCP22_DISABLE 0x200f90
+
+/* MST remote control commands */
+#define MST_CMD_ENABLE_REMOTE_CONTROL 0x1
+#define MST_CMD_DISABLE_REMOTE_CONTROL 0x2
+#define MST_CMD_CHECKSUM 0x11
+#define MST_CMD_ERASE_FLASH 0x14
+#define MST_CMD_WRITE_FLASH 0x20
+#define MST_CMD_READ_FLASH 0x30
+#define MST_CMD_WRITE_MEMORY 0x21
+#define MST_CMD_READ_MEMORY 0x31
+
+/* Arguments related to flashing */
+#define FLASH_SECTOR_ERASE_4K 0x1000
+#define FLASH_SECTOR_ERASE_32K 0x2000
+#define FLASH_SECTOR_ERASE_64K 0x3000
+#define EEPROM_TAG_OFFSET 0x1fff0
+#define EEPROM_BANK_OFFSET 0x20000
+#define EEPROM_ESM_OFFSET 0x40000
+
+/* Flash offsets */
+#define MST_BOARDID_OFFSET 0x10e
+
+/* Remote control offsets */
+#define MST_CHIPID_OFFSET 0x1500
+
+/* magic triggers */
+#define MST_TRIGGER_WRITE 0xf2
+#define MST_TRIGGER_REBOOT 0xf5
+
+/* IDs used in DELL_DOCK */
+#define EXPECTED_CHIPID 0x5331
+
+/* firmware file offsets */
+#define MST_BLOB_VERSION_OFFSET 0x06F0
+
+typedef enum {
+ Bank0,
+ Bank1,
+ ESM,
+} MSTBank;
+
+typedef struct {
+ guint start;
+ guint length;
+} MSTBankAttributes;
+
+const MSTBankAttributes bank0_attributes = {
+ .start = 0,
+ .length = EEPROM_BANK_OFFSET,
+};
+
+const MSTBankAttributes bank1_attributes = {
+ .start = EEPROM_BANK_OFFSET,
+ .length = EEPROM_BANK_OFFSET,
+};
+
+const MSTBankAttributes esm_attributes = {
+ .start = EEPROM_ESM_OFFSET,
+ .length = 0x3ffff
+};
+
+FuHIDI2CParameters mst_base_settings = {
+ .i2cslaveaddr = I2C_MST_ADDRESS,
+ .regaddrlen = 0,
+ .i2cspeed = I2C_SPEED_400K,
+};
+
+struct _FuDellDockMst {
+ FuDevice parent_instance;
+ FuDevice *symbiote;
+ guint8 unlock_target;
+ guint64 blob_major_offset;
+ guint64 blob_minor_offset;
+ guint64 blob_build_offset;
+};
+
+G_DEFINE_TYPE (FuDellDockMst, fu_dell_dock_mst, FU_TYPE_DEVICE)
+
+/**
+ * fu_dell_dock_mst_get_bank_attribs:
+ * @bank: An MSTBank
+ * @out (out): The MSTBankAttributes attribute that matches
+ * @error: the #GError, or %NULL
+ *
+ * Returns a structure that corresponds to the attributes for a bank
+ *
+ * Returns: %TRUE for success
+ **/
+static gboolean
+fu_dell_dock_mst_get_bank_attribs (MSTBank bank,
+ const MSTBankAttributes **out,
+ GError **error)
+{
+ switch (bank) {
+ case Bank0:
+ *out = &bank0_attributes;
+ break;
+ case Bank1:
+ *out = &bank1_attributes;
+ break;
+ case ESM:
+ *out = &esm_attributes;
+ break;
+ default:
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL,
+ "Invalid bank specified %u", bank);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_rc_command (FuDevice *symbiote,
+ guint8 cmd,
+ guint32 length,
+ guint32 offset,
+ const guint8 *data,
+ GError **error);
+
+static gboolean
+fu_dell_dock_mst_read_register (FuDevice *symbiote,
+ guint32 address,
+ gsize length,
+ GBytes **bytes,
+ GError **error)
+{
+ g_return_val_if_fail (symbiote != NULL, FALSE);
+ g_return_val_if_fail (bytes != NULL, FALSE);
+ g_return_val_if_fail (length <= 32, FALSE);
+
+ /* write the offset we're querying */
+ if (!fu_dell_dock_hid_i2c_write (symbiote, (guint8 *) &address, 4,
+ &mst_base_settings, error))
+ return FALSE;
+
+ /* read data for the result */
+ if (!fu_dell_dock_hid_i2c_read (symbiote, 0, length, bytes,
+ &mst_base_settings, error))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_write_register (FuDevice *symbiote,
+ guint32 address,
+ guint8 *data,
+ gsize length,
+ GError **error)
+{
+ g_autofree guint8 *buffer = g_malloc0 (length + 4);
+ memcpy (buffer, &address, 4);
+ memcpy (buffer + 4, data, length);
+
+ g_return_val_if_fail (symbiote != NULL, FALSE);
+ g_return_val_if_fail (data != NULL, FALSE);
+
+ /* write the offset we're querying */
+ return fu_dell_dock_hid_i2c_write (symbiote, buffer, length + 4,
+ &mst_base_settings, error);
+}
+
+static gboolean
+fu_dell_dock_mst_query_active_bank (FuDevice *symbiote,
+ MSTBank *active,
+ GError **error)
+{
+ g_autoptr(GBytes) bytes = NULL;
+ const guint32 *data = NULL;
+ gsize length = 4;
+
+ if (!fu_dell_dock_mst_read_register (symbiote, MST_CORE_MCU_BOOTLOADER_STS,
+ length, &bytes, error)) {
+ g_prefix_error (error, "Failed to query active bank: ");
+ return FALSE;
+ }
+
+ data = g_bytes_get_data (bytes, &length);
+ if ((data[0] & (1 << 7)) || (data[0] & (1 << 30)))
+ *active = Bank1;
+ else
+ *active = Bank0;
+ g_debug ("MST: active bank is: %u", *active);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_disable_remote_control (FuDevice *symbiote, GError **error)
+{
+ g_debug ("MST: Disabling remote control");
+ return fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_DISABLE_REMOTE_CONTROL,
+ 0, 0,
+ NULL,
+ error);
+}
+
+static gboolean
+fu_dell_dock_mst_enable_remote_control (FuDevice *symbiote, GError **error)
+{
+ g_autoptr(GError) error_local = NULL;
+ const gchar *data = "PRIUS";
+
+ g_debug ("MST: Enabling remote control");
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_ENABLE_REMOTE_CONTROL,
+ 5, 0,
+ (guint8 *) data,
+ &error_local)) {
+ g_debug ("Failed to enable remote control: %s",
+ error_local->message);
+ /* try to disable / re-enable */
+ if (!fu_dell_dock_mst_disable_remote_control (symbiote, error))
+ return FALSE;
+ return fu_dell_dock_mst_enable_remote_control (symbiote, error);
+ }
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_trigger_rc_command (FuDevice *symbiote, GError **error)
+{
+ const guint8 *result = NULL;
+ guint32 tmp;
+
+ /* Trigger the write */
+ tmp = MST_TRIGGER_WRITE;
+ if (!fu_dell_dock_mst_write_register (symbiote,
+ MST_RC_TRIGGER_ADDR,
+ (guint8 *) &tmp, sizeof(guint32),
+ error)) {
+ g_prefix_error (error, "Failed to write MST_RC_TRIGGER_ADDR: ");
+ return FALSE;
+ }
+ /* poll for completion */
+ tmp = 0xffff;
+ for (guint i = 0; i < 1000; i++) {
+ g_autoptr(GBytes) bytes = NULL;
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_COMMAND_ADDR,
+ sizeof(guint32), &bytes,
+ error)) {
+ g_prefix_error (error,
+ "Failed to poll MST_RC_COMMAND_ADDR");
+ return FALSE;
+ }
+ result = g_bytes_get_data (bytes, NULL);
+ /* complete */
+ if ((result[2] & 0x80) == 0) {
+ tmp = result[3];
+ break;
+ }
+ g_usleep (2000);
+ }
+ switch (tmp) {
+ /* need to enable remote control */
+ case 4:
+ return fu_dell_dock_mst_enable_remote_control (symbiote, error);
+ /* error scenarios */
+ case 3:
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Unknown error");
+ return FALSE;
+ case 2:
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Unsupported command");
+ return FALSE;
+ case 1:
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Invalid argument");
+ return FALSE;
+ /* success scenario */
+ case 0:
+ return TRUE;
+
+ default:
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Command timed out or unknown failure: %x",
+ tmp);
+ return FALSE;
+ }
+}
+
+static gboolean
+fu_dell_dock_mst_rc_command (FuDevice *symbiote,
+ guint8 cmd,
+ guint32 length,
+ guint32 offset,
+ const guint8 *data,
+ GError **error)
+{
+ /* 4 for cmd, 4 for offset, 4 for length, 4 for garbage */
+ gint buffer_len = (data == NULL) ? 12 : length + 16;
+ g_autofree guint8 *buffer = g_malloc0 (buffer_len);
+ guint32 tmp;
+
+ g_return_val_if_fail (symbiote != NULL, FALSE);
+
+ /* command */
+ tmp = (cmd | 0x80) << 16;
+ memcpy (buffer, &tmp, 4);
+ /* offset */
+ memcpy (buffer + 4, &offset, 4);
+ /* length */
+ memcpy (buffer + 8, &length, 4);
+ /* data */
+ if (data != NULL)
+ memcpy (buffer + 16, data, length);
+
+ /* write the combined register stream */
+ if (!fu_dell_dock_mst_write_register (symbiote, MST_RC_COMMAND_ADDR,
+ buffer, buffer_len, error))
+ return FALSE;
+
+ return fu_dell_dock_trigger_rc_command (symbiote, error);
+}
+
+static gboolean
+fu_dell_dock_mst_read_chipid (FuDevice *symbiote,
+ guint16 *chip_id,
+ GError **error)
+{
+ g_autoptr(GBytes) bytes = NULL;
+ const guint8 *data;
+ gsize length = 4;
+
+ g_return_val_if_fail (chip_id != NULL, FALSE);
+
+ /* run an RC command to get data from memory */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_READ_MEMORY,
+ length, MST_CHIPID_OFFSET,
+ NULL,
+ error))
+ return FALSE;
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ length,
+ &bytes,
+ error))
+ return FALSE;
+ data = g_bytes_get_data (bytes, &length);
+ *chip_id = (data[1] << 8) | data[2];
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_check_offset (guint8 byte, guint8 offset)
+{
+ if ((byte & offset) != 0)
+ return TRUE;
+ return FALSE;
+}
+
+static gboolean
+fu_d19_mst_check_fw (FuDevice *symbiote, GError **error)
+{
+ g_autoptr(GBytes) bytes = NULL;
+ const guint8 *data;
+ gsize length = 4;
+
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_CORE_MCU_BOOTLOADER_STS,
+ length, &bytes,
+ error))
+ return FALSE;
+ data = g_bytes_get_data (bytes, &length);
+
+ g_debug ("MST: firmware check: %d",
+ fu_dell_dock_mst_check_offset (data[0], 0x01));
+ g_debug ("MST: HDCP key check: %d",
+ fu_dell_dock_mst_check_offset (data[0], 0x02));
+ g_debug ("MST: Config0 check: %d",
+ fu_dell_dock_mst_check_offset (data[0], 0x04));
+ g_debug ("MST: Config1 check: %d",
+ fu_dell_dock_mst_check_offset (data[0], 0x08));
+
+ if (fu_dell_dock_mst_check_offset (data[0], 0xF0))
+ g_debug ("MST: running in bootloader");
+ else
+ g_debug ("MST: running in firmware");
+ g_debug ("MST: Error code: %x", data[1]);
+ g_debug ("MST: GPIO boot strap record: %d", data[2]);
+ g_debug ("MST: Bootloader version number %x", data[3]);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_checksum_bank (FuDevice *symbiote,
+ GBytes *blob_fw,
+ MSTBank bank,
+ gboolean *checksum,
+ GError **error)
+{
+ g_autoptr(GBytes) csum_bytes = NULL;
+ const MSTBankAttributes *attribs = NULL;
+ gsize length = 0;
+ const guint8 *data = g_bytes_get_data (blob_fw, &length);
+ guint32 payload_sum = 0;
+ guint32 bank_sum = 0;
+
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+ g_return_val_if_fail (checksum != NULL, FALSE);
+
+ if (!fu_dell_dock_mst_get_bank_attribs (bank, &attribs, error))
+ return FALSE;
+
+ /* bank is specified outside of payload */
+ if (attribs->start + attribs->length > length) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Payload %u is bigger than bank %u",
+ attribs->start + attribs->length, bank);
+ return FALSE;
+ }
+
+ /* checksum the file */
+ for (guint i = attribs->start; i < attribs->length + attribs->start;
+ i++) {
+ payload_sum += data[i];
+ }
+ g_debug ("MST: Payload checksum: 0x%x", payload_sum);
+
+ /* checksum the bank */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_CHECKSUM,
+ attribs->length, attribs->start,
+ NULL,
+ error)) {
+ g_prefix_error (error, "Failed to checksum bank %u: ", bank);
+ return FALSE;
+ }
+ /* read result from data register */
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ 4, &csum_bytes, error))
+ return FALSE;
+ data = g_bytes_get_data (csum_bytes, NULL);
+ bank_sum = GUINT32_FROM_LE (data[0] | data[1] << 8 | data[2] << 16 |
+ data[3] << 24);
+ g_debug ("MST: Bank %u checksum: 0x%x", bank, bank_sum);
+
+ *checksum = (bank_sum == payload_sum);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_erase_bank (FuDevice *symbiote, MSTBank bank, GError **error)
+{
+ const MSTBankAttributes *attribs = NULL;
+ guint32 sector;
+
+ if (!fu_dell_dock_mst_get_bank_attribs (bank, &attribs, error))
+ return FALSE;
+
+ for (guint32 i = attribs->start; i < attribs->start + attribs->length;
+ i += 0x10000) {
+ sector = FLASH_SECTOR_ERASE_64K | (i / 0x10000);
+ g_debug ("MST: Erasing sector 0x%x", sector);
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_ERASE_FLASH,
+ 4, 0,
+ (guint8 *) §or,
+ error)) {
+ g_prefix_error (
+ error, "Failed to erase sector 0x%x: ", sector);
+ return FALSE;
+ }
+ }
+ g_debug ("MST: Waiting for flash clear to settle");
+ g_usleep (5000000);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_write_flash_bank (FuDevice *device,
+ GBytes *blob_fw,
+ MSTBank bank,
+ GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+ const MSTBankAttributes *attribs = NULL;
+ gsize write_size = 32;
+ guint end;
+ const guint8 *data = g_bytes_get_data (blob_fw, NULL);
+
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ if (!fu_dell_dock_mst_get_bank_attribs (bank, &attribs, error))
+ return FALSE;
+ end = attribs->start + attribs->length;
+
+ g_debug ("MST: Writing payload to bank %u", bank);
+ for (guint i = attribs->start; i < end; i += write_size) {
+ if (!fu_dell_dock_mst_rc_command (self->symbiote,
+ MST_CMD_WRITE_FLASH,
+ write_size, i,
+ data + i,
+ error)) {
+ g_prefix_error (
+ error,
+ "Failed to write bank %u payload offset 0x%x: ",
+ bank, i);
+ return FALSE;
+ }
+ fu_device_set_progress_full (device,
+ i - attribs->start,
+ end - attribs->start);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_stop_esm (FuDevice *symbiote, GError **error)
+{
+ g_autoptr(GBytes) quad_bytes = NULL;
+ g_autoptr(GBytes) hdcp_bytes = NULL;
+ guint32 payload = 0x21;
+ gsize length = sizeof(guint32);
+ const guint8 *data;
+ guint8 data_out[sizeof(guint32)];
+
+ /* disable ESM first */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_WRITE_MEMORY,
+ length, MST_RC_TRIGGER_ADDR,
+ (guint8 *) &payload,
+ error))
+ return FALSE;
+
+ /* waiting for ESM exit */
+ g_usleep(200);
+
+ /* disable QUAD mode */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_READ_MEMORY,
+ length, MST_REG_QUAD_DISABLE,
+ NULL,
+ error))
+ return FALSE;
+
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ length, &quad_bytes,
+ error))
+ return FALSE;
+
+ data = g_bytes_get_data (quad_bytes, &length);
+ memcpy (data_out, data, length);
+ data_out[0] = 0x00;
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_WRITE_MEMORY,
+ length, MST_REG_QUAD_DISABLE,
+ data_out, error))
+ return FALSE;
+
+ /* disable HDCP2.2 */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_READ_MEMORY,
+ length, MST_REG_HDCP22_DISABLE,
+ NULL,
+ error))
+ return FALSE;
+
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ length,
+ &hdcp_bytes,
+ error))
+ return FALSE;
+
+ data = g_bytes_get_data (hdcp_bytes, &length);
+ memcpy (data_out, data, length);
+ data_out[0] = data[0] & (1 << 2);
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_WRITE_MEMORY,
+ length, MST_REG_HDCP22_DISABLE,
+ data_out,
+ error))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_invalidate_bank (FuDevice *symbiote, MSTBank bank_in_use,
+ GError **error)
+{
+ const MSTBankAttributes *attribs;
+ g_autoptr(GBytes) bytes = NULL;
+ const guint8 *crc_tag;
+ const guint8 *new_tag;
+ guint32 crc_offset;
+ guint retries = 2;
+
+ if (!fu_dell_dock_mst_get_bank_attribs (bank_in_use, &attribs, error)) {
+ g_prefix_error (error, "unable to invalidate bank: ");
+ return FALSE;
+ }
+ /* we need to write 4 byte increments over I2C so this differs from DP aux */
+ crc_offset = attribs->start + EEPROM_TAG_OFFSET + 12;
+
+ /* Read CRC byte to flip */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_READ_FLASH,
+ 4, crc_offset,
+ NULL,
+ error)) {
+
+ g_prefix_error (error, "failed to read tag from flash: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ 1,
+ &bytes,
+ error)) {
+ return FALSE;
+ }
+ crc_tag = g_bytes_get_data (bytes, NULL);
+ g_debug ("CRC byte is currently 0x%x", crc_tag[3]);
+
+ for (guint32 retries_cnt = 0; ; retries_cnt++) {
+ g_autoptr(GBytes) bytes_new = NULL;
+ /* CRC8 is not 0xff, erase last 4k of bank# */
+ if (crc_tag[3] != 0xff) {
+ guint32 sector = FLASH_SECTOR_ERASE_4K +
+ (attribs->start + attribs->length - 0x1000) / 0x1000;
+ g_debug ("Erasing 4k from sector 0x%x invalidate bank %u",
+ sector, bank_in_use);
+ /* offset for last 4k of bank# */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_ERASE_FLASH,
+ 4, 0,
+ (guint8 *) §or,
+ error)) {
+
+ g_prefix_error (error,
+ "failed to erase sector 0x%x: ",
+ sector);
+ return FALSE;
+ }
+ /* CRC8 is 0xff, set it to 0x00 */
+ } else {
+ guint32 write = 0x00;
+ g_debug ("Writing 0x00 byte to 0x%x to invalidate bank %u",
+ crc_offset, bank_in_use);
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_WRITE_FLASH,
+ 4, crc_offset,
+ (guint8*) &write,
+ error)) {
+
+ g_prefix_error (error, "failed to clear CRC byte: ");
+ return FALSE;
+ }
+ }
+ /* re-read for comparison */
+ if (!fu_dell_dock_mst_rc_command (symbiote,
+ MST_CMD_READ_FLASH,
+ 4, crc_offset,
+ NULL,
+ error)) {
+
+ g_prefix_error (error, "failed to read tag from flash: ");
+ return FALSE;
+ }
+ if (!fu_dell_dock_mst_read_register (symbiote,
+ MST_RC_DATA_ADDR,
+ 4, &bytes_new,
+ error)) {
+ return FALSE;
+ }
+ new_tag = g_bytes_get_data (bytes_new, NULL);
+ g_debug ("CRC byte is currently 0x%x", new_tag[3]);
+
+ /* tag successfully cleared */
+ if ((new_tag[3] == 0xff && crc_tag[3] != 0xff) ||
+ (new_tag[3] == 0x00 && crc_tag[3] == 0xff)) {
+ break;
+ }
+ if (retries_cnt > retries) {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "set tag invalid fail (new 0x%x; old 0x%x)",
+ new_tag[3], crc_tag[3]);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_write_fw (FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+ MSTBank bank_in_use = 0;
+ guint retries = 2;
+ gboolean checksum = FALSE;
+ guint8 order[2] = {ESM, Bank0};
+ guint16 chip_id;
+ const guint8* data = g_bytes_get_data (blob_fw, NULL);
+ g_autofree gchar *dynamic_version = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+ g_return_val_if_fail (self->symbiote != NULL, FALSE);
+
+ dynamic_version = g_strdup_printf ("%02x.%02x.%02x",
+ data[self->blob_major_offset],
+ data[self->blob_minor_offset],
+ data[self->blob_build_offset]);
+ g_debug ("writing MST firmware version %s", dynamic_version);
+
+ /* determine the flash order */
+ if (!fu_dell_dock_mst_query_active_bank (self->symbiote, &bank_in_use, error))
+ return FALSE;
+
+ if (bank_in_use == Bank0)
+ order[1] = Bank1;
+
+ /* enable remote control */
+ if (!fu_dell_dock_mst_enable_remote_control (self->symbiote, error))
+ return FALSE;
+
+ /* Read Synaptics MST chip ID */
+ if (!fu_dell_dock_mst_read_chipid (self->symbiote, &chip_id,
+ error))
+ return FALSE;
+ if (chip_id != EXPECTED_CHIPID) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Unknown MST chip found %x", chip_id);
+ return FALSE;
+ }
+
+ /* ESM needs special handling during flash process*/
+ if (!fu_dell_dock_mst_stop_esm (self->symbiote, error))
+ return FALSE;
+
+ /* Write each bank in order */
+ for (guint phase = 0; phase < 2; phase++) {
+ g_debug ("MST: Checking bank %u", order[phase]);
+ if (!fu_dell_dock_mst_checksum_bank (self->symbiote,
+ blob_fw,
+ order[phase],
+ &checksum, error))
+ return FALSE;
+ if (checksum) {
+ g_debug ("MST: bank %u is already up to date", order[phase]);
+ continue;
+ }
+ g_debug ("MST: bank %u needs to be updated", order[phase]);
+ for (guint i = 0; i < retries; i++) {
+ fu_device_set_progress_full (device, 0, 100);
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_ERASE);
+ if (!fu_dell_dock_mst_erase_bank (self->symbiote,
+ order[phase],
+ error))
+ return FALSE;
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ if (!fu_dell_dock_write_flash_bank (device, blob_fw,
+ order[phase], error))
+ return FALSE;
+ if (!fu_dell_dock_mst_checksum_bank (self->symbiote,
+ blob_fw,
+ order[phase],
+ &checksum,
+ error))
+ return FALSE;
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_BUSY);
+ if (!checksum) {
+ g_debug (
+ "MST: Failed to verify checksum on bank %u",
+ order[phase]);
+ continue;
+ }
+ g_debug ("MST: Bank %u successfully flashed", order[phase]);
+ break;
+ }
+ /* failed after all our retries */
+ if (!checksum) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to write to bank %u", order[phase]);
+ return FALSE;
+ }
+ }
+ /* invalidate the previous bank */
+ if (!fu_dell_dock_mst_invalidate_bank (self->symbiote, bank_in_use, error)) {
+ g_prefix_error (error, "failed to invalidate bank %u: ", bank_in_use);
+ return FALSE;
+ }
+
+ /* dock will reboot to re-read; this is to appease the daemon */
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_TRIPLET);
+
+ /* disable remote control now */
+ return fu_dell_dock_mst_disable_remote_control (self->symbiote, error);
+}
+
+static gboolean
+fu_dell_dock_mst_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+
+ if (g_strcmp0 (key, "DellDockUnlockTarget") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp < G_MAXUINT8) {
+ self->unlock_target = tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "invalid DellDockUnlockTarget");
+ return FALSE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobMajorOffset") == 0) {
+ self->blob_major_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobMinorOffset") == 0) {
+ self->blob_minor_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+ if (g_strcmp0 (key, "DellDockBlobBuildOffset") == 0) {
+ self->blob_build_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+ else if (g_strcmp0 (key, "DellDockInstallDurationI2C") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ fu_device_set_install_duration (device, tmp);
+ return TRUE;
+ }
+
+ /* failed */
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+static gboolean
+fu_dell_dock_mst_setup (FuDevice *device, GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+ FuDevice *parent;
+ const gchar *version;
+
+ /* sanity check that we can talk to MST */
+ if (!fu_d19_mst_check_fw (self->symbiote, error))
+ return FALSE;
+
+ /* set version from EC if we know it */
+ parent = fu_device_get_parent (device);
+ version = fu_dell_dock_ec_get_mst_version (parent);
+ if (version != NULL)
+ fu_device_set_version (device, version, FWUPD_VERSION_FORMAT_TRIPLET);
+
+ fu_dell_dock_clone_updatable (device);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_probe (FuDevice *device, GError **error)
+{
+ fu_device_set_logical_id (FU_DEVICE (device), "mst");
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_open (FuDevice *device, GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+ FuDevice *parent = fu_device_get_parent (device);
+
+ g_return_val_if_fail (self->unlock_target != 0, FALSE);
+ g_return_val_if_fail (parent != NULL, FALSE);
+
+ if (self->symbiote == NULL)
+ self->symbiote = g_object_ref (fu_dell_dock_ec_get_symbiote (parent));
+
+ if (!fu_device_open (self->symbiote, error))
+ return FALSE;
+
+ /* open up access to controller bus */
+ if (!fu_dell_dock_set_power (device, self->unlock_target, TRUE, error))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_mst_close (FuDevice *device, GError **error)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (device);
+
+ /* close access to controller bus */
+ if (!fu_dell_dock_set_power (device, self->unlock_target, FALSE, error))
+ return FALSE;
+
+ return fu_device_close (self->symbiote, error);
+}
+
+static void
+fu_dell_dock_mst_finalize (GObject *object)
+{
+ FuDellDockMst *self = FU_DELL_DOCK_MST (object);
+ g_object_unref (self->symbiote);
+ G_OBJECT_CLASS (fu_dell_dock_mst_parent_class)->finalize (object);
+}
+
+static void
+fu_dell_dock_mst_init (FuDellDockMst *self)
+{
+}
+
+static void
+fu_dell_dock_mst_class_init (FuDellDockMstClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ object_class->finalize = fu_dell_dock_mst_finalize;
+ klass_device->probe = fu_dell_dock_mst_probe;
+ klass_device->open = fu_dell_dock_mst_open;
+ klass_device->close = fu_dell_dock_mst_close;
+ klass_device->setup = fu_dell_dock_mst_setup;
+ klass_device->probe = fu_dell_dock_mst_probe;
+ klass_device->write_firmware = fu_dell_dock_mst_write_fw;
+ klass_device->set_quirk_kv = fu_dell_dock_mst_set_quirk_kv;
+}
+
+FuDellDockMst *
+fu_dell_dock_mst_new (void)
+{
+ FuDellDockMst *device = NULL;
+ device = g_object_new (FU_TYPE_DELL_DOCK_MST, NULL);
+ return device;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-mst.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-mst.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-mst.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-mst.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include "fu-device.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_DELL_DOCK_MST (fu_dell_dock_mst_get_type ())
+G_DECLARE_FINAL_TYPE (FuDellDockMst, fu_dell_dock_mst, FU, DELL_DOCK_MST, FuDevice)
+
+FuDellDockMst *fu_dell_dock_mst_new (void);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-tbt.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-tbt.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-tbt.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-tbt.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2019 Intel Corporation.
+ * Copyright (C) 2019 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include
+
+#include "fwupd-error.h"
+#include "fu-device.h"
+#include "fu-common.h"
+#include "fu-common-version.h"
+
+#include "fu-dell-dock-common.h"
+
+#define I2C_TBT_ADDRESS 0xa2
+
+const FuHIDI2CParameters tbt_base_settings = {
+ .i2cslaveaddr = I2C_TBT_ADDRESS,
+ .regaddrlen = 1,
+ .i2cspeed = I2C_SPEED_400K,
+};
+
+/* TR Device ID */
+#define PID_OFFSET 0x05
+#define INTEL_PID 0x15ef
+
+/* earlier versions have bugs */
+#define MIN_NVM "36.01"
+
+struct _FuDellDockTbt {
+ FuDevice parent_instance;
+ FuDevice *symbiote;
+ guint8 unlock_target;
+ guint64 blob_major_offset;
+ guint64 blob_minor_offset;
+ gchar *hub_minimum_version;
+};
+
+G_DEFINE_TYPE (FuDellDockTbt, fu_dell_dock_tbt, FU_TYPE_DEVICE)
+
+static gboolean
+fu_dell_dock_tbt_write_fw (FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (device);
+ guint32 start_offset = 0;
+ gsize image_size;
+ const guint8 *buffer = g_bytes_get_data (blob_fw, &image_size);
+ guint16 target_system = 0;
+ g_autoptr(GTimer) timer = g_timer_new ();
+ g_autofree gchar *dynamic_version = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ dynamic_version = g_strdup_printf ("%02x.%02x",
+ buffer[self->blob_major_offset],
+ buffer[self->blob_minor_offset]);
+ g_debug ("writing Thunderbolt firmware version %s", dynamic_version);
+ g_debug ("Total Image size: %" G_GSIZE_FORMAT, image_size);
+
+ memcpy (&start_offset, buffer, sizeof (guint32));
+ g_debug ("Header size 0x%x", start_offset);
+ if (start_offset > image_size) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE,
+ "Image header is too big (0x%x)",
+ start_offset);
+ return FALSE;
+ }
+
+ memcpy (&target_system, buffer + start_offset + PID_OFFSET, sizeof (guint16));
+ if (target_system != INTEL_PID) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE,
+ "Image is not intended for this system (0x%x)",
+ target_system);
+ return FALSE;
+ }
+
+ buffer += start_offset;
+ image_size -= start_offset;
+
+ g_debug ("waking Thunderbolt controller");
+ if (!fu_dell_dock_hid_tbt_wake (self->symbiote, &tbt_base_settings, error))
+ return FALSE;
+ g_usleep (2000000);
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_WRITE);
+ for (guint i = 0; i < image_size; i+= HIDI2C_MAX_WRITE, buffer += HIDI2C_MAX_WRITE) {
+ guint8 write_size = (image_size - i) > HIDI2C_MAX_WRITE ?
+ HIDI2C_MAX_WRITE : (image_size - i);
+
+ if (!fu_dell_dock_hid_tbt_write (self->symbiote,
+ i,
+ buffer,
+ write_size,
+ &tbt_base_settings,
+ error))
+ return FALSE;
+
+ fu_device_set_progress_full (device, i, image_size);
+ }
+ g_debug ("writing took %f seconds",
+ g_timer_elapsed (timer, NULL));
+
+ fu_device_set_status (device, FWUPD_STATUS_DEVICE_BUSY);
+
+ if (fu_dell_dock_ec_tbt_passive (fu_device_get_parent (device))) {
+ g_debug ("using passive flow for Thunderbolt");
+ } else if (!fu_dell_dock_hid_tbt_authenticate (self->symbiote,
+ &tbt_base_settings,
+ error)) {
+ g_prefix_error (error, "failed to authenticate: ");
+ return FALSE;
+ }
+
+ /* dock will reboot to re-read; this is to appease the daemon */
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_PAIR);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_tbt_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (device);
+
+ if (g_strcmp0 (key, "DellDockUnlockTarget") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ if (tmp < G_MAXUINT8) {
+ self->unlock_target = tmp;
+ return TRUE;
+ }
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_DATA,
+ "invalid DellDockUnlockTarget");
+ return FALSE;
+ } else if (g_strcmp0 (key, "DellDockInstallDurationI2C") == 0) {
+ guint64 tmp = fu_common_strtoull (value);
+ fu_device_set_install_duration (device, tmp);
+ return TRUE;
+ } else if (g_strcmp0 (key, "DellDockHubVersionLowest") == 0) {
+ self->hub_minimum_version = g_strdup (value);
+ return TRUE;
+ } else if (g_strcmp0 (key, "DellDockBlobMajorOffset") == 0) {
+ self->blob_major_offset = fu_common_strtoull (value);
+ return TRUE;
+ } else if (g_strcmp0 (key, "DellDockBlobMinorOffset") == 0) {
+ self->blob_minor_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+ /* failed */
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+
+static gboolean
+fu_dell_dock_tbt_setup (FuDevice *device, GError **error)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (device);
+ FuDevice *parent;
+ const gchar *version;
+ const gchar *hub_version;
+
+ /* set version from EC if we know it */
+ parent = fu_device_get_parent (device);
+ version = fu_dell_dock_ec_get_tbt_version (parent);
+ if (version != NULL)
+ fu_device_set_version (device, version, FWUPD_VERSION_FORMAT_PAIR);
+
+ /* minimum version of NVM that supports this feature */
+ if (version == NULL || fu_common_vercmp (version, MIN_NVM) < 0) {
+ fu_device_set_update_error (device,
+ "Updates over I2C are disabled due to insuffient NVM version");
+ return TRUE;
+ }
+ /* minimum Hub2 version that supports this feature */
+ hub_version = fu_device_get_version (self->symbiote);
+ if (fu_common_vercmp (hub_version, self->hub_minimum_version) < 0) {
+ fu_device_set_update_error (device,
+ "Updates over I2C are disabled due to insufficient USB 3.1 G2 hub version");
+ return TRUE;
+ }
+
+ fu_dell_dock_clone_updatable (device);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_tbt_probe (FuDevice *device, GError **error)
+{
+ FuDevice *parent = fu_device_get_parent (device);
+ fu_device_set_physical_id (device, fu_device_get_physical_id (parent));
+ fu_device_set_logical_id (FU_DEVICE (device), "tbt");
+ fu_device_add_instance_id (device, DELL_DOCK_TBT_INSTANCE_ID);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_tbt_open (FuDevice *device, GError **error)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (device);
+ FuDevice *parent;
+
+ g_return_val_if_fail (self->unlock_target != 0, FALSE);
+
+ parent = fu_device_get_parent (device);
+ if (parent == NULL) {
+ g_set_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL, "no parent");
+ return FALSE;
+ }
+
+ if (self->symbiote == NULL)
+ self->symbiote = g_object_ref (fu_dell_dock_ec_get_symbiote (parent));
+
+ if (!fu_device_open (self->symbiote, error))
+ return FALSE;
+
+ /* adjust to access controller */
+ if (!fu_dell_dock_set_power (device, self->unlock_target, TRUE, error))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_tbt_close (FuDevice *device, GError **error)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (device);
+
+ /* adjust to access controller */
+ if (!fu_dell_dock_set_power (device, self->unlock_target, FALSE, error))
+ return FALSE;
+
+ return fu_device_close (self->symbiote, error);
+}
+
+static void
+fu_dell_dock_tbt_finalize (GObject *object)
+{
+ FuDellDockTbt *self = FU_DELL_DOCK_TBT (object);
+ g_object_unref (self->symbiote);
+ g_free (self->hub_minimum_version);
+
+ G_OBJECT_CLASS (fu_dell_dock_tbt_parent_class)->finalize (object);
+}
+
+static void
+fu_dell_dock_tbt_init (FuDellDockTbt *device)
+{}
+
+static void
+fu_dell_dock_tbt_class_init (FuDellDockTbtClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ object_class->finalize = fu_dell_dock_tbt_finalize;
+ klass_device->probe = fu_dell_dock_tbt_probe;
+ klass_device->setup = fu_dell_dock_tbt_setup;
+ klass_device->open = fu_dell_dock_tbt_open;
+ klass_device->close = fu_dell_dock_tbt_close;
+ klass_device->write_firmware = fu_dell_dock_tbt_write_fw;
+ klass_device->set_quirk_kv = fu_dell_dock_tbt_set_quirk_kv;
+}
+
+FuDellDockTbt *
+fu_dell_dock_tbt_new (void)
+{
+ FuDellDockTbt *device = NULL;
+ device = g_object_new (FU_TYPE_DELL_DOCK_TBT, NULL);
+ return device;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-tbt.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-tbt.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-i2c-tbt.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-i2c-tbt.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 Intel Corporation.
+ * Copyright (C) 2019 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include "fu-device.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_DELL_DOCK_TBT (fu_dell_dock_tbt_get_type ())
+G_DECLARE_FINAL_TYPE (FuDellDockTbt, fu_dell_dock_tbt, FU, DELL_DOCK_TBT, FuDevice)
+
+FuDellDockTbt *fu_dell_dock_tbt_new (void);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-status.c fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-status.c
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-status.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-status.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include
+
+#include "fu-dell-dock-common.h"
+
+struct _FuDellDockStatus {
+ FuDevice parent_instance;
+ guint64 blob_version_offset;
+};
+
+G_DEFINE_TYPE (FuDellDockStatus, fu_dell_dock_status, FU_TYPE_DEVICE)
+
+static gchar *
+fu_dell_dock_status_ver_string (guint32 status_version)
+{
+ /* guint32 BCD */
+ return g_strdup_printf ("%02x.%02x.%02x.%02x",
+ status_version & 0xff,
+ (status_version >> 8) & 0xff,
+ (status_version >> 16) & 0xff,
+ (status_version >> 24) & 0xff);
+}
+
+static gboolean
+fu_dell_dock_status_setup (FuDevice *device, GError **error)
+{
+ FuDevice *parent;
+ guint32 status_version;
+ g_autofree gchar *dynamic_version = NULL;
+
+ parent = fu_device_get_parent (device);
+ status_version = fu_dell_dock_ec_get_status_version (parent);
+
+ dynamic_version = fu_dell_dock_status_ver_string (status_version);
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_QUAD);
+ fu_device_set_logical_id (FU_DEVICE (device), "status");
+
+ fu_dell_dock_clone_updatable (device);
+
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_status_write (FuDevice *device,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ FuDellDockStatus *self = FU_DELL_DOCK_STATUS (device);
+ FuDevice *parent;
+ gsize length = 0;
+ guint32 status_version = 0;
+ const guint8 *data = g_bytes_get_data (blob_fw, &length);
+ g_autofree gchar *dynamic_version = NULL;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+ g_return_val_if_fail (blob_fw != NULL, FALSE);
+
+ memcpy (&status_version, data + self->blob_version_offset, sizeof (guint32));
+ dynamic_version = fu_dell_dock_status_ver_string (status_version);
+ g_debug ("writing status firmware version %s", dynamic_version);
+
+ parent = fu_device_get_parent (device);
+ if (!fu_dell_dock_ec_commit_package (parent, blob_fw, error))
+ return FALSE;
+
+ /* dock will reboot to re-read; this is to appease the daemon */
+ fu_device_set_version (device, dynamic_version, FWUPD_VERSION_FORMAT_QUAD);
+ return TRUE;
+}
+
+static gboolean
+fu_dell_dock_status_open (FuDevice *device, GError **error)
+{
+ FuDevice *parent = fu_device_get_parent (device);
+
+ g_return_val_if_fail (parent != NULL, FALSE);
+
+ return fu_device_open (parent, error);
+}
+
+static gboolean
+fu_dell_dock_status_close (FuDevice *device, GError **error)
+{
+ FuDevice *parent = fu_device_get_parent (device);
+
+ return fu_device_close (parent, error);
+}
+
+static gboolean
+fu_dell_dock_status_set_quirk_kv (FuDevice *device,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
+{
+ FuDellDockStatus *self = FU_DELL_DOCK_STATUS (device);
+ if (g_strcmp0 (key, "DellDockBlobVersionOffset") == 0) {
+ self->blob_version_offset = fu_common_strtoull (value);
+ return TRUE;
+ }
+
+ /* failed */
+ g_set_error_literal (error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "quirk key not supported");
+ return FALSE;
+}
+
+static void
+fu_dell_dock_status_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (fu_dell_dock_status_parent_class)->finalize (object);
+}
+
+static void
+fu_dell_dock_status_init (FuDellDockStatus *self)
+{
+}
+
+static void
+fu_dell_dock_status_class_init (FuDellDockStatusClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FuDeviceClass *klass_device = FU_DEVICE_CLASS (klass);
+ object_class->finalize = fu_dell_dock_status_finalize;
+ klass_device->write_firmware = fu_dell_dock_status_write;
+ klass_device->setup = fu_dell_dock_status_setup;
+ klass_device->open = fu_dell_dock_status_open;
+ klass_device->close = fu_dell_dock_status_close;
+ klass_device->set_quirk_kv = fu_dell_dock_status_set_quirk_kv;
+}
+
+FuDellDockStatus *
+fu_dell_dock_status_new (void)
+{
+ FuDellDockStatus *self = NULL;
+ self = g_object_new (FU_TYPE_DELL_DOCK_STATUS, NULL);
+ return self;
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-status.h fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-status.h
--- fwupd-1.0.6/plugins/dell-dock/fu-dell-dock-status.h 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-dell-dock-status.h 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#pragma once
+
+#include "config.h"
+
+#include "fu-device.h"
+
+G_BEGIN_DECLS
+
+#define FU_TYPE_DELL_DOCK_STATUS (fu_dell_dock_status_get_type ())
+G_DECLARE_FINAL_TYPE (FuDellDockStatus, fu_dell_dock_status, FU, DELL_DOCK_STATUS, FuDevice)
+
+FuDellDockStatus *fu_dell_dock_status_new (void);
+
+G_END_DECLS
diff -Nru fwupd-1.0.6/plugins/dell-dock/fu-plugin-dell-dock.c fwupd-1.2.10/plugins/dell-dock/fu-plugin-dell-dock.c
--- fwupd-1.0.6/plugins/dell-dock/fu-plugin-dell-dock.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/fu-plugin-dell-dock.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2018 Dell Inc.
+ * All rights reserved.
+ *
+ * This software and associated documentation (if any) is furnished
+ * under a license and may only be used or copied in accordance
+ * with the terms of the license.
+ *
+ * This file is provided under a dual MIT/LGPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ * Dell Chooses the MIT license part of Dual MIT/LGPLv2 license agreement.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+ OR MIT
+ */
+
+#include "config.h"
+
+#include "fu-device.h"
+#include "fwupd-error.h"
+#include "fu-plugin-vfuncs.h"
+
+#include "fu-dell-dock-common.h"
+
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+
+ /* allow these to be built by quirks */
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN);
+ g_type_ensure (FU_TYPE_DELL_DOCK_STATUS);
+ g_type_ensure (FU_TYPE_DELL_DOCK_MST);
+
+ /* currently slower performance, but more reliable in corner cases */
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_BETTER_THAN, "synapticsmst");
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.dell.dock");
+ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.synaptics.mst");
+}
+
+static gboolean
+fu_plugin_dell_dock_create_node (FuPlugin *plugin,
+ FuDevice *device,
+ GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+
+ fu_device_set_quirks (device, fu_plugin_get_quirks (plugin));
+ locker = fu_device_locker_new (device, error);
+ if (locker == NULL)
+ return FALSE;
+
+ fu_plugin_device_add (plugin, device);
+
+ return TRUE;
+}
+
+static gboolean
+fu_plugin_dell_dock_probe (FuPlugin *plugin,
+ FuDevice *symbiote,
+ GError **error)
+{
+ g_autoptr(FuDellDockEc) ec_device = NULL;
+
+ /* create all static endpoints */
+ ec_device = fu_dell_dock_ec_new (symbiote);
+ if (!fu_plugin_dell_dock_create_node (plugin,
+ FU_DEVICE (ec_device),
+ error))
+ return FALSE;
+
+ /* create TBT endpoint if Thunderbolt SKU and Thunderbolt link inactive */
+ if (fu_dell_dock_ec_needs_tbt (FU_DEVICE (ec_device))) {
+ g_autoptr(FuDellDockTbt) tbt_device = fu_dell_dock_tbt_new ();
+ fu_device_add_child (FU_DEVICE (ec_device), FU_DEVICE (tbt_device));
+ if (!fu_plugin_dell_dock_create_node (plugin,
+ FU_DEVICE (tbt_device),
+ error))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_usb_device_added (FuPlugin *plugin,
+ FuUsbDevice *device,
+ GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+ g_autoptr(FuDellDockHub) hub = fu_dell_dock_hub_new (device);
+ FuDevice *fu_device = FU_DEVICE (hub);
+ const gchar *key = NULL;
+
+ locker = fu_device_locker_new (fu_device, error);
+ if (locker == NULL)
+ return FALSE;
+ fu_plugin_device_add (plugin, fu_device);
+
+ if (fu_device_has_custom_flag (fu_device, "has-bridge")) {
+ g_autoptr(GError) error_local = NULL;
+
+ /* only add the device with parent to cache */
+ key = fu_device_get_id (fu_device);
+ if (fu_plugin_cache_lookup (plugin, key) != NULL) {
+ g_debug ("Ignoring already added device %s", key);
+ return TRUE;
+ }
+ fu_plugin_cache_add (plugin, key, fu_device);
+
+ /* probe for extended devices */
+ if (!fu_plugin_dell_dock_probe (plugin,
+ fu_device,
+ &error_local)) {
+ g_warning ("Failed to probe bridged devices for %s: %s",
+ key,
+ error_local->message);
+ }
+ }
+
+ /* clear updatable flag if parent doesn't have it */
+ fu_dell_dock_clone_updatable (fu_device);
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_device_removed (FuPlugin *plugin, FuDevice *device, GError **error)
+{
+ const gchar *device_key = fu_device_get_id (device);
+ FuDevice *dev;
+ FuDevice *parent;
+
+ /* only the device with bridge will be in cache */
+ dev = fu_plugin_cache_lookup (plugin, device_key);
+ if (dev == NULL)
+ return TRUE;
+ fu_plugin_cache_remove (plugin, device_key);
+
+ /* find the parent and ask daemon to remove whole chain */
+ parent = fu_device_get_parent (dev);
+ if (parent != NULL && FU_IS_DELL_DOCK_EC (parent)) {
+ g_debug ("Removing %s (%s)",
+ fu_device_get_name (parent),
+ fu_device_get_id (parent));
+ fu_plugin_device_remove (plugin, parent);
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_update (FuPlugin *plugin,
+ FuDevice *dev,
+ GBytes *blob_fw,
+ FwupdInstallFlags flags,
+ GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+
+ locker = fu_device_locker_new (dev, error);
+ if (locker == NULL)
+ return FALSE;
+
+ fu_device_set_status (dev, FWUPD_STATUS_DEVICE_WRITE);
+ if (!fu_device_write_firmware (dev, blob_fw, flags, error)) {
+ g_prefix_error (error,
+ "failed to update %s: ",
+ fu_device_get_name (dev));
+ return FALSE;
+ }
+ fu_device_set_status (dev, FWUPD_STATUS_DEVICE_RESTART);
+
+ return TRUE;
+}
+
+/* prefer to use EC if in the transaction and parent if it is not */
+static FuDevice *
+fu_plugin_dell_dock_get_ec (GPtrArray *devices)
+{
+ FuDevice *ec_parent = NULL;
+ for (guint i = 0; i < devices->len; i++) {
+ FuDevice *dev = g_ptr_array_index (devices, i);
+ FuDevice *parent;
+ if (FU_IS_DELL_DOCK_EC (dev))
+ return dev;
+ parent = fu_device_get_parent (dev);
+ if (parent != NULL && FU_IS_DELL_DOCK_EC (parent))
+ ec_parent = parent;
+ }
+
+ return ec_parent;
+}
+
+gboolean
+fu_plugin_composite_prepare (FuPlugin *plugin,
+ GPtrArray *devices,
+ GError **error)
+{
+ FuDevice *parent = fu_plugin_dell_dock_get_ec (devices);
+ gboolean remaining_replug = FALSE;
+
+ if (parent == NULL)
+ return TRUE;
+
+ for (guint i = 0; i < devices->len; i++) {
+ FuDevice *dev = g_ptr_array_index (devices, i);
+ /* if thunderbolt is part of transaction our family is leaving us */
+ if (g_strcmp0 (fu_device_get_plugin (dev), "thunderbolt") == 0) {
+ if (fu_device_get_parent (dev) != parent)
+ continue;
+ fu_dell_dock_will_replug (parent);
+ /* set all other devices to replug */
+ remaining_replug = TRUE;
+ continue;
+ }
+ /* different device */
+ if (fu_device_get_parent (dev) != parent)
+ continue;
+ if (remaining_replug)
+ fu_dell_dock_will_replug (dev);
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_composite_cleanup (FuPlugin *plugin,
+ GPtrArray *devices,
+ GError **error)
+{
+ FuDevice *parent = fu_plugin_dell_dock_get_ec (devices);
+ g_autoptr(FuDeviceLocker) locker = NULL;
+
+ if (parent == NULL)
+ return TRUE;
+
+ locker = fu_device_locker_new (parent, error);
+ if (locker == NULL)
+ return FALSE;
+
+ return fu_dell_dock_ec_reboot_dock (parent, error);
+}
+
+gboolean
+fu_plugin_activate (FuPlugin *plugin, FuDevice *device, GError **error)
+{
+ g_autoptr(FuDeviceLocker) locker = NULL;
+ if (!FU_IS_DELL_DOCK_EC (device)) {
+ g_set_error_literal (error, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE,
+ "Invalid device to activate");
+ return FALSE;
+ }
+
+ locker = fu_device_locker_new (device, error);
+ if (locker == NULL)
+ return FALSE;
+
+ return fu_device_activate (device, error);
+}
diff -Nru fwupd-1.0.6/plugins/dell-dock/meson.build fwupd-1.2.10/plugins/dell-dock/meson.build
--- fwupd-1.0.6/plugins/dell-dock/meson.build 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,34 @@
+cargs = ['-DG_LOG_DOMAIN="FuPluginDellDock"']
+
+install_data(['dell-dock.quirk'],
+ install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
+)
+
+shared_module('fu_plugin_dell_dock',
+ fu_hash,
+ sources : [
+ 'fu-plugin-dell-dock.c',
+ 'fu-dell-dock-common.c',
+ 'fu-dell-dock-hid.c',
+ 'fu-dell-dock-status.c',
+ 'fu-dell-dock-i2c-ec.c',
+ 'fu-dell-dock-hub.c',
+ 'fu-dell-dock-i2c-tbt.c',
+ 'fu-dell-dock-i2c-mst.c'
+ ],
+ include_directories : [
+ include_directories('../..'),
+ include_directories('../../src'),
+ include_directories('../../libfwupd'),
+ ],
+ install : true,
+ install_dir: plugin_dir,
+ link_with : [
+ libfwupdprivate,
+ ],
+ c_args : cargs,
+ dependencies : [
+ plugin_deps,
+ gudev,
+ ],
+)
diff -Nru fwupd-1.0.6/plugins/dell-dock/README.md fwupd-1.2.10/plugins/dell-dock/README.md
--- fwupd-1.0.6/plugins/dell-dock/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-dock/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,71 @@
+Dell USB-C Dock
+=========
+
+### Dell System
+Unlike previous Dell USB-C devices, a Dell system is not needed for updating.
+
+### Components
+The device contains components the following directly updatable components:
+* USB hubs
+* MST controller
+* Thunderbolt controller
+* Embedded controller
+
+This plugin is used to perform the update on the USB hubs as well as the Dell
+Embedded controller. The USB hubs are updated directly over a USB HID endpoint
+while the embedded controller is updated using an I2C over HID interface.
+
+The fwupd thunderbolt plugin is used for updating the Titan Ridge controller.
+
+The MST controller is updated through either the DP Aux interface
+(SynapticsMST plugin) or I2C over HID interface provided by this plugin.
+
+## Device topology
+When this plugin is used, devices present in other plugins may be shown in
+the topology of this dock. This is intentional as this plugin works together
+with those plugins to manage the flashing of all components.
+
+Firmware Format
+---------------
+
+The daemon will decompress the cabinet archive and extract several firmware
+blobs with an unspecified binary file format.
+
+This plugin supports the following protocol ID:
+
+ * com.dell.dock
+ * com.synaptics.mst
+
+GUID Generation
+---------------
+
+These devices use several different generation schemes, e.g.
+
+ * USB Hub1: `USB\VID_413C&PID_B06F&hub`
+ * USB Hub2: `USB\VID_413C&PID_B06E&hub`
+ * Embedded Controller: `USB\VID_413C&PID_B06E&hub&embedded`
+ * Update Level: `USB\VID_413C&PID_B06E&hub&status`
+ * MST Hub: `MST-panamera-vmm5331-259`
+ * Thunderbolt Controller: `TBT-00d4b070`
+
+Custom flag use:
+----------------
+This plugin uses the following plugin-specific custom flags:
+
+* `skip-restart`: Don't run the reset or reboot procedure of the component
+
+Quirk use
+---------
+This plugin uses the following plugin-specific quirks:
+
+| Quirk | Description | Minimum fwupd version |
+|------------------------------|-------------------------------------------------------------------------|-----------------------|
+| `DellDockUnlockTarget` | The EC argument needed for unlocking certain device usage. | 1.1.3 |
+| `DellDockBlobMajorOffset` | The offset of the major version number in a payload | 1.1.3 |
+| `DellDockBlobMinorOffset` | The offset of the minor version number in a payload | 1.1.3 |
+| `DellDockBlobBuildOffset` | The offset of the build version number in a payload | 1.1.3 |
+| `DellDockBlobVersionOffset` | The offset of the ASCII representation of a version string in a payload | 1.1.3 |
+| `DellDockBoardMin` | The minimum board revision required to safely operate the plugin | 1.1.3 |
+| `DellDockVersionLowest` | The minimum component version required to safely operate the plugin | 1.1.3 |
+| `DellDockBoard*` | The board description of a board revision | 1.1.3 |
+| `DellDockInstallDurationI2C` | The duration of time required to install a payload via I2C. | 1.1.3 |
diff -Nru fwupd-1.0.6/plugins/dell-esrt/dell-esrt.conf fwupd-1.2.10/plugins/dell-esrt/dell-esrt.conf
--- fwupd-1.0.6/plugins/dell-esrt/dell-esrt.conf 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-esrt/dell-esrt.conf 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,8 @@
+[fwupd Remote]
+
+# this remote provides metadata shipped with the fwupd package
+Enabled=true
+Title=Enable UEFI capsule updates on Dell systems
+Keyring=none
+MetadataURI=file://@datadir@/fwupd/remotes.d/dell-esrt/metadata.xml
+ApprovalRequired=false
diff -Nru fwupd-1.0.6/plugins/dell-esrt/fu-plugin-dell-esrt.c fwupd-1.2.10/plugins/dell-esrt/fu-plugin-dell-esrt.c
--- fwupd-1.0.6/plugins/dell-esrt/fu-plugin-dell-esrt.c 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-esrt/fu-plugin-dell-esrt.c 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2018 Richard Hughes
+ * Copyright (C) 2017-2018 Dell, Inc.
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include "config.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "fu-plugin-vfuncs.h"
+
+/* Whitelisted smbios class/select commands */
+#define CLASS_ADMIN_PROP 10
+#define SELECT_ADMIN_PROP 3
+
+/* whitelisted tokens */
+#define CAPSULE_EN_TOKEN 0x0461
+#define CAPSULE_DIS_TOKEN 0x0462
+
+/* these aren't defined upstream but used in fwupdate */
+#define DELL_ADMIN_MASK 0xF
+#define DELL_ADMIN_INSTALLED 0
+
+static gboolean
+fu_plugin_dell_esrt_query_token (guint16 token, gboolean *value, GError **error)
+{
+ if (!token_is_bool (token)) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "token %" G_GUINT16_FORMAT " is not boolean",
+ token);
+ return FALSE;
+ }
+ if (value != NULL)
+ *value = token_is_active (token) > 0;
+
+ return TRUE;
+}
+
+static gboolean
+fu_plugin_dell_esrt_activate_token (guint16 token, GError **error)
+{
+ token_activate (token);
+ if (token_is_active (token) < 0) {
+ g_set_error (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "token %" G_GUINT16_FORMAT "cannot be activated "
+ "as the password is set", token);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean
+fu_plugin_dell_esrt_admin_password_present (gboolean *password_present, GError **error)
+{
+ guint32 args[4] = { 0, }, out[4] = { 0, };
+
+ if (dell_simple_ci_smi (CLASS_ADMIN_PROP,
+ SELECT_ADMIN_PROP, args, out)) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "cannot call SMI for CLASS_ADMIN_PROP");
+ return FALSE;
+ }
+
+ if (out[0] != 0 || (out[1] & DELL_ADMIN_MASK) == DELL_ADMIN_INSTALLED) {
+ *password_present = TRUE;
+ } else {
+ *password_present = FALSE;
+ }
+ return TRUE;
+}
+
+void
+fu_plugin_init (FuPlugin *plugin)
+{
+ fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
+}
+
+gboolean
+fu_plugin_startup (FuPlugin *plugin, GError **error)
+{
+ gboolean capsule_disable = FALSE;
+ g_autofree gchar *sysfsfwdir = NULL;
+ g_autofree gchar *esrtdir = NULL;
+
+ /* already exists */
+ sysfsfwdir = fu_common_get_path (FU_PATH_KIND_SYSFSDIR_FW);
+ esrtdir = g_build_filename (sysfsfwdir, "efi", "esrt", NULL);
+ if (g_file_test (esrtdir, G_FILE_TEST_EXISTS)) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "UEFI firmware already supported");
+ return FALSE;
+ }
+
+ /* is the capsule functionality disabled */
+ if (!fu_plugin_dell_esrt_query_token (CAPSULE_DIS_TOKEN, &capsule_disable, error))
+ return FALSE;
+ if (!capsule_disable) {
+ gboolean capsule_enable = FALSE;
+ if (!fu_plugin_dell_esrt_query_token (CAPSULE_EN_TOKEN, &capsule_enable, error))
+ return FALSE;
+ if (capsule_enable) {
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ "UEFI firmware will be unlocked on next boot");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_unlock (FuPlugin *plugin, FuDevice *device, GError **error)
+{
+ gboolean password_present = FALSE;
+ /* check the admin password isn't set */
+ if (!fu_plugin_dell_esrt_admin_password_present (&password_present, error))
+ return FALSE;
+ if (password_present) {
+ const gchar *err_string = "Cannot be unlocked automatically as admin password set";
+ g_set_error_literal (error,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOT_SUPPORTED,
+ err_string);
+ fu_device_set_update_error (device, err_string);
+ return FALSE;
+ }
+
+ /* disabled in BIOS, but supported to be enabled via tool */
+ if (!fu_plugin_dell_esrt_query_token (CAPSULE_EN_TOKEN, NULL, error))
+ return FALSE;
+ if (!fu_plugin_dell_esrt_activate_token (CAPSULE_EN_TOKEN, error))
+ return FALSE;
+ fu_device_set_update_error (device, NULL);
+
+ return TRUE;
+}
+
+gboolean
+fu_plugin_coldplug (FuPlugin *plugin, GError **error)
+{
+ g_autoptr(FuDevice) dev = fu_device_new ();
+
+ /* create a dummy device so we can unlock the feature */
+ fu_device_set_id (dev, "UEFI-dummy-dev0");
+ fu_device_set_name (dev, "Dell UEFI updates");
+ fu_device_set_summary (dev, "Enable UEFI Update Functionality");
+ fu_device_add_guid (dev, "2d47f29b-83a2-4f31-a2e8-63474f4d4c2e");
+ fu_device_set_version (dev, "0", FWUPD_VERSION_FORMAT_NUMBER);
+ fu_device_add_icon (dev, "computer");
+ fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_LOCKED);
+ fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
+ fu_device_set_update_error (dev, "Firmware updates disabled; run 'fwupdmgr unlock' to enable");
+ fu_plugin_device_add (plugin, dev);
+ return TRUE;
+}
diff -Nru fwupd-1.0.6/plugins/dell-esrt/meson.build fwupd-1.2.10/plugins/dell-esrt/meson.build
--- fwupd-1.0.6/plugins/dell-esrt/meson.build 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-esrt/meson.build 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,40 @@
+cargs = ['-DG_LOG_DOMAIN="FuPluginDellEsrt"']
+
+install_data(['metadata.xml'],
+ install_dir : join_paths(datadir, 'fwupd', 'remotes.d', 'dell-esrt')
+)
+
+shared_module('fu_plugin_dell_esrt',
+ fu_hash,
+ sources : [
+ 'fu-plugin-dell-esrt.c',
+ ],
+ include_directories : [
+ include_directories('../..'),
+ include_directories('../../src'),
+ include_directories('../../libfwupd'),
+ ],
+ install : true,
+ install_dir: plugin_dir,
+ c_args : [
+ cargs,
+ ],
+ link_with : [
+ libfwupdprivate,
+ ],
+ dependencies : [
+ plugin_deps,
+ libsmbios_c,
+ ],
+)
+
+# replace @datadir@
+con2 = configuration_data()
+con2.set('datadir', datadir)
+configure_file(
+ input : 'dell-esrt.conf',
+ output : 'dell-esrt.conf',
+ configuration : con2,
+ install: true,
+ install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
+)
diff -Nru fwupd-1.0.6/plugins/dell-esrt/metadata.xml fwupd-1.2.10/plugins/dell-esrt/metadata.xml
--- fwupd-1.0.6/plugins/dell-esrt/metadata.xml 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-esrt/metadata.xml 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,27 @@
+
+
+
+
+
+ org.fwupd.8330a096d9f1af8567c7374cb8403e1ce9cf3163.device
+
+ 2d47f29b-83a2-4f31-a2e8-63474f4d4c2e
+
+ UEFI Updates
+ Enable UEFI Update Functionality
+
+
+
+
+ Applying this update will enable the UEFI firmware reporting interface on your hardware.
+
+
+ You will have to restart your computer after this update is installed
+ to be notified of any pending firmware updates.
+
+
+
+
+
+
+
diff -Nru fwupd-1.0.6/plugins/dell-esrt/README.md fwupd-1.2.10/plugins/dell-esrt/README.md
--- fwupd-1.0.6/plugins/dell-esrt/README.md 1970-01-01 00:00:00.000000000 +0000
+++ fwupd-1.2.10/plugins/dell-esrt/README.md 2019-07-15 18:25:54.000000000 +0000
@@ -0,0 +1,42 @@
+Dell ESRT Support
+=================
+
+Introduction
+------------
+
+This allows enabling the BIOS setup option for UEFI capsule updates without
+manually going into BIOS setup.
+
+GUID Generation
+---------------
+
+These device uses a hardcoded GUID of `2d47f29b-83a2-4f31-a2e8-63474f4d4c2e`.
+
+Build Requirements
+------------------
+
+For Dell support you will need libsmbios_c version 2.4.0 or later.
+
+* source: https://github.com/dell/libsmbios
+* binaries: https://github.com/dell/libsmbios/releases
+
+If you don't want or need this functionality you can use the
+`-Dplugin_dell=false` option.
+
+# Devices powered by the Dell Plugin
+The Dell ESRT plugin allows the user to enable the UpdateCapsule functionality
+at runtime. A reboot will be required and the BIOS administrator password
+must not be set.
+
+Machines that offer this functionality will display an extra device in
+```# fwupdmgr get-devices``` output.
+
+Example:
+```
+UEFI dummy device
+ Guid: 2d47f29b-83a2-4f31-a2e8-63474f4d4c2e
+ Plugin: dell-esrt
+ Flags: internal|updatable|locked
+ Version: 0
+ Created: 2018-06-25
+```
diff -Nru fwupd-1.0.6/plugins/dfu/contrib/parse-avrdude-conf.py fwupd-1.2.10/plugins/dfu/contrib/parse-avrdude-conf.py
--- fwupd-1.0.6/plugins/dfu/contrib/parse-avrdude-conf.py 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/contrib/parse-avrdude-conf.py 2019-07-15 18:25:54.000000000 +0000
@@ -1,24 +1,10 @@
-#!/usr/bin/env python3
+#!/usr/bin/python3
""" This parses avrdude.conf and generates quirks for fwupd """
# pylint: disable=wrong-import-position,pointless-string-statement
"""
- Licensed under the GNU General Public License Version 2
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see .
-
+SPDX-License-Identifier: LGPL-2.1+
"""
import sys
diff -Nru fwupd-1.0.6/plugins/dfu/dfu-chunked.c fwupd-1.2.10/plugins/dfu/dfu-chunked.c
--- fwupd-1.0.6/plugins/dfu/dfu-chunked.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/dfu-chunked.c 1970-01-01 00:00:00.000000000 +0000
@@ -1,185 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 20157 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-
-#include
-
-#include "dfu-chunked.h"
-
-/**
- * dfu_chunked_packet_new:
- * @idx: the packet number
- * @page: the hardware memory page
- * @address: the address *within* the page
- * @data: the data
- * @data_sz: size of @data_sz
- *
- * Creates a new packet of chunked data.
- *
- * Return value: (transfer full): a #DfuChunkedPacket
- **/
-DfuChunkedPacket *
-dfu_chunked_packet_new (guint32 idx,
- guint32 page,
- guint32 address,
- const guint8 *data,
- guint32 data_sz)
-{
- DfuChunkedPacket *item = g_new0 (DfuChunkedPacket, 1);
- item->idx = idx;
- item->page = page;
- item->address = address;
- item->data = data;
- item->data_sz = data_sz;
- return item;
-}
-
-/**
- * dfu_chunked_packet_to_string:
- * @item: a #DfuChunkedPacket
- *
- * Converts the chunked packet to a string representation.
- *
- * Return value: (transfer full): A string
- **/
-gchar *
-dfu_chunked_packet_to_string (DfuChunkedPacket *item)
-{
- g_autoptr(GString) str = g_string_new (NULL);
- if (item->data != NULL) {
- for (guint32 i = 0; i < item->data_sz; i++) {
- gchar tmp = (gchar) item->data[i];
- if (tmp == 0x00)
- break;
- g_string_append_c (str, g_ascii_isalnum (tmp) ? tmp : '?');
- }
- }
- return g_strdup_printf ("#%02" G_GUINT32_FORMAT ": page:%02x "
- "addr:%04x len:%02" G_GUINT32_FORMAT " %s",
- item->idx,
- (guint) item->page,
- (guint) item->address,
- item->data_sz,
- str->str);
-}
-
-/**
- * dfu_chunked_to_string:
- * @segments: (element-type DfuChunkedPacket): array of packets
- *
- * Converts all the chunked packets in an array to a string representation.
- *
- * Return value: (transfer full): A string
- **/
-gchar *
-dfu_chunked_to_string (GPtrArray *segments)
-{
- GString *str = g_string_new (NULL);
- for (guint i = 0; i < segments->len; i++) {
- DfuChunkedPacket *item = g_ptr_array_index (segments, i);
- g_autofree gchar *tmp = dfu_chunked_packet_to_string (item);
- g_string_append_printf (str, "%s\n", tmp);
- }
- return g_string_free (str, FALSE);
-}
-
-/**
- * dfu_chunked_new:
- * @data: a linear blob of memory, or %NULL
- * @data_sz: size of @data_sz
- * @addr_start: the hardware address offset, or 0
- * @page_sz: the hardware page size, or 0
- * @packet_sz: the transfer size, or 0
- *
- * Chunks a linear blob of memory into packets, ensuring each packet does not
- * cross a package boundary and is less that a specific transfer size.
- *
- * Return value: (element-type DfuChunkedPacket): array of packets
- **/
-GPtrArray *
-dfu_chunked_new (const guint8 *data,
- guint32 data_sz,
- guint32 addr_start,
- guint32 page_sz,
- guint32 packet_sz)
-{
- GPtrArray *segments = NULL;
- guint32 page_old = G_MAXUINT32;
- guint32 idx;
- guint32 last_flush = 0;
-
- g_return_val_if_fail (data_sz > 0, NULL);
-
- segments = g_ptr_array_new_with_free_func (g_free);
- for (idx = 1; idx < data_sz; idx++) {
- guint32 page = 0;
- if (page_sz > 0)
- page = (addr_start + idx) / page_sz;
- if (page_old == G_MAXUINT32) {
- page_old = page;
- } else if (page != page_old) {
- const guint8 *data_offset = data != NULL ? data + last_flush : 0x0;
- guint32 address_offset = addr_start + last_flush;
- if (page_sz > 0)
- address_offset %= page_sz;
- g_ptr_array_add (segments,
- dfu_chunked_packet_new (segments->len,
- page_old,
- address_offset,
- data_offset,
- idx - last_flush));
- last_flush = idx;
- page_old = page;
- continue;
- }
- if (packet_sz > 0 && idx - last_flush >= packet_sz) {
- const guint8 *data_offset = data != NULL ? data + last_flush : 0x0;
- guint32 address_offset = addr_start + last_flush;
- if (page_sz > 0)
- address_offset %= page_sz;
- g_ptr_array_add (segments,
- dfu_chunked_packet_new (segments->len,
- page,
- address_offset,
- data_offset,
- idx - last_flush));
- last_flush = idx;
- continue;
- }
- }
- if (last_flush != idx) {
- const guint8 *data_offset = data != NULL ? data + last_flush : 0x0;
- guint32 address_offset = addr_start + last_flush;
- guint32 page = 0;
- if (page_sz > 0) {
- address_offset %= page_sz;
- page = (addr_start + (idx - 1)) / page_sz;
- }
- g_ptr_array_add (segments,
- dfu_chunked_packet_new (segments->len,
- page,
- address_offset,
- data_offset,
- data_sz - last_flush));
- }
- return segments;
-}
diff -Nru fwupd-1.0.6/plugins/dfu/dfu-chunked.h fwupd-1.2.10/plugins/dfu/dfu-chunked.h
--- fwupd-1.0.6/plugins/dfu/dfu-chunked.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/dfu-chunked.h 1970-01-01 00:00:00.000000000 +0000
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2017 Richard Hughes
- *
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __DFU_CHUNKED_H
-#define __DFU_CHUNKED_H
-
-#include
-#include
-
-G_BEGIN_DECLS
-
-typedef struct {
- guint32 idx;
- guint32 page;
- guint32 address;
- const guint8 *data;
- guint32 data_sz;
-} DfuChunkedPacket;
-
-DfuChunkedPacket *dfu_chunked_packet_new (guint32 idx,
- guint32 page,
- guint32 address,
- const guint8 *data,
- guint32 data_sz);
-gchar *dfu_chunked_packet_to_string (DfuChunkedPacket *item);
-
-gchar *dfu_chunked_to_string (GPtrArray *chunked);
-GPtrArray *dfu_chunked_new (const guint8 *data,
- guint32 data_sz,
- guint32 addr_start,
- guint32 page_sz,
- guint32 packet_sz);
-
-G_END_DECLS
-
-#endif /* __DFU_CHUNKED_H */
diff -Nru fwupd-1.0.6/plugins/dfu/dfu-cipher-xtea.c fwupd-1.2.10/plugins/dfu/dfu-cipher-xtea.c
--- fwupd-1.0.6/plugins/dfu/dfu-cipher-xtea.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/dfu-cipher-xtea.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2016 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
diff -Nru fwupd-1.0.6/plugins/dfu/dfu-cipher-xtea.h fwupd-1.2.10/plugins/dfu/dfu-cipher-xtea.h
--- fwupd-1.0.6/plugins/dfu/dfu-cipher-xtea.h 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/dfu-cipher-xtea.h 2019-07-15 18:25:54.000000000 +0000
@@ -1,26 +1,10 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015-2016 Richard Hughes
*
- * Licensed under the GNU Lesser General Public License Version 2.1
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * SPDX-License-Identifier: LGPL-2.1+
*/
-#ifndef __DFU_FORMAT_XTEA_H
-#define __DFU_FORMAT_XTEA_H
+#pragma once
#include
#include
@@ -37,5 +21,3 @@
GError **error);
G_END_DECLS
-
-#endif /* __DFU_FORMAT_XTEA_H */
diff -Nru fwupd-1.0.6/plugins/dfu/dfu-common.c fwupd-1.2.10/plugins/dfu/dfu-common.c
--- fwupd-1.0.6/plugins/dfu/dfu-common.c 2018-03-12 10:41:58.000000000 +0000
+++ fwupd-1.2.10/plugins/dfu/dfu-common.c 2019-07-15 18:25:54.000000000 +0000
@@ -1,22 +1,7 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2015 Richard Hughes