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

dell-dock: add support for k2 dock #7355

Closed
wants to merge 1 commit into from
Closed

dell-dock: add support for k2 dock #7355

wants to merge 1 commit into from

Conversation

CragW
Copy link
Collaborator

@CragW CragW commented Jun 17, 2024

Type of pull request:

@CragW
Copy link
Collaborator Author

CragW commented Jun 17, 2024

I'm seeing an error with WD19 that the child device is somewhat early finalized than the parent, I have no idea how to make the order. This issue isn't reproducible with origin/main, @superm1 any suggestion?

15:42:40.544 Fwupd                FuDevice child 0x5711be414510 was finalized while still having parent WD19TBS [570867f4ddda9915445da59bd85cd0e0e507270e]!
15:42:40.544 GLib-GObject         invalid unclassed pointer in cast to 'GObject'
15:42:40.545 GLib-GObject         g_object_weak_unref: assertion 'G_IS_OBJECT (object)' failed
15:42:40.545 GLib-GObject         g_object_unref: assertion 'G_IS_OBJECT (object)' failed

wd19.log

Copy link
Member

@superm1 superm1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general comment; it would be a lot easier to review if you can split this into individual commits.

It will also be a lot easier to bisect when/how problems are introduced if you have individual commits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth a commit before you add this to sort the list and put them in the right place alphabetically

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #7369 to rebuild the base.

@@ -0,0 +1,24 @@
/*
* Copyright 2018 Dell Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely 2024 for a new file?

@@ -0,0 +1,24 @@
/*
* Copyright 2018 Dell Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely 2024 for a new file?

@@ -0,0 +1,34 @@
/*
* Copyright 2018 Realtek Semiconductor Corporation
* Copyright 2018 Dell Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024 right?

Comment on lines 30 to 64
g_autoptr(FuDeviceLocker) locker = NULL;

locker = fu_device_locker_new(device, error);
if (locker == NULL)
if (!fu_device_open(device, error))
return FALSE;

fu_plugin_device_add(plugin, device);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a device lifecycle problem? You'll leave it open after it's created

Comment on lines +452 to +459
name = g_string_new(self->dock_data->marketing_name);
if (name->len > 0)
fu_device_set_name(device, name->str);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has this happened in practice? I would think you should just be able to do fu_device_set_name(device, self->dock_data->marketing_name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the enums in this file should be rustgen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, -- and also structs like FuDellDockVer2DockFWVersion

/* header */
fu_byte_array_append_uint8(fwbuf, HID_v2_CMD_WRITE_DATA);
fu_byte_array_append_uint8(fwbuf, HID_v2_EXT_WRITE_DATA);
fu_byte_array_append_uint32(fwbuf, 7 + fw_size, G_BIG_ENDIAN); // 7 = sizeof(command)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 7 = sizeof(command), how about just use that instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the command here means total bytes from below section, i.e.: 1 + 1 + 1 + 4. I haven't found a way to streamline hardcoded 7 into the sum of bytes.

@superm1
Copy link
Member

superm1 commented Jun 18, 2024

As a general comment; it would be a lot easier to review if you can split this into individual commits.

And you can do your generic "get ready" changes that move lines around and rename stuff and definitely don't break things immediately in another PR too to make this one a lot smaller.

if (!fu_device_open(FU_DEVICE(hub_device), error))
return FALSE;
} else {
hub_device = FU_DELL_DOCK_HUB(device);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just realized that this assignment (or even with g_steal_pointer) will fall into a situation that a ghost device in the plugin. I don't have better way to do this but currently it is https://github.com/fwupd/fwupd/pull/7369/files#diff-cf3e2d3d7e960a425b0276b4438c42ef41d1d841fddafa0d256331654f303844R202.

Comment on lines 104 to 114
} else {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"no valid proxy for package update.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should return FALSE in this branch

Comment on lines 159 to 184
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD);
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really right? The package is being signed now? It's different from WD19/WD22 then. There should be special casing between docks for this flag it means.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just reconfirmed the status package itself is unsigned, will fix it.

Comment on lines +20 to +28
#define FU_TYPE_DELL_DOCK_PD_FIRMWARE (fu_dell_dock_pd_firmware_get_type())
G_DECLARE_FINAL_TYPE(FuDellDockPdFirmware,
fu_dell_dock_pd_firmware,
FU,
DELL_DOCK_PD_FIRMWARE,
FuFirmware)

FuFirmware *
fu_dell_dock_pd_firmware_new(void);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing a call to fu_plugin_add_firmware_gtype to register this. Look at when/how other plugins do it.

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

Successfully merging this pull request may close these issues.

None yet

3 participants