goodixmoc: Fix handling of CRC32 in big endian archs

This commit is contained in:
Marco Trevisan (Treviño)
2026-07-01 17:49:34 +02:00
parent 2dec3f57ea
commit 2ff99be5db
3 changed files with 6 additions and 9 deletions
+4 -3
View File
@@ -177,7 +177,7 @@ fp_cmd_receive_cb (FpiUsbTransfer *transfer,
gx_proto_crc32_calc (transfer->buffer, PACKAGE_HEADER_SIZE + header.len, (uint8_t *) &crc32_calc);
if (!fpi_byte_reader_get_uint32_le (&reader, &crc32) ||
crc32_calc != crc32)
GUINT32_FROM_LE (crc32_calc) != crc32)
{
fpi_ssm_mark_failed (transfer->ssm,
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
@@ -1618,7 +1618,7 @@ gx_fp_template_delete (FpDevice *device)
gsize user_id_len = 0;
const guint8 *tid;
gsize tid_len = 0;
gsize payload_len = 0;
guint16 payload_len = 0;
g_autofree guint8 *payload = NULL;
fpi_device_get_delete_data (device, &print);
@@ -1631,7 +1631,8 @@ gx_fp_template_delete (FpDevice *device)
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
return;
}
if (!encode_finger_id (tid, tid_len, user_id, user_id_len, &payload, (guint16 *) &payload_len))
if (!encode_finger_id (tid, tid_len, user_id, user_id_len, &payload, &payload_len))
{
fpi_device_delete_complete (device,
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
+1 -5
View File
@@ -493,8 +493,6 @@ static uint8_t sensor_config[26] = {
int
gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
{
uint32_t crc32_calc = 0;
if (!pconfig)
return -1;
memset (pconfig, 0, sizeof (*pconfig));
@@ -503,9 +501,7 @@ gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
memcpy (&pconfig->config, sensor_config, G_N_ELEMENTS (sensor_config));
pconfig->reserved[0] = 1;
gx_proto_crc32_calc ((uint8_t *) pconfig, sizeof (*pconfig) - PACKAGE_CRC_SIZE, (uint8_t *) &crc32_calc);
memcpy (pconfig->crc_value, &crc32_calc, PACKAGE_CRC_SIZE);
gx_proto_crc32_calc ((uint8_t *) pconfig, sizeof (*pconfig) - PACKAGE_CRC_SIZE, pconfig->crc_value);
return 0;
}
+1 -1
View File
@@ -136,7 +136,7 @@ drivers_info = {
'upektc': {},
'upeksonly': {},
'upekts': {},
'goodixmoc': { 'endian_dependent': true },
'goodixmoc': {},
'nb1010': {},
'fpcmoc': {},
'realtek': {},