Commit Graph

34 Commits

Author SHA1 Message Date
Richard Hughes
baf10157dd pixart-rf: Retry the SetReport after a successfull firmware update 2021-03-29 10:23:16 +01:00
JimmyYu
af1e70ad92 pixart: Modify ota retransmit flow 2021-03-22 17:48:08 +01:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00
JimmyYu
bc39faf4cf pixart: Add check result in fw upgrade response
Signed-off-by: Richard Hughes <richard@hughsie.com>
2021-03-15 13:07:13 +00:00
Richard Hughes
52441f28a4 Allow objects to deserialize to XML
This makes a lot more sense; we can parse a firmware and export the same XML
we would use in a .builder.xml file. This allows us to two two things:

 * Check we can round trip from XML -> binary -> XML

 * Using a .builder.xml file we can check ->write() is endian safe
2021-03-15 12:07:30 +00:00
Richard Hughes
408b056984 trivial: Use fu_byte_array_append_bytes() in more places 2021-03-15 09:46:02 +00:00
Richard Hughes
91324a13c0 pixart: Call finalize() on FuFirmware to avoid leaking 2021-03-12 15:51:25 +00:00
Ricardo Cañuelo
2619442293 pixart: Detect multiple devices of the same type
Set the logical_id to the HID_UNIQ string instead of using the vendor,
device and model info.
2021-03-11 14:38:55 +01:00
Richard Hughes
ee48857806 pixart: Support building firmware with the model_name metadata 2021-03-11 12:04:00 +00:00
JimmyYu
18d79a0625 pixart: Check firmware compatibility with hardware before flashing
Also add low-battery detection to ensure the update is safe to apply.
2021-03-10 16:23:18 +01:00
Richard Hughes
1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00
JimmyYu
6d45136c25 pixart: Filter the wrong report ID 2021-03-05 12:19:33 +01:00
Richard Hughes
c9d6fecc5e pixart: Workaround a HIDIOCGFEATURE bug and/or regression
We're still in the process of hunting for the real cause.
2021-03-03 15:36:42 +00:00
Richard Hughes
bf3732f994 pixart: Use the bluetooth UUID to set the logical ID
This means you can have more than one device attached to the same controller.
2021-03-03 15:36:42 +00:00
Richard Hughes
88d9ace4a3 pixart: Include the missing ->to_string() parent class 2021-03-03 15:36:42 +00:00
Richard Hughes
7d132b728c Simplify the quirk file format
The best way of not getting something wrong is to not require it in the first
place...

All plugins now use DeviceInstanceId-style quirk matches and we can just drop
the prefix in all files. We were treating HwId=, Guid= and DeviceInstanceId= in
exactly the same way -- they're just converted to GUIDs when building the silo!
2021-03-03 08:30:34 +00:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
078beafb2d Add a new internal flag to opt-in to GUID matching
It is far too easy to forget to set FWUPD_DEVICE_FLAG_NO_GUID_MATCHING for new
plugins, and without it it all works really well *until* a user has two devices
of the same type installed at the same time and then one 'disappears' for hard
to explain reasons. Typically we only need it for replug anyway!

Explicitly opt-in to this rarely-required behaviour, with the default to just
use the physical and logical IDs. Also document the update behavior for each
plugin to explain why the flag is being used.

This allows you to have two identical Unifying plugged in without one of them
being hidden from the user, at the same time allowing a HIDRAW<->USB transition
when going to and from bootloader and runtime modes.

This removes the workaround added in 99eb3f06b6.

Fixes https://github.com/fwupd/fwupd/issues/2915
2021-02-25 15:47:25 +00:00
Chang Po-Hung
86d3c58e3b Add cheetos quirk in pixart-rf 2021-02-20 07:28:51 +00:00
JimmyYu
6934656959 pixart: Fix more supported PID 2021-02-19 09:06:58 +00:00
Richard Hughes
a22c13c637 Move the plugin build logic to the plugins themselves 2021-02-18 14:46:20 +00:00
JimmyYu
d6cf611861 pixart: Modify the README content 2021-02-18 09:11:35 +00:00
JimmyYu
8e10abf308 pixart: Add more supported pixart devices 2021-02-18 09:11:35 +00:00
JimmyYu
618fae792f pixart: Re-define var and Guid 2021-02-18 09:11:35 +00:00
Richard Hughes
645a62002e pixart: Add some error prefixes to aid debugging 2021-02-17 08:48:45 +00:00
Richard Hughes
63a9665107 pixart: Fuzz the firmware parser 2021-02-17 08:48:45 +00:00
Richard Hughes
7fb4397f25 pixart: Set firmware version raw 2021-02-17 08:48:45 +00:00
JimmyYu
b7551c0211 pixart: Add support for more devices 2021-02-17 08:48:45 +00:00
Richard Hughes
5018d14dcd trivial: Remove executable permission on a C source file... 2021-02-16 12:26:28 +00:00
Richard Hughes
d99f86023f trivial: Add getters to FuChunk
At the moment FuChunks are sometimes mutable, and sometimes immutable, and it's
all a bit too low level for comfort.

Before we can do any kind of optimisation or verification we need plugins to
stop reading directly from the C structure. The aim here is to make FuChunk
optionally mutable without making assumptions about the memory model, and also
to be able to introspect it for the docs.
2021-01-28 16:42:54 +00:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
0d412b535e trivial: Remove invalid buffer dump in pixart_rf
Spotted by Coverity.
2021-01-08 20:53:11 +00:00
Richard Hughes
eddaed0c11 Allow specifying more than one VendorID for a device
Asking the user for the UID mapping isn't working very well, as it requires lots
of manual handholding. It also doesn't work very well when the device vendor
does not actually have a PCI ID or if the vendor has split into two entities.

Just use the OUI address as an additional VendorID and match any of the device
IDs against any of the metadata-supplied values.
2021-01-04 22:30:20 +00:00
Jimmy Yu
23cd466ef1 Add plugin to update PixArt RF devices
Signed-off-by: Richard Hughes <richard@hughsie.com>
2021-01-04 17:20:13 +00:00