]> git.proxmox.com Git - fwupd.git/commitdiff
trivial: logitech-hidpp: move the check for CONFIG_HIDRAW into probe
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 13 Feb 2023 16:34:40 +0000 (10:34 -0600)
committerMario Limonciello <mario.limonciello@amd.com>
Thu, 23 Feb 2023 19:04:12 +0000 (13:04 -0600)
The kernel should have loaded hidraw support by the time that we probe
a device.  This fixes logitech devices not showing up after startup
if they weren't plugged in initially.

Fixes: #5525
plugins/logitech-hidpp/fu-logitech-hidpp-device.c
plugins/logitech-hidpp/fu-logitech-hidpp-plugin.c

index 63344f06b4517656cd24949261889a5077cfbe06..c0518292c02422121e9e15813fe5b173bd6dfc90 100644 (file)
@@ -683,6 +683,15 @@ fu_logitech_hidpp_device_probe(FuDevice *device, GError **error)
        FuLogitechHidPpDevice *self = FU_HIDPP_DEVICE(device);
        FuLogitechHidPpDevicePrivate *priv = GET_PRIVATE(self);
 
+       /* check the kernel has CONFIG_HIDRAW */
+       if (!g_file_test("/sys/class/hidraw", G_FILE_TEST_IS_DIR)) {
+               g_set_error_literal(error,
+                                   FWUPD_ERROR,
+                                   FWUPD_ERROR_NOT_SUPPORTED,
+                                   "no kernel support for CONFIG_HIDRAW");
+               return FALSE;
+       }
+
        /* set the physical ID */
        if (!fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "hid", error))
                return FALSE;
index 613f7c266373294b221d5dbdcc3ded5e19d1c4e4..2513e64b94ab40282443d75f934df1eedfedb6aa 100644 (file)
@@ -20,20 +20,6 @@ struct _FuLogitechHidppPlugin {
 
 G_DEFINE_TYPE(FuLogitechHidppPlugin, fu_logitech_hidpp_plugin, FU_TYPE_PLUGIN)
 
-static gboolean
-fu_logitech_hidpp_plugin_startup(FuPlugin *plugin, FuProgress *progress, GError **error)
-{
-       /* check the kernel has CONFIG_HIDRAW */
-       if (!g_file_test("/sys/class/hidraw", G_FILE_TEST_IS_DIR)) {
-               g_set_error_literal(error,
-                                   FWUPD_ERROR,
-                                   FWUPD_ERROR_NOT_SUPPORTED,
-                                   "no kernel support for CONFIG_HIDRAW");
-               return FALSE;
-       }
-       return TRUE;
-}
-
 static void
 fu_logitech_hidpp_plugin_init(FuLogitechHidppPlugin *self)
 {
@@ -57,8 +43,6 @@ fu_logitech_hidpp_plugin_constructed(GObject *obj)
 static void
 fu_logitech_hidpp_plugin_class_init(FuLogitechHidppPluginClass *klass)
 {
-       FuPluginClass *plugin_class = FU_PLUGIN_CLASS(klass);
        GObjectClass *object_class = G_OBJECT_CLASS(klass);
        object_class->constructed = fu_logitech_hidpp_plugin_constructed;
-       plugin_class->startup = fu_logitech_hidpp_plugin_startup;
 }