Commit Graph

68 Commits

Author SHA1 Message Date
Richard Hughes
fc2da47b69 Remove fu_strtoull_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
7f86ffab6f Split out the dump helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
425fedcca1 trivial: Remove fu_byte_array_set_size_full() 2022-06-14 14:36:52 -05:00
Richard Hughes
ed1b13da28 Split out the memory helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
9d33c29e92 Split out the string helpers to a new source file 2022-06-14 14:36:52 -05:00
Richard Hughes
3fe9c0de34 Split out the CRC and sum functions to new source files 2022-06-14 14:36:52 -05:00
Gaël PORTAY
88db2a3f9e genesys: scaler: Fix calling to parent's vfunc close()
This uses the internal flag FU_DEVICE_INTERNAL_FLAG_USE_PARENT_FOR_OPEN,
to fix the calling to the parent's vfunc close() (it was calling the
parent's vfunc open() on close()).
2022-06-12 08:22:57 -04:00
Gaël PORTAY
d5b7206a3a trivial: genesys: Another nitpick round
See commit e6f049625e.
2022-06-12 08:22:57 -04:00
Gaël PORTAY
58102313bc genesys: usbhub: Do not claim interface
This removes the claim for interface 0; and removes both vfunc open()
and close() that become useless.

Fixes https://github.com/fwupd/fwupd/issues/4730
2022-06-12 07:02:49 -04:00
Gaël PORTAY
2e719aeb94 genesys: usbhub: Remove vfunc _probe()
This removes the vfunc _probe() that is not used anymore.
2022-06-12 07:02:49 -04:00
Richard Hughes
46f4d9b993 genesys: Add a trivial missed quirk key 2022-06-10 19:00:23 +01:00
Gaël PORTAY
e5d489f680 genesys: Add M27fd AIM101 hardware 2022-06-07 05:42:44 -04:00
Gaël PORTAY
0fbd5e17fe genesys: scaler: Remove FuGenesysMtkFooter and XOR encryption 2022-06-06 16:32:17 -04:00
Gaël PORTAY
3063280ae8 genesys: Allow to force install even if public-key mismatch 2022-06-06 03:40:32 -04:00
Gaël PORTAY
882ab0812f genesys: scaler: Allow to specify Cfi
This allows to specify the Cfi device via the GenesysScalerCfiFlashId
quirk key.
2022-06-06 03:40:32 -04:00
Gaël PORTAY
6f7c4bb195 genesys: scaler: Check for firmware size 2022-06-06 03:40:32 -04:00
Gaël PORTAY
ace3f343fc genesys: scaler: Fix checking for CFI size 2022-06-06 03:40:32 -04:00
Gaël PORTAY
81f40da143 genesys: scaler: Increase retry timing after erase commands 2022-06-06 03:40:32 -04:00
Gaël PORTAY
0520411776 genesys: scaler: Get and set firmware address 2022-06-06 03:40:32 -04:00
Gaël PORTAY
7dca55a3fc genesys: Check for validity of public-key
The scaler may return invalid version or public-key.

This checks for the public-key by verifing if it starts with "N = " for
both devices usbhub and scaler; however, the scaler version cannot be
checked.

Note: Replug the USB-C cable is fixes the issue.
2022-06-06 03:40:32 -04:00
Gaël PORTAY
e6f049625e trivial: genesys: Several fixes and nitpicks 2022-06-06 03:40:32 -04:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
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