Commit Graph

161 Commits

Author SHA1 Message Date
Mario Limonciello
812ac02bac synapticsmst: Allow using a custom flag 'skip-restart'
This flag is intended for devices that the restart procedure will
be performed as part of a transactional update by an external
controller.

None of the currently supported devices need this flag.
2018-08-29 07:55:27 +01:00
Mario Limonciello
102074eeea synapticsmst: Move GUID generation into quirks
This should allow trivially adding support for new
Tesla/Leaf/Panamera devices by a quirk.
2018-08-28 15:30:21 -05:00
Mario Limonciello
7555738827 synapticsmst: Set parentage for Dell WD15/TB16/TB18 docks through quirks 2018-08-28 18:30:00 +01:00
Mario Limonciello
f19222414c trivial: synapticsmst: Let device finalize close remaining fd 2018-08-13 11:11:27 -05:00
Mario Limonciello
9818692336 synapticsmst: Use FuDeviceLocker for all instances of remote control
This will make sure that remote control requests are always paired with
a close.
2018-08-13 11:11:27 -05:00
Mario Limonciello
8bba1ed2ef synapticsmst: Plumb error handling everywhere return codes are used
This makes the code more consistent, easier to debug and to reuse
in other plugins.
2018-08-13 11:11:27 -05:00
Mario Limonciello
32ac99c6dd trivial: synapticsmst: remove unnecessary includes 2018-08-13 11:11:27 -05:00
Mario Limonciello
d4e443e8e2 synapticsmst: Fix alignment issues (Closes: #207) 2018-08-11 08:34:38 +01:00
Mario Limonciello
7343ed4f33 synapticsmst: Run the plugin on non-dell systems
It generally won't be interesting on most systems, but if a supported
Dell USB device is connected to a non-dell system it can be updated
then.
2018-08-09 15:04:25 -05:00
Richard Hughes
14a8e40966 synapticsmst: Fix const warnings on Centos7 2018-08-09 16:59:04 +01:00
Richard Hughes
55c424a7be synapticsmst: Add some missing failure handling code
If synapticsmst_common_rc_set_command() fails, return an error.

Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
c5a392ac8f synapticsmst: Remove some dead code
0x40000/64 has no remainder, and both numbers are defined constants.

Found using Coverity.
2018-08-09 15:27:36 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
faa9aaae0b trivial: synapticsmst: whitespace fixes 2018-08-06 00:34:42 -05:00
Mario Limonciello
dc5566a8db synapticsmst: Add support Synaptics Panamera chip
Panamera is a newer MST chip with a different flash layout and
multiple MCU running and accessing SPI/EEPROM simultaneously.

The firmware update process has to be run separately for each
SPI/EEPROM region.

Signed-off-by: Ryan Chang <ryan.chang@synaptics.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
2018-08-06 00:34:42 -05:00
Mario Limonciello
9a77f1c7ad synapticsmst: Rework Tesla/Leaf write process
- Split up `synapticsmst_device_write_firmware` to smaller more manageable
  chunks
- Use `FuDeviceLocker` to ensure that device is in a known state after
  update is complete (both in success or failure scenarios)
- Retry the write process up to 10 times in case of DPCD update failures
- Wait for flash clear to settle before writing to EEPROM/SPI
2018-08-06 00:34:42 -05:00
Mario Limonciello
0677d92b03 synapticsmst: If failing to enable remote control, disable and retry
Any previously failed runs or outside tools may adjust the remote
control register leaving the MST controller in a poor state.

If remote control enablement fails, try to disable and then re-enable
before aborting.
2018-08-06 00:34:42 -05:00
Mario Limonciello
2b4013562d synapticsmst: Add a reboot at end of flash cycle
This makes sure the MST hub jumps to the new active firmware after
completion.
2018-08-06 00:34:42 -05:00
Mario Limonciello
801cca6dc3 synapticsmst: remove support for setting dock type from another plugin
As seen by recent testing this is not working every time.
Since e6cda81f we're now building GUIDs that represent all the possibilities
for shared parts so it's not important to set dock type.
2018-08-06 00:34:42 -05:00
Mario Limonciello
d173901e79 synapticsmst: set parent devices for known docks without metadata 2018-08-06 00:34:42 -05:00
Mario Limonciello
e6cda81f8d synapticsmst: Drop the dependency on Dell plugin to populate devices
If the dock information is available then show that in the device name
and restrict the GUIDs created.

If it's not available, then just create GUIDs for all known docks
2018-07-19 11:09:05 -05:00
Richard Hughes
d3f2878f19 synapticsmst: Fix several small memory leaks during enumeration 2018-06-28 18:16:24 +01:00
Mario Limonciello
dfb87c51c9 trivial: synapticsmst: drop efivar dep 2018-06-04 20:00:07 -05:00
Richard Hughes
4be17d1364 Add support for relocating various runtime paths
This allows a snap package to be easily built.

With much help from Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2018-05-31 16:25:22 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
cf22df177f trivial: Remove the synapticsmst noinst tool 2018-05-18 10:24:38 +01:00
Mario Limonciello
1a60231658 trivial: synapticsmst: Recognize boardid 0x103
This board_id will be used in a new device in the future.
The enum and description will be updated later when more details
are ready.
2018-05-03 14:07:42 -05:00
Mario Limonciello
e9046e7207 synapticsmst: Set TB16/WD15 appropriately in topology 2018-05-03 08:07:04 +01:00
Mario Limonciello
a98df55d82 Disable -Wunused-function on clang builds (Closes #467)
GLib creates two static inline functions for paramaters that may
not be used that set off warnings in clang but not gcc.

Ignore these on clang builds everywhere that
G_DEFINE_AUTOPTR_CLEANUP_FUNC is used.
2018-04-17 10:10:43 +01:00
Sjoerd Simons
8d38e0eae2 synapticsmst: Fix self test
A test run should really fail if it cannot find the test data, rather
then reporting success (thus masking that it never ran). Fix the test to
find it data (probably broken with the port to meson) and make it fail
if it cannot find its data.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-12 20:31:30 -05:00
Sjoerd Simons
2bc6d0a38a synapticsmst: Improve error reporting
Rather then always assuming open() fails because of permission denied,
generate the GError code from the errno and add the related strerror to
the message. And ofcourse output the error message in debugging rather
then just ignoring it.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-12 20:31:30 -05:00
Sjoerd Simons
9b0d1d4ca4 synapticsmst: Only enumerate Dell Docks if the type is known
The type of Dell dock gets used in the device GUID, so make that
mandatory for device enumeration to succeed. Only relying on the
synapticsmst plugin to be cold plugged after the dell plugin isn't
enough to ensure this.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Sjoerd Simons
6761896b33 synapticsmst: Disable remote control on failure
When hitting a failure during enumerating make sure remote control mode
is disabled again.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2018-04-10 15:57:59 -05:00
Mario Limonciello
1fc8553bb8 synapticsmst: Correct the callback for progress
4a036018 broke the callback progress by putting the wrong device type in.

23:34:11:0715 GLib-GObject invalid cast from 'SynapticsMSTDevice' to 'FuDevice'
23:34:11:0715 Fu  fu_device_set_progress: assertion 'FU_IS_DEVICE (device)' failed
2018-02-07 03:42:58 +00:00
Mario Limonciello
0ce0558ad7 synapticsmst: Fix crasher with MST flashing (#385)
b6f79556 caused the device ID strings to change, which synaptics
MST plugin was relying upon.

Update to use metadata instead to communicate this information.
2018-02-07 03:42:58 +00:00
Richard Hughes
2de8f13b2c Allow each plugin to opt-in to the recoldplug action
Recoldplug is really not required for the USB based plugins, and we should
restrict this action to plugins that have inter-dependencies on each other.
2018-01-17 20:19:58 +00:00
Richard Hughes
024cc230ed Add fu_device_set_progress_full()
This allows the plugin to use the raw byte values as a progress counter without
first converting to a percentage.
2017-12-08 09:36:57 +00:00
Richard Hughes
23135eb1c9 trivial: Remove the now-unused fu_plugin_set_status() 2017-12-04 17:00:22 +00:00
Mario Limonciello
eb737f15f5 fix CI builds with -Werror
Switching to build in -werror in 4016c839a8
was not working properly.  Adjust the CI builds to use --werror instead.

Also while doing this, enable -werror in clang builds.
2017-11-30 16:42:26 -06:00
Richard Hughes
4a036018f7 Set the progress and state on the FuDevice, not the FuPlugin
This makes more sense; we're updating the device, not the plugin itself.

This also means we don't need to funnel everything through callbacks like
GFileProgressCallback and we can also update the state without adding an
explicit callback to each derived device type.
2017-11-30 20:51:52 +00:00
Richard Hughes
d0cff7caec Remove autoconf-isms from the meson configure options
See https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2017-11-27 18:07:53 +00:00
Richard Hughes
f1d6f6cfc3 trivial: Unconstify an allocated variable to avoid a GCC warning 2017-11-10 14:31:22 +00:00
Richard Hughes
ac32f71a00 trivial: Remove the GObjectClass padding for private objects 2017-10-28 15:18:35 +01:00
Mario Limonciello
7af941fee4 synaptics: drop hard dependency on dell plugin and libsmbios
Rather than have a hard dependency use metadata and internal DMI
to communicate the relevant details
2017-10-18 08:27:38 -05:00
Richard Hughes
f50eca4f55 trivial: Add FWUPD_STATUS_DEVICE_BUSY
This is when we're waiting for the device, but we don't know why.
2017-10-12 12:43:25 +01:00
Richard Hughes
9e79223ecf trivial: C99ify more for-loops 2017-09-28 09:23:52 +01:00
Richard Hughes
c1c2fec6f5 Add optional icons to each device
This allows us to show the devices in a GUI with a nice icon. Some of the icon
mappings are not perfect and I'll be asking the GNOME designers for some
additions to the icon specification.

Custom vendor icons can also be specified, and /usr/share/fwupd/icons would be
a good place to put them. If vendor icons are used they should show a physical
device with the branding, rather than just the vendor logo.
2017-09-11 17:27:35 +01:00
Richard Hughes
9bfcfd88cf Ensure more devices set the device summary
This helps users identify what the device actually does.
2017-09-11 15:10:50 +01:00
Richard Hughes
5720fc9d90 trivial: Add more vendor information to devices 2017-09-11 10:11:34 +01:00
Yehezkel Bernat
e43f7fb655 trivial: cleanup for many compilation warnings from clang
Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
2017-08-30 10:43:15 +01:00
Mario Limonciello
f30a1cbaa1 synapticsmst: use hwid to match supported systems
This is to help break the dependence on the Dell plugin during
initalization.

NOTE: there are corner cases that this plugin will no longer
detect Dell systems now, but these are expected to be rare.
2017-08-29 16:37:14 -05:00
Mario Limonciello
257c14ebd1 dell: prefer to detect supported systems from OEM strings
This requires dmidecode 3.1 or later.
SMBIOS tables are not a reliable enough method on all systems.
2017-08-29 16:37:14 -05:00
Richard Hughes
a785a1c2f6 Remove the confusing ALLOW_OFFLINE and ALLOW_ONLINE flags
Over the months the original meaning of ALLOW_OFFLINE and ALLOW_ONLINE have be
lost, and there is now a confusing mixture of uses in the source tree. With this
commit we make it clear the UPDATABLE flag is used to specify when the device is
updatable (e.g. from the desktop live session, or from the systemd offline
updates mode, or both) and the NEEDS_REBOOT flag lets us know when the update
is actually going to be done.

For instance, a UEFI UpdateCapsule can be *scheduled* from either the desktop
or from the update mode (but the latter would be a bit weird), but does require
a reboot. Some devices might only be updatable outside the live session, for
instance a hard drive update or a GPU update -- there's just too much going on
with a live session and we want to tightly control what's running during the
firmware flash.

This also means we don't have to "retry" the update when scheduling an update
that really can be scheduled whenever, but just requires a reboot to apply.
2017-08-26 18:09:21 +01:00
Richard Hughes
c788134f75 trivial: Ensure that all the C source files include 'config.h' 2017-08-23 18:26:29 +01:00
Richard Hughes
e7472a22cc Use a static library to avoid symlinking files for the tests 2017-08-09 10:19:13 +01:00
Mario Limonciello
5c1df14d05 fix test suite localstate directory to be a temporary directory 2017-04-20 13:53:19 -05:00
Richard Hughes
1fdb335025 Remove the automake build system 2017-04-13 18:42:08 +01:00
Richard Hughes
87e82a716d trivial: Add the optional valgrind functionality back 2017-04-12 18:21:08 +01:00
Richard Hughes
38a08807f5 trivial: Fix linking in the synapticsmst plugin 2017-04-12 17:54:46 +01:00
Richard Hughes
57746cb839 Add the Meson build system as an alternate to autotools
Automake and autoconf are impossible to fully understand and Meson now provides
everything we need for a much smaller, faster, and more understandable build.

See http://mesonbuild.com/ for more information.
2017-04-12 16:35:18 +01:00
Richard Hughes
d3f4b5a428 trivial: Define the build dir outside the source file 2017-04-12 14:26:14 +01:00
Mario Limonciello
99489a8638 trivial: set synaptics error message in more scenarios 2017-03-20 13:34:26 -05:00
Richard Hughes
7db8ed498b trivial: Unbreak make check 2017-02-24 10:55:46 +00:00
Richard Hughes
c3c28bacae trivial: Always initialize a g_autoptr as the compiler is not yet smart enough 2017-02-24 07:54:51 +00:00
Mario Limonciello
6cabd969e9 trivial: correct a small memory leak in SynapticsMST plugin 2017-02-23 13:16:04 -06:00
Mario Limonciello
aad9729347 trivial: fix build issues with older efivar
This is in the same vane as 4da67515, it allows linking with
an older efivar.
2017-02-15 09:29:59 -06:00
Richard Hughes
d82a6024e7 Fix a crash when enumerating devices on a Dell WLD15 2017-02-13 11:03:03 +00:00
Richard Hughes
31c36cd2b6 trivial: Fix some -Wdiscarded-qualifiers warnings 2017-02-13 11:02:19 +00:00
Richard Hughes
6d5f2dc25e trivial: Fix compile warnings when building packages 2017-02-13 10:50:07 +00:00
Richard Hughes
4da6751502 trivial: Fix build issue
Patch from Gert Hulselmans, many thanks.

Fixes: https://github.com/hughsie/fwupd/issues/88
2017-02-13 10:50:07 +00:00
Richard Hughes
3e214856fb trivial: Fix a resource leak spotted by coverity 2017-02-08 11:03:48 +00:00
Mario Limonciello
8971645f78 trivial: synapticsmst: don't bother to scan cascade nodes in test suite
This significantly speeds up the test suite.

They can't really be easily represented anyways in the test suite
since the devnode would have to change so much between steps.
2017-02-03 13:21:29 -06:00
Richard Hughes
c4cbcafe5e synapticsmst: Fix up some trivial whitespace issues 2017-02-03 10:11:41 +00:00
Mario Limonciello
0a65ffb239 synapticsmst: add a test suite 2017-02-02 21:43:42 -06:00
Mario Limonciello
f5144d0720 trivial: synaptics: increase flash mode delay to 3s
This allows devices with multiple hubs to settle between device
flashes better.  It doesn't have much other functional impact.
2017-02-01 17:16:27 -06:00
Mario Limonciello
e41e4a7a26 trivial: synaptics: encode chip ID into dock string
Although the same payload is used for all 3 MST hubs in TB16 or WD15
it's possible this may change one day.  Create separate GUID's for
all 3 different combinations by encoding the chip ID into the GUID
string.
2017-02-01 16:43:57 -06:00
Mario Limonciello
43f2286e10 trivial: synaptics: update the device name to be more sensible 2017-02-01 16:43:50 -06:00
Mario Limonciello
8d97bcf0ed trivial: synaptics: keep system ID in hexadecimal 2017-02-01 14:04:44 -06:00
Mario Limonciello
66d383cfed trivial: synaptics: check for removed cascaded devices during scan 2017-02-01 13:53:34 -06:00
Mario Limonciello
9e868a2cf8 trivial: synaptics: make debug messages more useful 2017-02-01 13:33:43 -06:00
Mario Limonciello
8d51d273e7 trivial: synapticsmst: consistently use lower case for dock ID's 2017-02-01 13:25:54 -06:00
Mario Limonciello
ccee8cd86f trivial: synaptics: remove cascaded devices if the direct device falls off 2017-01-31 11:02:54 -06:00
Mario Limonciello
7319259a84 Add a new function fu_dell_supported to fu-dell-common
This is used by Dell, Synaptics and Thunderbolt plugins
to identify if the system is a Dell system and if so
activate special code paths.
2017-01-30 20:58:28 -06:00
Mario Limonciello
8e74df7528 synapticsmst: build GUID using dock type
Although WD15 and TB16 share a same payload today, this may not
be the case some day in the future.  Use the fu-dell-common method
to determine the dock in use to build the GUID.
2017-01-30 20:37:48 -06:00
Mario Limonciello
8c7b98da56 synapticsmst: Iterate all nodes rather than hardcoding to 3 2017-01-26 17:06:22 -06:00
Richard Hughes
7ed92084ac trivial: Fix make distcheck 2017-01-25 09:54:00 +00:00
Mario Limonciello
493b63f6cc trivial: shuffle fu-dell-flash into fu-dell-common
This will make sharing common functions from the dell plugin with
others easier
2017-01-23 11:27:03 -06:00
Mario Limonciello
ceb0ea9582 trivial: synaptics: don't advertise device remote control out to the plugin or tool 2017-01-20 16:26:56 -06:00
Mario Limonciello
eebf9f9c7d synapticsmst: fix cascade support in the plugin
There was a lot of confusion about when remote control was turned
on or off leading to dsyfunctional cascade support.

This has been confirmed to work for querying and flashing both
VMM3320s in a Rugged Latitude 5414 + dock.
2017-01-20 16:22:31 -06:00
Richard Hughes
67a756c93f synapticsmst: Refactor away the global state
The synapticsmst-common.c file had some global state so that cascade devices
could use the device fd. This made the control flow error prone, and it meant
that the fd could be leaked trivially on any error path.

Moving the fd ownership to the device is the logical place for the control, and
means we can create "connections" to access the main device and the cascade
devices.

This fixes the warnings detected by Coverity.
2017-01-19 13:41:04 +00:00
Richard Hughes
fffa21639b trivial: unindent a code block 2017-01-19 08:51:16 +00:00
Richard Hughes
d99282f2ca trivial: Fix an anti-pattern when returning error strings 2017-01-19 08:43:06 +00:00
Mario Limonciello
836ff015b3 trivial: synaptics: on new systems show unknown rather than failing 2017-01-17 16:08:04 -06:00
Mario Limonciello
7d5003e643 trivial: synaptics: don't fail on systems with less DP aux nodes 2017-01-17 13:23:46 -06:00
Mario Limonciello
548c6901c4 trivial: synaptics: add missing ID string for Rugged platforms 2017-01-17 12:13:59 -06:00
Mario Limonciello
0ed79d5455 trivial: synaptics: log invalid board IDs 2017-01-17 12:02:15 -06:00
Richard Hughes
31fd185ecf trivial: Fix make distcheck 2017-01-17 15:44:52 +00:00
Richard Hughes
8dafc604e0 trivial: Fix up the typedef'd enum style 2017-01-17 14:15:00 +00:00
Richard Hughes
2153cd0f89 trivial: Use guint8 rather than guchar
Although it's probably the same, this matches the other plugins.
2017-01-17 14:10:12 +00:00
Richard Hughes
26aade02d2 trivial: Don't use caps in variable names 2017-01-17 13:21:14 +00:00