mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-17 22:03:45 +00:00
optionrom: Test if the PCI device has ROM in probe
This means we make things a simpler by not relying on udev to stat the file. It also reduces the number of added *unused* GUIDs by one per device too.
This commit is contained in:
parent
b9ef4399c9
commit
7ef2dea271
@ -4,8 +4,5 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1+
|
# SPDX-License-Identifier: LGPL-2.1+
|
||||||
#
|
#
|
||||||
|
|
||||||
# PCI cards with ROM
|
|
||||||
SUBSYSTEM=="pci", TEST=="/sys$devpath/rom", ENV{FWUPD_GUID}="$attr{vendor}:$attr{device}"
|
|
||||||
|
|
||||||
# NVMe hardware
|
# NVMe hardware
|
||||||
SUBSYSTEM=="nvme", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{builtin}="hwdb --subsystem=pci"
|
SUBSYSTEM=="nvme", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{builtin}="hwdb --subsystem=pci"
|
||||||
|
@ -18,15 +18,15 @@ G_DEFINE_TYPE (FuOptionromDevice, fu_optionrom_device, FU_TYPE_UDEV_DEVICE)
|
|||||||
static gboolean
|
static gboolean
|
||||||
fu_optionrom_device_probe (FuUdevDevice *device, GError **error)
|
fu_optionrom_device_probe (FuUdevDevice *device, GError **error)
|
||||||
{
|
{
|
||||||
GUdevDevice *udev_device = fu_udev_device_get_dev (device);
|
g_autofree gchar *fn = NULL;
|
||||||
const gchar *guid = NULL;
|
|
||||||
|
|
||||||
guid = g_udev_device_get_property (udev_device, "FWUPD_GUID");
|
/* does the device even have ROM? */
|
||||||
if (guid == NULL) {
|
fn = g_build_filename (fu_udev_device_get_sysfs_path (device), "rom", NULL);
|
||||||
|
if (!g_file_test (fn, G_FILE_TEST_EXISTS)) {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
FWUPD_ERROR_NOT_SUPPORTED,
|
FWUPD_ERROR_NOT_SUPPORTED,
|
||||||
"no FWUPD_GUID property");
|
"Unable to read firmware from device");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user