Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin pixart-rf has a coverage score of 11% #7095

Open
hughsie opened this issue Apr 12, 2024 · 5 comments
Open

Plugin pixart-rf has a coverage score of 11% #7095

hughsie opened this issue Apr 12, 2024 · 5 comments

Comments

@hughsie
Copy link
Member

hughsie commented Apr 12, 2024

The pixart-rf fwupd plugin has a very low coverage score: https://coveralls.io/github/fwupd/fwupd -- This means it’s not being adequately tested during CI and pre-release testing, and might mean we release the plugin to end users with an accidental and unfortunate regression. The best way to make sure this doesn’t happen is to provide a device-test, and there are a lot of examples in https://github.com/fwupd/fwupd/tree/main/data/device-tests for existing hardware.

The emulated device test in CI downloads a “device emulation data” from the LVFS which sets up a virtual USB device that we can control from the daemon. Then we download a cab archive of the actual firmware for the device (also from the LVFS) and then install the real firmware archive on the virtual device. This usually tests out a lot of the plugin functionality, and is enough to make the plugin coverage rise up to 70-90% typically – which is great, and means we can refactor the common daemon code without risk of introducing a regression. All new USB plugins going into fwupd now must have an emulated test for CI, and we’re now trying to get the existing plugins up to the same standard.

We’re of course happy to help with this task, but we don’t have all the physical hardware needed to generate an emulation of the update being applied. This is why I’ve assigned the plugin owner to this issue :) What I’d like you to do is:

We can then test the emulation works on our system (without physical hardware), build the JSON file and add it to the fwupd repo for you. Although one firmware will work, ideally we want to test upgrading from 1.0.2 to 1.0.3 and downgrading from 1.0.3 to 1.0.2 (with example version numbers) rather than just reinstalling 1.0.3 onto itself. If you'd like to write the device-test JSON file yourself and submit a PR that's even better.

If you have any questions, queries or worries please let us know, either here or by email. Thanks!

@hughsie
Copy link
Member Author

hughsie commented Apr 12, 2024

@sam412081go

@sam412081go
Copy link
Contributor

@hughsie
Hi Hughsie, I encountered an issue while implementing emulation device data.

I follow this page Device Emulation to record behavior of my device, but have problem when I use fwupdmgr emulation-save, it shows failed to save emulation data: no emulation data, perhaps no devices have been added?

Below is my command history :

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr modify-config AllowEmulation true
Restart the daemon to make the change effective? [y|N]: y
Successfully modified configuration value

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr emulation-tag 5a4e9ebd-9c40-5e7f-b7ff-424030dfcc66
0.	Cancel
1.	745fdf5b7ba2d86e9dcd525f1060d91b6a851ee8 (HP HP 65x/45x Series dongle)
2.	71d3042554d6d110f4268c92de0c117b53023512 (HP HP 65x/45x Series dongle)
3.	6e39378578f82f62f53a7d9b528d44ac304c053b (HP HP 65x/45x Series dongle)
Choose device [0-3]: 1
Action Required: Unplug and replug the device, then install the firmware.

I unplug my device, then replug it.

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr get-devices --filter emulation-tag
Dell Inc. Latitude 5300
?

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr download https://fwupd.org/downloads/498e534e8d28b6c835459ef20881ef1cae21a7b2aea5a76cc17794cb53504899-test_v1.cab
Downloading?             [******************************         ]

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr install ./498e534e8d28b6c835459ef20881ef1cae21a7b2aea5a76cc17794cb53504899-test_v1.cab --allow-reinstall
Installing on HP HP 65x/45x Series dongle?                       ] Less than one minute remaining?
Installing on HP HP 65x/45x Series dongle?*********              ] Less than one minute remaining?
Waiting?                 [***************************************] Less than one minute remaining?
Successfully installed firmware

root@210fdcccba1a:/github/workspace/testfw# fwupdmgr emulation-save dongle_data.zip
failed to save emulation data: no emulation data, perhaps no devices have been added?

I am using docker with os ubuntu 24.04

root@210fdcccba1a:/github/workspace/testfw# cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Below is information of my device:

root@210fdcccba1a:/github/workspace/testfw# fwupdtool get-devices --plugins=pixart_rf
Loading?                 [************************************** ]
Dell Inc. Latitude 5300
?
??HP HP 65x/45x Series dongle:
? ?   Device ID:          745fdf5b7ba2d86e9dcd525f1060d91b6a851ee8
? ?   Current version:    01.10.5
? ?   Vendor:             USB:0x093A|HIDRAW:0x03F0
? ?   GUIDs:              e8affe5f-f308-5388-ae26-8a4e956bef0b ? HIDRAW\VEN_03F0&DEV_6841
? ?                       20c3bda1-5b57-5eed-b8cb-f1c33bc9ba2a ? HIDRAW\VEN_03F0&DEV_6841&NAME_HP_HP_65X/45X_SERIES_DONGLE
? ?                       5a4e9ebd-9c40-5e7f-b7ff-424030dfcc66 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PDONGLE
? ?   Device Flags:       ? Updatable
? ?                       ? Unsigned Payload
? ? 
? ??PMOUSE:
?       Device ID:        08544d58926d515b867a48231b8efb261d25a753
?       Current version:  01.10.6
?       Vendor:           USB:0x093A
?       GUID:             14663864-3a54-56ab-ba07-66db9e97dee9 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PMOUSE
?       Device Flags:     ? Updatable
?                         ? Unsigned Payload
?     
??HP HP 65x/45x Series dongle:
? ?   Device ID:          71d3042554d6d110f4268c92de0c117b53023512
? ?   Current version:    01.10.5
? ?   Vendor:             USB:0x093A|HIDRAW:0x03F0
? ?   GUIDs:              e8affe5f-f308-5388-ae26-8a4e956bef0b ? HIDRAW\VEN_03F0&DEV_6841
? ?                       20c3bda1-5b57-5eed-b8cb-f1c33bc9ba2a ? HIDRAW\VEN_03F0&DEV_6841&NAME_HP_HP_65X/45X_SERIES_DONGLE
? ?                       5a4e9ebd-9c40-5e7f-b7ff-424030dfcc66 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PDONGLE
? ?   Device Flags:       ? Updatable
? ?                       ? Unsigned Payload
? ? 
? ??PMOUSE:
?       Device ID:        6a294ef329c04b79faef0be04c3a031f82794198
?       Current version:  01.10.6
?       Vendor:           USB:0x093A
?       GUID:             14663864-3a54-56ab-ba07-66db9e97dee9 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PMOUSE
?       Device Flags:     ? Updatable
?                         ? Unsigned Payload
?     
??HP HP 65x/45x Series dongle:
  ?   Device ID:          6e39378578f82f62f53a7d9b528d44ac304c053b
  ?   Current version:    01.10.5
  ?   Vendor:             USB:0x093A|HIDRAW:0x03F0
  ?   GUIDs:              e8affe5f-f308-5388-ae26-8a4e956bef0b ? HIDRAW\VEN_03F0&DEV_6841
  ?                       20c3bda1-5b57-5eed-b8cb-f1c33bc9ba2a ? HIDRAW\VEN_03F0&DEV_6841&NAME_HP_HP_65X/45X_SERIES_DONGLE
  ?                       5a4e9ebd-9c40-5e7f-b7ff-424030dfcc66 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PDONGLE
  ?   Device Flags:       ? Updatable
  ?                       ? Unsigned Payload
  ? 
  ??PMOUSE:
        Device ID:        1170804da958d74eff6b40d0b409b13a2467bde0
        Current version:  01.10.6
        Vendor:           USB:0x093A
        GUID:             14663864-3a54-56ab-ba07-66db9e97dee9 ? HIDRAW\VEN_03F0&DEV_6841&MODEL_PMOUSE
        Device Flags:     ? Updatable
                          ? Unsigned Payload

@hughsie
Copy link
Member Author

hughsie commented May 24, 2024

  1. 745fdf5b7ba2d86e9dcd525f1060d91b6a851ee8 (HP HP 65x/45x Series dongle)
  2. 71d3042554d6d110f4268c92de0c117b53023512 (HP HP 65x/45x Series dongle)
  3. 6e39378578f82f62f53a7d9b528d44ac304c053b (HP HP 65x/45x Series dongle)
    Choose device [0-3]: 1

Have you got three identical dongles attached? If so, can you try with just one attached?

@sam412081go
Copy link
Contributor

Actually, these three Device IDs all come from the same Dongle because the Dongle declares three Interfaces. However, this does not affect the firmware update; It can be selected any one of them to update the Dongle.

@superm1
Copy link
Member

superm1 commented May 24, 2024

@hughsie same problem with composite devices maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants