]> git.proxmox.com Git - fwupd.git/commitdiff
add FPC lenfy device support
authorjim.zhang <jim.zhang@fingerprints.com>
Tue, 18 Oct 2022 07:31:12 +0000 (15:31 +0800)
committerRichard Hughes <richard@hughsie.com>
Tue, 18 Oct 2022 11:23:27 +0000 (12:23 +0100)
plugins/fpc/fpc.quirk
plugins/fpc/fu-fpc-device.c

index d24e2ad5264ba6af885b7f4927e1697197160b0a..2e3d16a637f6873383b46e5fe32cd77603fba8b7 100644 (file)
@@ -6,4 +6,4 @@ Plugin = fpc
 Flags = moh-device,rts
 [USB\VID_10A5&PID_9800]
 Plugin = fpc
-Flags = moh-device,rts
+Flags = moh-device,rts,lenfy
index 132ca365b3c6dd9b0b48e2753bf484c06d445956..ff630b109f0e125b2c9676544933b81861741b8c 100644 (file)
@@ -21,8 +21,9 @@
 #define FPC_CMD_DFU_CLRSTATUS    0x04
 #define FPC_CMD_DFU_GET_FW_STATUS 0x09
 
-#define FPC_CMD_BOOT0    0x04
-#define FPC_CMD_GET_STATE 0x0B
+#define FPC_CMD_BOOT0          0x04
+#define FPC_CMD_GET_STATE      0x0B
+#define FPC_CMD_GET_STATE_LENFY 0x50
 
 #define FPC_DEVICE_MOC_STATE_LEN     68
 #define FPC_DEVICE_MOH_STATE_LEN     72
 
 #define FU_FPC_DEVICE_FLAG_RTS_DEVICE (1 << 2)
 
+/**
+ * FU_FPC_DEVICE_FLAG_LENFY_DEVICE:
+ *
+ * Device is a LENFY MOH device
+ */
+
+#define FU_FPC_DEVICE_FLAG_LENFY_DEVICE (1 << 3)
+
 struct _FuFpcDevice {
        FuUsbDevice parent_instance;
        guint32 max_block_size;
@@ -210,6 +219,7 @@ fu_fpc_device_setup_version(FuFpcDevice *self, GError **error)
        FuEndianType endian_type = G_LITTLE_ENDIAN;
        g_autofree guint8 *data = NULL;
        g_autofree gchar *str_version = NULL;
+       guint32 cmd_id = FPC_CMD_GET_STATE;
 
        if (fu_device_has_private_flag(FU_DEVICE(self), FU_FPC_DEVICE_FLAG_RTS_DEVICE))
                endian_type = G_BIG_ENDIAN;
@@ -222,7 +232,9 @@ fu_fpc_device_setup_version(FuFpcDevice *self, GError **error)
                }
 
                data = g_malloc0(data_len);
-               if (!fu_fpc_device_fw_cmd(self, FPC_CMD_GET_STATE, data, data_len, TRUE, error))
+               if (fu_device_has_private_flag(FU_DEVICE(self), FU_FPC_DEVICE_FLAG_LENFY_DEVICE))
+                       cmd_id = FPC_CMD_GET_STATE_LENFY;
+               if (!fu_fpc_device_fw_cmd(self, cmd_id, data, data_len, TRUE, error))
                        return FALSE;
 
                if (!fu_memread_uint32_safe(data, data_len, 0, &version, endian_type, error))
@@ -562,6 +574,7 @@ fu_fpc_device_init(FuFpcDevice *self)
        fu_device_register_private_flag(FU_DEVICE(self),
                                        FU_FPC_DEVICE_FLAG_LEGACY_DFU,
                                        "legacy-dfu");
+       fu_device_register_private_flag(FU_DEVICE(self), FU_FPC_DEVICE_FLAG_LENFY_DEVICE, "lenfy");
 }
 
 static void