uncrustify

This commit is contained in:
Abhinav Baid 2024-06-10 00:26:08 +01:00 committed by Xelef2000
parent 84fc9129ba
commit d5fe769a8b
2 changed files with 54 additions and 80 deletions

View file

@ -28,10 +28,10 @@
struct _FpiDeviceCrfpMoc
{
FpDevice parent;
FpiSsm *task_ssm;
FpDevice parent;
FpiSsm *task_ssm;
GCancellable *interrupt_cancellable;
int fd;
int fd;
};
G_DEFINE_TYPE (FpiDeviceCrfpMoc, fpi_device_crfpmoc, FP_TYPE_DEVICE)
@ -39,7 +39,7 @@ G_DEFINE_TYPE (FpiDeviceCrfpMoc, fpi_device_crfpmoc, FP_TYPE_DEVICE)
typedef struct crfpmoc_enroll_print
{
FpPrint *print;
int stage;
int stage;
} EnrollPrint;
static const FpIdEntry crfpmoc_id_table[] = {
@ -75,6 +75,7 @@ static const gchar *
crfpmoc_strresult (int i)
{
int crfpmoc_meanings_len = sizeof (crfpmoc_meanings) / sizeof (crfpmoc_meanings[0]);
if (i < 0 || i >= crfpmoc_meanings_len)
return "<unknown>";
return crfpmoc_meanings[i];
@ -121,9 +122,7 @@ crfpmoc_ec_command (FpiDeviceCrfpMoc *self, int command, int version, const void
if (s_cmd == NULL)
{
if (error_msg != NULL)
{
*error_msg = crfpmoc_strresult (EC_RES_ERROR);
}
*error_msg = crfpmoc_strresult (EC_RES_ERROR);
return -EC_RES_ERROR;
}
@ -142,9 +141,7 @@ crfpmoc_ec_command (FpiDeviceCrfpMoc *self, int command, int version, const void
s_cmd->command = CRFPMOC_EC_CMD_RESEND_RESPONSE;
r = ioctl (self->fd, CRFPMOC_CROS_EC_DEV_IOCXCMD_V2, s_cmd);
if (r < 0)
{
fp_warn ("ioctl %d, errno %d (%s), EC result %d (%s)", r, errno, strerror (errno), s_cmd->result, crfpmoc_strresult (s_cmd->result));
}
fp_warn ("ioctl %d, errno %d (%s), EC result %d (%s)", r, errno, strerror (errno), s_cmd->result, crfpmoc_strresult (s_cmd->result));
}
else
{
@ -163,9 +160,7 @@ crfpmoc_ec_command (FpiDeviceCrfpMoc *self, int command, int version, const void
g_free (s_cmd);
if (error_msg != NULL)
{
*error_msg = crfpmoc_strresult (s_cmd->result);
}
*error_msg = crfpmoc_strresult (s_cmd->result);
return r;
}
@ -177,20 +172,14 @@ crfpmoc_ec_pollevent (FpiDeviceCrfpMoc *self, unsigned long mask, void *buffer,
rv = ioctl (self->fd, CRFPMOC_CROS_EC_DEV_IOCEVENTMASK_V2, mask);
if (rv < 0)
{
return -rv;
}
return -rv;
rv = poll (&pf, 1, timeout);
if (rv != 1)
{
return rv;
}
return rv;
if (pf.revents != POLLIN)
{
return -pf.revents;
}
return -pf.revents;
return read (self->fd, buffer, buf_size);
}
@ -209,9 +198,7 @@ crfpmoc_cmd_fp_mode (FpiDeviceCrfpMoc *self, guint32 inmode, guint32 *outmode, c
fp_dbg ("FP mode: (0x%x)", r.mode);
if (outmode != NULL)
{
*outmode = r.mode;
}
*outmode = r.mode;
return 0;
}
@ -376,13 +363,9 @@ crfpmoc_enroll_run_state (FpiSsm *ssm, FpDevice *device)
case ENROLL_SENSOR_ENROLL:
r = crfpmoc_cmd_fp_mode (self, CRFPMOC_FP_MODE_ENROLL_IMAGE | CRFPMOC_FP_MODE_ENROLL_SESSION, &mode, &error_msg);
if (r < 0)
{
fpi_ssm_mark_failed (ssm, fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL, "%s", error_msg));
}
fpi_ssm_mark_failed (ssm, fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL, "%s", error_msg));
else
{
fpi_ssm_next_state (ssm);
}
fpi_ssm_next_state (ssm);
break;
case ENROLL_WAIT_FINGER:
@ -391,13 +374,9 @@ crfpmoc_enroll_run_state (FpiSsm *ssm, FpDevice *device)
if (r < 0)
{
if (r == -ETIMEDOUT)
{
fpi_ssm_jump_to_state (ssm, ENROLL_WAIT_FINGER);
}
fpi_ssm_jump_to_state (ssm, ENROLL_WAIT_FINGER);
else
{
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
}
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
}
else
{
@ -446,6 +425,7 @@ crfpmoc_enroll_run_state (FpiSsm *ssm, FpDevice *device)
}
}
break;
case ENROLL_COMMIT:
crfpmoc_cmd_fp_info (self, &enrolled_templates, &error_msg);
fp_dbg ("Number of enrolled templates is: %d", enrolled_templates);
@ -500,35 +480,27 @@ crfpmoc_verify_run_state (FpiSsm *ssm, FpDevice *device)
case VERIFY_SENSOR_MATCH:
r = crfpmoc_cmd_fp_mode (self, CRFPMOC_FP_MODE_MATCH, &mode, &error_msg);
if (r < 0)
{
fpi_ssm_mark_failed (ssm, fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL, "%s", error_msg));
}
fpi_ssm_mark_failed (ssm, fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL, "%s", error_msg));
else
{
fpi_ssm_next_state (ssm);
}
fpi_ssm_next_state (ssm);
break;
case VERIFY_WAIT_FINGER:
fpi_device_report_finger_status (device, FP_FINGER_STATUS_NEEDED);
r = crfpmoc_cmd_wait_event_fingerprint (self);
if (r < 0)
{
if (r == -ETIMEDOUT)
{
fpi_ssm_jump_to_state (ssm, VERIFY_WAIT_FINGER);
}
fpi_ssm_jump_to_state (ssm, VERIFY_WAIT_FINGER);
else
{
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
}
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
}
else
{
fpi_ssm_next_state (ssm);
}
break;
case VERIFY_SENSOR_CHECK:
r = crfpmoc_cmd_fp_mode (self, CRFPMOC_FP_MODE_DONT_CHANGE, &mode, &error_msg);
if (r < 0)
@ -558,13 +530,9 @@ crfpmoc_verify_run_state (FpiSsm *ssm, FpDevice *device)
fp_info ("Print was not identified by the device");
if (is_identify)
{
fpi_device_identify_report (device, NULL, NULL, NULL);
}
fpi_device_identify_report (device, NULL, NULL, NULL);
else
{
fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, NULL);
}
fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, NULL);
}
else
{
@ -598,13 +566,9 @@ crfpmoc_verify_run_state (FpiSsm *ssm, FpDevice *device)
}
}
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
{
fpi_device_verify_complete (device, NULL);
}
fpi_device_verify_complete (device, NULL);
else
{
fpi_device_identify_complete (device, NULL);
}
fpi_device_identify_complete (device, NULL);
fpi_ssm_mark_completed (ssm);
}
}

View file

@ -63,27 +63,32 @@ G_DECLARE_FINAL_TYPE (FpiDeviceCrfpMoc, fpi_device_crfpmoc, FPI, DEVICE_CRFPMOC,
/* New Fingerprint sensor event, the event data is fp_events bitmap. */
#define CRFPMOC_EC_MKBP_EVENT_FINGERPRINT 5
struct crfpmoc_ec_params_fp_mode {
struct crfpmoc_ec_params_fp_mode
{
guint32 mode; /* as defined by CRFPMOC_FP_MODE_ constants */
} __attribute__((packed));
struct crfpmoc_ec_response_fp_mode {
struct crfpmoc_ec_response_fp_mode
{
guint32 mode; /* as defined by CRFPMOC_FP_MODE_ constants */
} __attribute__((packed));
struct crfpmoc_ec_response_fp_stats {
struct crfpmoc_ec_response_fp_stats
{
guint32 capture_time_us;
guint32 matching_time_us;
guint32 overall_time_us;
struct {
struct
{
guint32 lo;
guint32 hi;
} overall_t0;
guint8 timestamps_invalid;
gint8 template_matched;
gint8 template_matched;
} __attribute__((packed));
struct crfpmoc_ec_response_fp_info {
struct crfpmoc_ec_response_fp_info
{
/* Sensor identification */
guint32 vendor_id;
guint32 product_id;
@ -105,7 +110,8 @@ struct crfpmoc_ec_response_fp_info {
} __attribute__((packed));
/* Note: used in crfpmoc_ec_response_get_next_data_v1 */
struct crfpmoc_ec_response_motion_sense_fifo_info {
struct crfpmoc_ec_response_motion_sense_fifo_info
{
/* Size of the fifo */
guint16 size;
/* Amount of space used in the fifo */
@ -120,16 +126,18 @@ struct crfpmoc_ec_response_motion_sense_fifo_info {
guint16 lost[0];
};
union __attribute__((packed)) crfpmoc_ec_response_get_next_data_v1 {
union __attribute__((packed)) crfpmoc_ec_response_get_next_data_v1
{
guint8 key_matrix[16];
/* Unaligned */
guint32 host_event;
guint64 host_event64;
struct {
struct
{
/* For aligning the fifo_info */
guint8 reserved[3];
guint8 reserved[3];
struct crfpmoc_ec_response_motion_sense_fifo_info info;
} sensor_fifo;
@ -143,11 +151,12 @@ union __attribute__((packed)) crfpmoc_ec_response_get_next_data_v1 {
guint32 cec_events;
guint8 cec_message[16];
guint8 cec_message[16];
};
struct crfpmoc_ec_response_get_next_event_v1 {
guint8 event_type;
struct crfpmoc_ec_response_get_next_event_v1
{
guint8 event_type;
/* Followed by event data if any */
union crfpmoc_ec_response_get_next_data_v1 data;
} __attribute__((packed));
@ -160,19 +169,20 @@ struct crfpmoc_ec_response_get_next_event_v1 {
* @result: EC's response to the command (separate from communication failure)
* @data: Where to put the incoming data from EC and outgoing data to EC
*/
struct crfpmoc_cros_ec_command_v2 {
struct crfpmoc_cros_ec_command_v2
{
guint32 version;
guint32 command;
guint32 outsize;
guint32 insize;
guint32 result;
guint8 data[0];
guint8 data[0];
};
#define CRFPMOC_CROS_EC_DEV_IOC_V2 0xEC
#define CRFPMOC_CROS_EC_DEV_IOCXCMD_V2 \
_IOWR(CRFPMOC_CROS_EC_DEV_IOC_V2, 0, struct crfpmoc_cros_ec_command_v2)
#define CRFPMOC_CROS_EC_DEV_IOCEVENTMASK_V2 _IO(CRFPMOC_CROS_EC_DEV_IOC_V2, 2)
_IOWR (CRFPMOC_CROS_EC_DEV_IOC_V2, 0, struct crfpmoc_cros_ec_command_v2)
#define CRFPMOC_CROS_EC_DEV_IOCEVENTMASK_V2 _IO (CRFPMOC_CROS_EC_DEV_IOC_V2, 2)
/*
* Host command response codes (16-bit).