Commit Graph

53 Commits

Author SHA1 Message Date
Richard Hughes
87fb9ff447 Change the quirk file structure to be more efficient
This pivots the data storage so that the group is used as the preconditon
and the key name is used as the parameter to change. This allows a more natural
data flow, where a new device needs one new group and a few few keys, rather
than multiple groups, each with one key.

This also allows us to remove the key globbing when matching the version format
which is often a source of confusion.

Whilst changing all the quirk files, change the key prefixes to be more familiar
to Windows users (e.g. Hwid -> Smbios, and FuUsbDevice -> DeviceInstanceId)
who have to use the same IDs in Windows Update.

This also allows us to pre-match the desired plugin, rather than calling the
probe() function on each plugin.
2018-06-28 13:32:30 +01:00
Richard Hughes
63b173046d trivial: Rename the 'plugin-hints' functionality to 'custom-flags'
They will be used as actual flags in the future.
2018-06-28 12:07:13 +01:00
Richard Hughes
04d6965a14 ebitdo: Do not use bootloader commands after a successful flash and reboot
We need to remove the flag if the quirk is not present.

Fixes the cosmetic-but-scary-looking 'failed to send to device on ep 0x01: USB
error on device 2dc8:9001 : Input/output error'.

Fixes the other half of https://github.com/hughsie/fwupd/issues/565
2018-06-26 14:12:02 +01:00
Richard Hughes
7a874176ff trivial: Add a FuDevice flag to show the device is in bootloader mode
This is useful to present to the user using the command line, and means each
FuDevice-deriving object does not have to handle this.
2018-05-31 18:50:19 +01:00
Richard Hughes
4152990537 trivial: Convert FuEbitdoDevice to use G_DECLARE_FINAL_TYPE 2018-05-29 09:20:21 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Richard Hughes
83528ccded trivial: Remove the 8Bitdo noinst tool 2018-05-18 10:25:28 +01:00
Richard Hughes
0b8c1e7e92 ebitdo: Move the bootloader fallback instructions 2018-05-14 17:09:23 +01:00
Richard Hughes
0a0483b2ce trivial: Add a write_firmware() vfunc to FuDevice 2018-05-14 17:07:20 +01:00
Mario Limonciello
86b3bcf8c9 ebitdo: Stop matching Nintendo Switch Pro VID/PID
Unfortuantely similar to ead5bf392 this is causing problems with
real Nintendo Switch controllers.
2018-05-07 09:22:12 -05:00
Mario Limonciello
ead5bf3929 plugins/ebitdo: Stop matching DS4 controller VID/PID
This causes problems with the real DS4 controller.
Furthermore in MacOS mode fwupd doesn't actually work properly
anyhow (Closes #381)
2018-02-05 20:30:18 +00:00
Mario Limonciello
3955e6e97d 8bitdo: Add initial SF30/SN30 Pro support (#350)
The SF30/SN30 pro support 4 different modes:
* Switch mode (START + Y)
This looks like a nintendo switch pro controller
* Xinput mode (START + X)
This looks like an XBOX 360 controller
* Dinput mode (START + B)
This looks like a more generic gamepad
* macOS mode (START + A)
This looks like a Sony DS4 controller

3 modes have had a difficult time enumerating in fwupd.
Switch mode:
* failed to add USB device: unexpected device response
Xinput mode:
* failed to add USB device: USB error on device 045e:028e : Pipe error [-9]
macOS mode:
* failed to add USB device: failed to send to device on ep 0x01: USB error on device 054c:05c4 : Input/output error [-1]

The only mode I've gotten a nearly full update flow working is Dinput
so far. After updating the controller comes back in switch mode.
2018-01-08 10:45:55 -05:00
Elton (Eddie) Hartman
ae538b829a Update README.md
Small typo
2017-12-22 09:04:09 +00:00
Richard Hughes
963cb45793 ebitdo: Use quirks rather than hardcoding a list of VIDs and PIDs
This means we can trivially support new devices in the future without compiling
any new code. This makes it easier to add support for new hardware for LTS
distros like RHEL.
2017-12-11 16:49:28 +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
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
9c1cc979ff ebitdo: Use the new ->probe vfunc 2017-11-30 14:16:34 +00:00
Richard Hughes
104f651132 Add a fu_plugin_usb_device_added() dedicated vfunc
This saves all the USB plugins from connecting to the context and managing the
device lifecycle and allows devices that uses FuUsbDevice to be removed
automatically.

This makes supported plugins *much* smaller indeed.
2017-11-24 16:13:44 +00:00
Richard Hughes
d7f1bf55de ebitdo: Use the new delayed removal functionality to remove complexity
The engine keeps track of the runtime GUID, so we don't have to anymore.
2017-11-24 14:42:27 +00:00
Richard Hughes
29a524fdfb Add FuUsbDevice helper object
This allows us to move a lot of duplicated functionality out of each plugin.
2017-11-24 14:04:51 +00:00
Richard Hughes
0415811740 ebitdo: Use fu_plugin_update_reload() to get the new version number 2017-11-24 13:44:33 +00:00
Richard Hughes
b6f79556f1 Use a SHA1 hash for the internal DeviceID
It's actually less scary to see a SHA1 hash than it is to see a path like
/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.2. It's also way easier to
copy and paste into the various fwupdmgr command that require a device ID and
also means we can match a partial prefix much like git allows.

If we also move to a model where plugins can be changed during different stages
of the update (e.g. during detach) then the device might change connection type
and then the sysfs path not only becomes difficult to paste, but incorrect.

Session software doesn't care about the format of the device ID (it is supposed
to be an implementation detail) and so there's no API or ABI break here. A few
plugins also needed to be ported, but nothing too worrying.
2017-11-16 07:18:36 +00:00
Richard Hughes
c17f0f368e ebitdo: Fix a possible buffer overflow when debugging 2017-11-14 16:08:14 +00:00
Richard Hughes
49fafec020 Set environment variables to allow easy per-plugin debugging
This allows end-users testing a specific plugin to start fwupd with an extra
command line parameter, e.g. `--plugin-verbose=unifying` to output a lot of
debugging information to the console for that specific plugin.

This replaces a lot of ad-hoc environment variables with different naming
conventions.
2017-11-14 14:22:02 +00:00
Richard Hughes
9e59fa4d16 ebitdo: Rename FuDeviceEbitdo to FuEbitdoDevice
This is what most programmers expect and makes it clear what it derives.
2017-11-13 14:03:02 +00:00
Richard Hughes
ff372acb1d ebitdo: Wait for the device to come back after performing update
This means we can verify the firmware version that was flashed, and makes the
code perform in the same way as the DFU and ColorHug plugins.
2017-11-08 11:02:38 +00:00
Richard Hughes
da8f476aa2 ebitdo: Fix a error prefix string 2017-11-08 11:02:38 +00:00
Richard Hughes
876e5e0c35 ebitdo: Fix a double-unref when updating the device
This can cause the daemon to emit a critical warning...
2017-11-08 11:02:38 +00:00
Kelly Anderson
c015642803 fix mispelled redesign 2017-10-19 22:35:17 -05:00
Richard Hughes
60aa497e6b 8bitdo: Verify legacy VIDs are actually 8Bitdo controllers
8Bitdo devices with firmware <= 4.0.0 used a few different USB VIDs, some of
which being shared with other projects. For the older firmware, compare the
vendor against a whitelist to ensure we only try to update 8Bitdo game pads.

Fixes https://github.com/hughsie/fwupd/issues/275
2017-10-12 14:15:41 +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
4edeeda345 ebitdo: Use FuDeviceLocker 2017-09-07 19:00:51 +01:00
Mario Limonciello
c2ed0cb2bc trivial: update remaining use of ALLOW_ONLINE to UPDATABLE 2017-08-31 12:59:26 -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
a8909ec45b trivial: Remove the FuDevice plugin symlinks 2017-08-14 10:29:55 +01:00
Chris Lee
f519834bb9 Make flashing ebitdo devices actually work
When my SNES30 controller was in bootloader mode, it wouldn't update,
and when it was in controller mode, it tried and failed. Now, it prints
out the instructions on how to reset the device if it's in controller
mode, and if it's in bootloader mode, it successfully installs the
firmware update from the .DAT file.
2017-08-02 06:43:09 +01:00
Mario Limonciello
c29b398ad0 trivial: fix various spelling errors 2017-07-17 13:07:05 -05:00
Richard Hughes
fd381cc96e Add the ability to restrict the firmware installation to specific vendor IDs
This allows us to fix https://github.com/hughsie/lvfs-website/issues/4
2017-06-12 20:22:25 +01:00
Richard Hughes
0fe22ff010 ebitdo: Ensure the version is set on the device in non-bootloader mode 2017-06-05 09:03:44 +01:00
Richard Hughes
a9adbf5d22 ebitdo: 8bitdo has started using a new VID 2017-06-05 08:46:50 +01:00
Richard Hughes
741f3310ab ebitdo: Ensure device is closed if fu_device_ebitdo_open() did not complete
It's not expected users have to call fu_device_ebitdo_close() if opening failed.
2017-05-08 12:44:26 +01:00
Richard Hughes
1fdb335025 Remove the automake build system 2017-04-13 18:42:08 +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
932eb397d2 trivial: Fix 'make distcheck' 2017-01-10 22:10:50 +00:00
Richard Hughes
23b9c9d78d trivial: Use the per-plugin cache for the runtime device
There is no point having two hash tables doing the same thing...
2017-01-10 16:09:38 +00:00
Richard Hughes
b721d4326f ebitdo: Subclass FuDevice like the altos plugin
This makes things much simpler.
2017-01-10 14:02:16 +00:00
Richard Hughes
c7ea2a2369 trivial: Fix up two compile warnings 2017-01-07 22:10:14 +00:00