Commit Graph

46 Commits

Author SHA1 Message Date
Richard Hughes
5ef0ae182d Add a 'name' attribute to each FuProgress step
This allows us to print better warning strings, and in the future
would allow us to profile each operation in a meaningful way.

Also, add context to some of the progress steps as required.
2022-06-01 15:05:43 +01:00
Gaël PORTAY
7dab90ff90 genesys: scaler: Dump the whole CFI device 2022-05-31 02:11:22 -04:00
Gaël PORTAY
46a6b74fe7 genesys: usbhub: Dump the whole CFI device 2022-05-31 02:11:22 -04:00
Richard Hughes
d3d7cfa816 Add plugin quirk keys earlier in the startup process
This allows creating the silo when starting the engine with custom
plugin keys such as WacomI2cFlashBaseAddr.

If we move the plugin initialization earlier then we don't get the
HwID matches, so we really do have to split this into a 4-stage startup,
e.g. ->load(), ->init(), ->startup() and ->coldplug().
2022-05-09 11:13:52 +01:00
Richard Hughes
c1d67be0a5 genesys: Fix a potential buffer overread spotted by Coverity
overrun-buffer-arg: Overrunning array buf of 64 bytes by passing it to
a function which accesses it at byte offset 65 using argument len + 3UL
2022-04-25 07:03:26 +01:00
Richard Hughes
4414866d38 genesys: Remove some dead code 2022-04-23 10:28:16 +01:00
Richard Hughes
d32bbb0084 genesys: Remove unused variable 2022-04-23 10:28:16 +01:00
Richard Hughes
a7149a4dac genesys: Fix a potential OOB read 2022-04-13 15:08:12 +01:00
adamgene
11779505f7 Support Google Servo Dock 2022-04-07 09:39:12 -05:00
Gaël PORTAY
159a257546 genesys: usbhub: Fix typo
The private flag has-pubkey will be introduced with version 1.8.0.
2022-04-05 19:00:01 +01:00
Gaël PORTAY
cd6677ac01 genesys: Add support for detecting GL3521 2022-04-05 14:00:32 +01:00
Gaël PORTAY
9195798e23 genesys: usbhub: Encode PORTNUM to a single byte
The PORTNUM is composed of two bytes values that are ASCII encoded: the
super-speed and high speed port numbers.

The result is PORTNUM_3434 for an usbhub device of 4/4 ports; 34 is the
ASCII encoded value for the character '4'.

The value PORTNUM_3434 is not straightforward if read by humans; however
PORTNUM_44 is more explicit.

This change encodes the two port numbers into a single byte instead of
ASCII-encoding to a 16-bits integer.

Example:

	XPS 13 9370
	│
	└─USB2.0 Hub:
	      Device ID:          84d0e3f2a0f8b2328f7995767b23ebb40494723f
	      Current version:    92.24
	      Vendor:             GenesysLogic (USB:0x05E3)
	      GUIDs:              0cdb6604-d595-5ca3-8da0-d05cb1b71ac1 ← USB\VID_05E3&PID_0610
	                          ce9a28b1-f064-5b5a-b71b-3dea05905aea ← USB\VID_05E3&PID_0610&REV_9224
	                          e89cae82-9975-55fb-802f-63d27dbcec19 ← VID\PID_0610&HUB_00
	                          2ae5ae36-cf86-5486-bff2-1bfd30e0ac6d ← USB\VID_05E3&PID_0610&IC_352122
	                          242eea14-5dfe-55d9-9d30-acfa9ec6a9a5 ← USB\VID_05E3&PID_0610&IC_352122&BONDING_00
	                          f68080bb-3713-5154-9890-44fbd833d678 ← USB\VID_05E3&PID_0610&VENDOR_GENESYSLOGIC&IC_352122&BONDING_00&PORTNUM_44&VENDORSUP_E8A9A9E4-6C17-5F9C-B7BD-CDA49FE66D75
	      Device Flags:       • Updatable
	                          • Unsigned Payload
2022-04-04 13:32:02 +01:00
Gaël PORTAY
31dc35f9e3 genesys: usbhub: Fix test for static_tool_string value
Additionally, this regroups the call of a function and the test for the
returned value.
2022-04-02 09:51:04 +01:00
Richard Hughes
7dc34ff02e Mark more devices as CAN_VERIFY_IMAGE
This allows us to filter the devices when showing what we can dump.
2022-04-01 21:46:04 -05:00
Gaël PORTAY
e71df0d494 genesys: usbhub: Rename function to _get_code_size()
This renames the function `fu_genesys_usbhub_device_get_fw_size()` to
`fu_genesys_usbhub_device_get_code_size()` which set the attribute
`code_size`.
2022-04-01 15:47:14 +01:00
Gaël PORTAY
9213a51d4a genesys: usbhub: Set extended size for devices with public-key only
This conditionizes the extended size for devices that has public-key
support (i.e. has the private flag has-public-key; GL3523 only).
2022-04-01 15:47:14 +01:00
Gaël PORTAY
e22eaf0726 genesys: usbhub: Fix firmware max size regression
This fixes commit 1ade02e944.

Fixes:

	firmware too large, got 0x6312, expected <= 0x6000
2022-04-01 15:47:14 +01:00
Richard Hughes
dcd39d80a7 Add the CFI quirks in setup() so the device can be open 2022-03-31 12:47:13 +01:00
adamgene
acc9e9fbe7 genesys: usbhub: Add instance IDs for generic hub
1. add and set FuGenesysVendorSupportToolString.
2. customized instance IDs  with follow,
- "IC"
- "BONDING"
- "VENDOR" - mask code unsupported
- "PORTNUM"  - mask code unsupported
- "VENDORSUP"  - mask code unsupported
2022-03-31 08:57:51 +01:00
adamgene
8f786b0818 genesys: usbhub: Get dynamic ts info from device
1. add FuGenesysDynamicToolString.
2. extract running_bank / bonding from dynamic_ts.
2022-03-31 08:57:51 +01:00
adamgene
2868c924bc genesys: usbhub: Unsupport without tool string
1. Legacy device unsupported.
2. add fu_genesys_tsdigit_value() to convert ts corretly.
3. delete wrong checking tool_string_version in 0xff.
2022-03-31 08:57:51 +01:00
adamgene
852b94bbe1 genesys: usbhub: Read firmware size from blob
This fixes the firmware size of for the GL3590 chips.
2022-03-31 08:57:51 +01:00
Gaël PORTAY
cfb75f0da4 genesys: usbhub: Add genuine Genesys Logic USB Hub 2022-03-31 08:57:51 +01:00
Gaël PORTAY
79228d8b7d genesys: usbhub: Remove unnecessary local 2022-03-23 21:45:58 +00:00
Gaël PORTAY
b2f3e57418 genesys: usbhub: Move instruction in else statement 2022-03-23 21:45:58 +00:00
Gaël PORTAY
1ade02e944 genesys: usbhub: Reuse attribute fw_data_total_count
This uses the attribute fw_data_total_count to set the firmware size,
and decreases the duplication of constants.
2022-03-23 21:45:58 +00:00
Gaël PORTAY
859a1e2f42 genesys: usbhub: Decrease hardcoded constants
This adds new defines to decrease the use of hardcoded constant in the
code.
2022-03-23 21:45:58 +00:00
Gaël PORTAY
13ad6125a4 genesys: usbhub: Move some code to common
This moves some code to common and reuses a constant to decrease
hardcoded constants.
2022-03-23 21:45:58 +00:00
Gaël PORTAY
737443d73c genesys: usbhub: Fix firmware size for GL3590 hubs 2022-03-23 21:45:58 +00:00
Gaël PORTAY
c6c64bd8dc genesys: Add since version comment for private flags
This tags when the private flags has been introduced.
2022-03-23 20:46:39 +00:00
Gaël PORTAY
d056b382dd genesys: usbhub: Add has-public-key private flag
The Genesys Logic USB Hub does have support for public-key.

This adds the private flag has-public-key, and sets that flag for the HP
USB Hubs only. Also, this authenticates during setup only if that flag
is set.
2022-03-23 20:46:39 +00:00
Gaël PORTAY
ac760f7a2d genesys: usbhub: Set dual-image flat in quirk file
Some Genesys Logic USB Hub does have support for dual-image.

This sets the flag dual-image in the quirk file instead of hardcoding it
in the plugin.
2022-03-23 20:46:39 +00:00
Gaël PORTAY
be4e3fffdc genesys: usbhub: Identify HP usbhub using its public-key
The HP M2xfd monitors use GenesysLogic GL3523 USB Hub and provides their
own firmwares. Furthermore, HP uses the same VID/PID for other USB Hubs
products, with a different public-key; the HP M24fd and M27fd use
different public-key.

This appends the public-key to the instance-id string to make the
distinction between all the HP USB Hubs, and prevents to install a
firmware with the wrong public-key.
2022-03-23 20:46:39 +00:00
Gaël PORTAY
ad3cf1874a genesys: Fix typo in README.md
The device name HP USB-C Controller.
2022-03-23 20:46:39 +00:00
Gaël PORTAY
9ff6c88acf genesys: usbhub: Prefix error at probe
For the sake of consistancy.
2022-03-23 20:00:33 +00:00
Gaël PORTAY
3be9fbb301 genesys: usbhub: Fail silently if unsupported IC type
Genesys Logic uses the same VID/PID for its USB Hubs products, whatever
the chip underneath (GL3523, GL3590...). For example, Genesys Logic
USB2.0 Hub uses 05E3/0610; and Genesys Logic USB3.1 Hub uses 05E3/0612.

The manufacturers may reuse the Genesys Logic VID/PID for its products
or may use its own VID such as HP (03F0).

The genesys plugin supports upgrading GL3523 USB and GL3590 USB2.0 Hubs
for now (the latter is not tested).

The quirk file limits the support to HP Hubs only; and the plugin will
allow upgrade Hub with genuine Genesys Logic VID/PID in the future by
adding the following lines to the quirk file:

	[USB\VID_05E3&PID_0610]
	Plugin = genesys

However, this change in the quirk file will report the errors below for
the Hub with IC that are not supported:

	04:26:40:0325 FuEngine             failed to add device usb:01:00:01: Unsupported IC GL3521-22
	04:26:40:0344 FuEngine             failed to add device usb:01:00:01: Unsupported IC GL3521-22

Note: This may be true already if HP uses Hubs with IC that are not
unsupported.

This change returns the error FWUPD_ERROR_NOT_SUPPORTED instead to fail
silently.
2022-03-23 20:00:33 +00:00
Gaël PORTAY
fa7c297b98 genesys: usbhub: Print unsupported IC type
This rewords the error message to print the unsupported IC type.
2022-03-23 20:00:33 +00:00
Gaël PORTAY
333c32a8e0 genesys: Fix memory leak 2022-03-23 17:22:53 +00:00
Gaël PORTAY
7fc784d612 genesys: scaler: Get real software version
The plugin gets the panel-type (i.e. hardware revision) as the firmware
version.

This gets the real firmware version, and appends the panel-type to the
instance-id string as the blobs are specific to panel-types.
2022-03-22 14:20:37 +00:00
Gaël PORTAY
388fadc347 genesys: scaler: Fix Special Protect Sector structure length
The Special Protect Sector structure is 24-bit long.

This replaces the 32-bit integer in union that makes the structure
8-bits too big by an array of 3-bytes.
2022-03-22 14:19:48 +00:00
Gaël PORTAY
41ab816fed genesys: scaler: Fix creation of error
The GError object is not yet created, and cannot be prefixed though.

This creates the GError using the function g_set_error().
2022-03-22 14:19:48 +00:00
Richard Hughes
c4ca026294 Allow devices to build instance IDs more easily
Provide a device instance builder that allows plugins to easily
create multiple instance IDs based on parent attributes.

Also fix a lot of the instance ID orders, so that we add more generic
IDs first, and more specific IDs after.
2022-03-03 09:13:29 +00:00
Mario Limonciello
661990ed98 Convert build system to use meson tristate features
tristate features will automatically disable if dependencies marked
as required are missing.

Packagers can manually override using `auto_features`.

Link: https://mesonbuild.com/Build-options.html#features
2022-02-28 08:34:48 -06:00
Richard Hughes
758d5d8c6f Add a flag to indicate the device is signed or unsigned
Devices without either flag are unknown.
2022-02-22 19:12:06 +00:00
Mario Limonciello
7b3f3ccc65 trivial: genesys: fix some warnings about unused symbols on old gusb 2022-02-21 12:36:14 -06:00
Ricardo Cañuelo
9466e778f5 Add a new plugin to handle HP M2xfd monitors
Added support for genesys logic devices.
2022-02-21 08:30:43 +00:00