mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 10:34:18 +00:00
Merge remote-tracking branch 'origin/master' into tod
This commit is contained in:
+10
-5
@@ -57,7 +57,7 @@ load_data (void)
|
|||||||
{
|
{
|
||||||
GVariantDict *res;
|
GVariantDict *res;
|
||||||
GVariant *var;
|
GVariant *var;
|
||||||
g_autofree gchar *contents = NULL;
|
gchar *contents = NULL;
|
||||||
gsize length = 0;
|
gsize length = 0;
|
||||||
|
|
||||||
if (!g_file_get_contents (STORAGE_FILE, &contents, &length, NULL))
|
if (!g_file_get_contents (STORAGE_FILE, &contents, &length, NULL))
|
||||||
@@ -66,7 +66,12 @@ load_data (void)
|
|||||||
return g_variant_dict_new (NULL);
|
return g_variant_dict_new (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
var = g_variant_new_from_data (G_VARIANT_TYPE_VARDICT, contents, length, FALSE, NULL, NULL);
|
var = g_variant_new_from_data (G_VARIANT_TYPE_VARDICT,
|
||||||
|
contents,
|
||||||
|
length,
|
||||||
|
FALSE,
|
||||||
|
g_free,
|
||||||
|
contents);
|
||||||
|
|
||||||
res = g_variant_dict_new (var);
|
res = g_variant_dict_new (var);
|
||||||
g_variant_unref (var);
|
g_variant_unref (var);
|
||||||
@@ -129,7 +134,7 @@ print_data_load (FpDevice *dev, FpFinger finger)
|
|||||||
|
|
||||||
g_autoptr(GVariant) val = NULL;
|
g_autoptr(GVariant) val = NULL;
|
||||||
g_autoptr(GVariantDict) dict = NULL;
|
g_autoptr(GVariantDict) dict = NULL;
|
||||||
g_autofree guchar *stored_data = NULL;
|
const guchar *stored_data = NULL;
|
||||||
gsize stored_len;
|
gsize stored_len;
|
||||||
|
|
||||||
dict = load_data ();
|
dict = load_data ();
|
||||||
@@ -140,7 +145,7 @@ print_data_load (FpDevice *dev, FpFinger finger)
|
|||||||
FpPrint *print;
|
FpPrint *print;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
stored_data = (guchar *) g_variant_get_fixed_array (val, &stored_len, 1);
|
stored_data = (const guchar *) g_variant_get_fixed_array (val, &stored_len, 1);
|
||||||
print = fp_print_deserialize (stored_data, stored_len, &error);
|
print = fp_print_deserialize (stored_data, stored_len, &error);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
@@ -213,7 +218,7 @@ save_image_to_pgm (FpImage *img, const char *path)
|
|||||||
gboolean
|
gboolean
|
||||||
print_image_save (FpPrint *print, const char *path)
|
print_image_save (FpPrint *print, const char *path)
|
||||||
{
|
{
|
||||||
g_autoptr(FpImage) img = NULL;
|
FpImage *img = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (FP_IS_PRINT (print), FALSE);
|
g_return_val_if_fail (FP_IS_PRINT (print), FALSE);
|
||||||
g_return_val_if_fail (path != NULL, FALSE);
|
g_return_val_if_fail (path != NULL, FALSE);
|
||||||
|
|||||||
+10
-7
@@ -75,13 +75,13 @@ on_verify_completed (FpDevice *dev, GAsyncResult *res, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (print && fp_device_supports_capture (dev) &&
|
||||||
|
print_image_save (print, "verify.pgm"))
|
||||||
|
g_print ("Print image saved as verify.pgm\n");
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
{
|
{
|
||||||
g_print ("MATCH!\n");
|
g_print ("MATCH!\n");
|
||||||
if (fp_device_supports_capture (dev) &&
|
|
||||||
print_image_save (print, "verify.pgm"))
|
|
||||||
g_print ("Print image saved as verify.pgm");
|
|
||||||
|
|
||||||
verify_data->ret_value = EXIT_SUCCESS;
|
verify_data->ret_value = EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -92,7 +92,7 @@ on_verify_completed (FpDevice *dev, GAsyncResult *res, void *user_data)
|
|||||||
|
|
||||||
g_print ("Verify again? [Y/n]? ");
|
g_print ("Verify again? [Y/n]? ");
|
||||||
if (fgets (buffer, sizeof (buffer), stdin) &&
|
if (fgets (buffer, sizeof (buffer), stdin) &&
|
||||||
(buffer[0] == 'Y' || buffer[0] == 'y'))
|
(buffer[0] == 'Y' || buffer[0] == 'y' || buffer[0] == '\n'))
|
||||||
{
|
{
|
||||||
start_verification (dev, verify_data);
|
start_verification (dev, verify_data);
|
||||||
return;
|
return;
|
||||||
@@ -165,8 +165,11 @@ on_list_completed (FpDevice *dev, GAsyncResult *res, gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
start_verification (FpDevice *dev, VerifyData *verify_data)
|
start_verification (FpDevice *dev, VerifyData *verify_data)
|
||||||
{
|
{
|
||||||
g_print ("Choose the finger to verify:\n");
|
if (verify_data->finger == FP_FINGER_UNKNOWN)
|
||||||
verify_data->finger = finger_chooser ();
|
{
|
||||||
|
g_print ("Choose the finger to verify:\n");
|
||||||
|
verify_data->finger = finger_chooser ();
|
||||||
|
}
|
||||||
|
|
||||||
if (verify_data->finger == FP_FINGER_UNKNOWN)
|
if (verify_data->finger == FP_FINGER_UNKNOWN)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -549,7 +549,11 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_PROTO));
|
/* XXX: The timeout is emulated incorrectly, resulting in a zero byte read. */
|
||||||
|
if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0)
|
||||||
|
fpi_ssm_mark_completed (ssm);
|
||||||
|
else
|
||||||
|
fpi_ssm_mark_failed (ssm, fpi_device_error_new (FP_DEVICE_ERROR_PROTO));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -245,6 +245,23 @@ fp_image_device_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fp_image_device_constructed (GObject *obj)
|
||||||
|
{
|
||||||
|
FpImageDevice *self = FP_IMAGE_DEVICE (obj);
|
||||||
|
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||||
|
FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
|
||||||
|
|
||||||
|
/* Set default values. */
|
||||||
|
fpi_device_set_nr_enroll_stages (FP_DEVICE (self), IMG_ENROLL_STAGES);
|
||||||
|
|
||||||
|
priv->bz3_threshold = BOZORTH3_DEFAULT_THRESHOLD;
|
||||||
|
if (cls->bz3_threshold > 0)
|
||||||
|
priv->bz3_threshold = cls->bz3_threshold;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (fp_image_device_parent_class)->constructed (obj);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fp_image_device_class_init (FpImageDeviceClass *klass)
|
fp_image_device_class_init (FpImageDeviceClass *klass)
|
||||||
{
|
{
|
||||||
@@ -253,6 +270,7 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
|
|||||||
|
|
||||||
object_class->finalize = fp_image_device_finalize;
|
object_class->finalize = fp_image_device_finalize;
|
||||||
object_class->get_property = fp_image_device_get_property;
|
object_class->get_property = fp_image_device_get_property;
|
||||||
|
object_class->constructed = fp_image_device_constructed;
|
||||||
|
|
||||||
fp_device_class->open = fp_image_device_open;
|
fp_device_class->open = fp_image_device_open;
|
||||||
fp_device_class->close = fp_image_device_close;
|
fp_device_class->close = fp_image_device_close;
|
||||||
@@ -305,13 +323,4 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
|
|||||||
static void
|
static void
|
||||||
fp_image_device_init (FpImageDevice *self)
|
fp_image_device_init (FpImageDevice *self)
|
||||||
{
|
{
|
||||||
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
|
||||||
FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
|
|
||||||
|
|
||||||
/* Set default values. */
|
|
||||||
fpi_device_set_nr_enroll_stages (FP_DEVICE (self), IMG_ENROLL_STAGES);
|
|
||||||
|
|
||||||
priv->bz3_threshold = BOZORTH3_DEFAULT_THRESHOLD;
|
|
||||||
if (cls->bz3_threshold > 0)
|
|
||||||
priv->bz3_threshold = cls->bz3_threshold;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-20
@@ -52,6 +52,9 @@ calc_error (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
width = ctx->frame_width - (dx > 0 ? dx : -dx);
|
width = ctx->frame_width - (dx > 0 ? dx : -dx);
|
||||||
height = ctx->frame_height - dy;
|
height = ctx->frame_height - dy;
|
||||||
|
|
||||||
|
if (height == 0 || width == 0)
|
||||||
|
return INT_MAX;
|
||||||
|
|
||||||
y1 = 0;
|
y1 = 0;
|
||||||
y2 = dy;
|
y2 = dy;
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -86,9 +89,6 @@ calc_error (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
err *= (ctx->frame_height * ctx->frame_width);
|
err *= (ctx->frame_height * ctx->frame_width);
|
||||||
err /= (height * width);
|
err /= (height * width);
|
||||||
|
|
||||||
if (err == 0)
|
|
||||||
return INT_MAX;
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +99,8 @@ static void
|
|||||||
find_overlap (struct fpi_frame_asmbl_ctx *ctx,
|
find_overlap (struct fpi_frame_asmbl_ctx *ctx,
|
||||||
struct fpi_frame *first_frame,
|
struct fpi_frame *first_frame,
|
||||||
struct fpi_frame *second_frame,
|
struct fpi_frame *second_frame,
|
||||||
|
int *dx_out,
|
||||||
|
int *dy_out,
|
||||||
unsigned int *min_error)
|
unsigned int *min_error)
|
||||||
{
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
@@ -120,8 +122,8 @@ find_overlap (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
if (err < *min_error)
|
if (err < *min_error)
|
||||||
{
|
{
|
||||||
*min_error = err;
|
*min_error = err;
|
||||||
second_frame->delta_x = -dx;
|
*dx_out = -dx;
|
||||||
second_frame->delta_y = dy;
|
*dy_out = dy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +135,7 @@ do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
GTimer *timer;
|
GTimer *timer;
|
||||||
guint num_frames = 0;
|
guint num_frames = 1;
|
||||||
struct fpi_frame *prev_stripe;
|
struct fpi_frame *prev_stripe;
|
||||||
unsigned int min_error;
|
unsigned int min_error;
|
||||||
/* Max error is width * height * 255, for AES2501 which has the largest
|
/* Max error is width * height * 255, for AES2501 which has the largest
|
||||||
@@ -143,20 +145,27 @@ do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
unsigned long long total_error = 0;
|
unsigned long long total_error = 0;
|
||||||
|
|
||||||
timer = g_timer_new ();
|
timer = g_timer_new ();
|
||||||
|
|
||||||
|
/* Skip the first frame */
|
||||||
prev_stripe = stripes->data;
|
prev_stripe = stripes->data;
|
||||||
for (l = stripes; l != NULL; l = l->next, num_frames++)
|
|
||||||
|
for (l = stripes->next; l != NULL; l = l->next, num_frames++)
|
||||||
{
|
{
|
||||||
struct fpi_frame *cur_stripe = l->data;
|
struct fpi_frame *cur_stripe = l->data;
|
||||||
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
find_overlap (ctx, prev_stripe, cur_stripe, &min_error);
|
find_overlap (ctx, prev_stripe, cur_stripe,
|
||||||
|
&cur_stripe->delta_x, &cur_stripe->delta_y,
|
||||||
|
&min_error);
|
||||||
cur_stripe->delta_y = -cur_stripe->delta_y;
|
cur_stripe->delta_y = -cur_stripe->delta_y;
|
||||||
cur_stripe->delta_x = -cur_stripe->delta_x;
|
cur_stripe->delta_x = -cur_stripe->delta_x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
find_overlap (ctx, cur_stripe, prev_stripe, &min_error);
|
find_overlap (ctx, cur_stripe, prev_stripe,
|
||||||
|
&cur_stripe->delta_x, &cur_stripe->delta_y,
|
||||||
|
&min_error);
|
||||||
}
|
}
|
||||||
total_error += min_error;
|
total_error += min_error;
|
||||||
|
|
||||||
@@ -328,19 +337,10 @@ fpi_assemble_frames (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
{
|
{
|
||||||
fpi_frame = l->data;
|
fpi_frame = l->data;
|
||||||
|
|
||||||
if(reverse)
|
y += fpi_frame->delta_y;
|
||||||
{
|
x += fpi_frame->delta_x;
|
||||||
y += fpi_frame->delta_y;
|
|
||||||
x += fpi_frame->delta_x;
|
|
||||||
}
|
|
||||||
|
|
||||||
aes_blit_stripe (ctx, img, fpi_frame, x, y);
|
aes_blit_stripe (ctx, img, fpi_frame, x, y);
|
||||||
|
|
||||||
if(!reverse)
|
|
||||||
{
|
|
||||||
y += fpi_frame->delta_y;
|
|
||||||
x += fpi_frame->delta_x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
|
|||||||
@@ -404,6 +404,11 @@ fpi_image_device_retry_scan (FpImageDevice *self, FpDeviceRetry retry)
|
|||||||
{
|
{
|
||||||
g_debug ("Reporting retry during enroll");
|
g_debug ("Reporting retry during enroll");
|
||||||
fpi_device_enroll_progress (FP_DEVICE (self), priv->enroll_stage, NULL, error);
|
fpi_device_enroll_progress (FP_DEVICE (self), priv->enroll_stage, NULL, error);
|
||||||
|
|
||||||
|
/* Wait for finger removal and re-touch.
|
||||||
|
* TODO: Do we need to check that the finger is already off? */
|
||||||
|
priv->enroll_await_on_pending = TRUE;
|
||||||
|
fp_image_device_change_state (self, FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ gio_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
|||||||
gusb_dep = dependency('gusb', version: '>= 0.3.0')
|
gusb_dep = dependency('gusb', version: '>= 0.3.0')
|
||||||
mathlib_dep = cc.find_library('m', required: false)
|
mathlib_dep = cc.find_library('m', required: false)
|
||||||
|
|
||||||
|
# The following dependencies are only used for tests
|
||||||
|
cairo_dep = dependency('cairo', required: false)
|
||||||
|
|
||||||
# Drivers
|
# Drivers
|
||||||
drivers = get_option('drivers').split(',')
|
drivers = get_option('drivers').split(',')
|
||||||
virtual_drivers = [ 'virtual_image' ]
|
virtual_drivers = [ 'virtual_image' ]
|
||||||
|
|||||||
+30
-1
@@ -21,4 +21,33 @@ To create a new umockdev test, you should:
|
|||||||
Please note, there is no need to use a real finger print in this case. If
|
Please note, there is no need to use a real finger print in this case. If
|
||||||
you would like to avoid submitting your own fingerprint then please just
|
you would like to avoid submitting your own fingerprint then please just
|
||||||
use e.g. the side of your finger, arm, or anything else that will produce
|
use e.g. the side of your finger, arm, or anything else that will produce
|
||||||
an image with the device.
|
an image with the device.
|
||||||
|
|
||||||
|
|
||||||
|
Note that umockdev-record groups URBs aggressively. In most cases, manual
|
||||||
|
intervention is unfortunately required. In most cases, drivers do a chain
|
||||||
|
of commands like e.g. A then B each with a different reply. Umockdev will
|
||||||
|
create a file like:
|
||||||
|
|
||||||
|
A
|
||||||
|
reply 1
|
||||||
|
reply 2
|
||||||
|
B
|
||||||
|
reply 1
|
||||||
|
reply 2
|
||||||
|
|
||||||
|
which then needs to be re-ordered to be:
|
||||||
|
|
||||||
|
A
|
||||||
|
reply 1
|
||||||
|
B
|
||||||
|
reply 1
|
||||||
|
A
|
||||||
|
reply 2
|
||||||
|
B
|
||||||
|
reply 2
|
||||||
|
|
||||||
|
Other changes may be needed to get everything working. For example the elan
|
||||||
|
driver relies on a timeout that is not reported correctly. In this case the
|
||||||
|
driver works around it by interpreting the protocol error differently in
|
||||||
|
the virtual environment.
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
@@ -0,0 +1,284 @@
|
|||||||
|
P: /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4
|
||||||
|
N: bus/usb/001/094=1201000200000008F304260C40010102000109023E0001010080320904000005FF0000000921100100012215000705810240000107050102400001070582024000010705830240000107050302400001
|
||||||
|
E: DEVNAME=/dev/bus/usb/001/094
|
||||||
|
E: DEVTYPE=usb_device
|
||||||
|
E: DRIVER=usb
|
||||||
|
E: PRODUCT=4f3/c26/140
|
||||||
|
E: TYPE=0/0/0
|
||||||
|
E: BUSNUM=001
|
||||||
|
E: DEVNUM=094
|
||||||
|
E: MAJOR=189
|
||||||
|
E: MINOR=93
|
||||||
|
E: SUBSYSTEM=usb
|
||||||
|
E: ID_VENDOR=ELAN
|
||||||
|
E: ID_VENDOR_ENC=ELAN
|
||||||
|
E: ID_VENDOR_ID=04f3
|
||||||
|
E: ID_MODEL=ELAN:Fingerprint
|
||||||
|
E: ID_MODEL_ENC=ELAN:Fingerprint
|
||||||
|
E: ID_MODEL_ID=0c26
|
||||||
|
E: ID_REVISION=0140
|
||||||
|
E: ID_SERIAL=ELAN_ELAN:Fingerprint
|
||||||
|
E: ID_BUS=usb
|
||||||
|
E: ID_USB_INTERFACES=:ff0000:
|
||||||
|
E: ID_VENDOR_FROM_DATABASE=Elan Microelectronics Corp.
|
||||||
|
E: ID_PATH=pci-0000:00:14.0-usb-0:4.4
|
||||||
|
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_4_4
|
||||||
|
E: LIBFPRINT_DRIVER=ElanTech Fingerprint Sensor
|
||||||
|
A: authorized=1
|
||||||
|
A: avoid_reset_quirk=0
|
||||||
|
A: bConfigurationValue=1
|
||||||
|
A: bDeviceClass=00
|
||||||
|
A: bDeviceProtocol=00
|
||||||
|
A: bDeviceSubClass=00
|
||||||
|
A: bMaxPacketSize0=8
|
||||||
|
A: bMaxPower=100mA
|
||||||
|
A: bNumConfigurations=1
|
||||||
|
A: bNumInterfaces= 1
|
||||||
|
A: bcdDevice=0140
|
||||||
|
A: bmAttributes=80
|
||||||
|
A: busnum=1
|
||||||
|
A: configuration=
|
||||||
|
H: descriptors=1201000200000008F304260C40010102000109023E0001010080320904000005FF0000000921100100012215000705810240000107050102400001070582024000010705830240000107050302400001
|
||||||
|
A: dev=189:93
|
||||||
|
A: devnum=94
|
||||||
|
A: devpath=4.4
|
||||||
|
L: driver=../../../../../../bus/usb/drivers/usb
|
||||||
|
A: idProduct=0c26
|
||||||
|
A: idVendor=04f3
|
||||||
|
A: ltm_capable=no
|
||||||
|
A: manufacturer=ELAN
|
||||||
|
A: maxchild=0
|
||||||
|
L: port=../1-4:1.0/1-4-port4
|
||||||
|
A: power/active_duration=4747
|
||||||
|
A: power/autosuspend=2
|
||||||
|
A: power/autosuspend_delay_ms=2000
|
||||||
|
A: power/connected_duration=54012
|
||||||
|
A: power/control=auto
|
||||||
|
A: power/level=auto
|
||||||
|
A: power/persist=1
|
||||||
|
A: power/runtime_active_time=4721
|
||||||
|
A: power/runtime_status=active
|
||||||
|
A: power/runtime_suspended_time=49114
|
||||||
|
A: product=ELAN:Fingerprint
|
||||||
|
A: quirks=0x0
|
||||||
|
A: removable=removable
|
||||||
|
A: rx_lanes=1
|
||||||
|
A: speed=12
|
||||||
|
A: tx_lanes=1
|
||||||
|
A: urbnum=13
|
||||||
|
A: version= 2.00
|
||||||
|
|
||||||
|
P: /devices/pci0000:00/0000:00:14.0/usb1/1-4
|
||||||
|
N: bus/usb/001/083=1201100209000140EF17181084520102000109021900010100E0000904000001090000000705810301000C
|
||||||
|
E: DEVNAME=/dev/bus/usb/001/083
|
||||||
|
E: DEVTYPE=usb_device
|
||||||
|
E: DRIVER=usb
|
||||||
|
E: PRODUCT=17ef/1018/5284
|
||||||
|
E: TYPE=9/0/1
|
||||||
|
E: BUSNUM=001
|
||||||
|
E: DEVNUM=083
|
||||||
|
E: MAJOR=189
|
||||||
|
E: MINOR=82
|
||||||
|
E: SUBSYSTEM=usb
|
||||||
|
E: ID_VENDOR=VIA_Labs__Inc.
|
||||||
|
E: ID_VENDOR_ENC=VIA\x20Labs\x2c\x20Inc.\x20\x20\x20\x20\x20\x20\x20\x20\x20
|
||||||
|
E: ID_VENDOR_ID=17ef
|
||||||
|
E: ID_MODEL=USB2.0_Hub
|
||||||
|
E: ID_MODEL_ENC=USB2.0\x20Hub\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
|
||||||
|
E: ID_MODEL_ID=1018
|
||||||
|
E: ID_REVISION=5284
|
||||||
|
E: ID_SERIAL=VIA_Labs__Inc._USB2.0_Hub
|
||||||
|
E: ID_BUS=usb
|
||||||
|
E: ID_USB_INTERFACES=:090000:
|
||||||
|
E: ID_VENDOR_FROM_DATABASE=Lenovo
|
||||||
|
E: ID_PATH=pci-0000:00:14.0-usb-0:4
|
||||||
|
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_4
|
||||||
|
E: ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_4
|
||||||
|
E: TAGS=:seat:
|
||||||
|
A: authorized=1
|
||||||
|
A: avoid_reset_quirk=0
|
||||||
|
A: bConfigurationValue=1
|
||||||
|
A: bDeviceClass=09
|
||||||
|
A: bDeviceProtocol=01
|
||||||
|
A: bDeviceSubClass=00
|
||||||
|
A: bMaxPacketSize0=64
|
||||||
|
A: bMaxPower=0mA
|
||||||
|
A: bNumConfigurations=1
|
||||||
|
A: bNumInterfaces= 1
|
||||||
|
A: bcdDevice=5284
|
||||||
|
A: bmAttributes=e0
|
||||||
|
A: busnum=1
|
||||||
|
A: configuration=
|
||||||
|
H: descriptors=1201100209000140EF17181084520102000109021900010100E0000904000001090000000705810301000C
|
||||||
|
A: dev=189:82
|
||||||
|
A: devnum=83
|
||||||
|
A: devpath=4
|
||||||
|
L: driver=../../../../../bus/usb/drivers/usb
|
||||||
|
A: idProduct=1018
|
||||||
|
A: idVendor=17ef
|
||||||
|
A: ltm_capable=no
|
||||||
|
A: manufacturer=VIA Labs, Inc.
|
||||||
|
A: maxchild=4
|
||||||
|
L: port=../1-0:1.0/usb1-port4
|
||||||
|
A: power/active_duration=11223581
|
||||||
|
A: power/autosuspend=0
|
||||||
|
A: power/autosuspend_delay_ms=0
|
||||||
|
A: power/connected_duration=11223581
|
||||||
|
A: power/control=auto
|
||||||
|
A: power/level=auto
|
||||||
|
A: power/runtime_active_time=11223333
|
||||||
|
A: power/runtime_status=active
|
||||||
|
A: power/runtime_suspended_time=0
|
||||||
|
A: power/wakeup=disabled
|
||||||
|
A: power/wakeup_abort_count=
|
||||||
|
A: power/wakeup_active=
|
||||||
|
A: power/wakeup_active_count=
|
||||||
|
A: power/wakeup_count=
|
||||||
|
A: power/wakeup_expire_count=
|
||||||
|
A: power/wakeup_last_time_ms=
|
||||||
|
A: power/wakeup_max_time_ms=
|
||||||
|
A: power/wakeup_total_time_ms=
|
||||||
|
A: product=USB2.0 Hub
|
||||||
|
A: quirks=0x0
|
||||||
|
A: removable=removable
|
||||||
|
A: rx_lanes=1
|
||||||
|
A: speed=480
|
||||||
|
A: tx_lanes=1
|
||||||
|
A: urbnum=106
|
||||||
|
A: version= 2.10
|
||||||
|
|
||||||
|
P: /devices/pci0000:00/0000:00:14.0/usb1
|
||||||
|
N: bus/usb/001/001=12010002090001406B1D020003050302010109021900010100E0000904000001090000000705810304000C
|
||||||
|
E: DEVNAME=/dev/bus/usb/001/001
|
||||||
|
E: DEVTYPE=usb_device
|
||||||
|
E: DRIVER=usb
|
||||||
|
E: PRODUCT=1d6b/2/503
|
||||||
|
E: TYPE=9/0/1
|
||||||
|
E: BUSNUM=001
|
||||||
|
E: DEVNUM=001
|
||||||
|
E: MAJOR=189
|
||||||
|
E: MINOR=0
|
||||||
|
E: SUBSYSTEM=usb
|
||||||
|
E: ID_VENDOR=Linux_5.3.8-300.fc31.x86_64_xhci-hcd
|
||||||
|
E: ID_VENDOR_ENC=Linux\x205.3.8-300.fc31.x86_64\x20xhci-hcd
|
||||||
|
E: ID_VENDOR_ID=1d6b
|
||||||
|
E: ID_MODEL=xHCI_Host_Controller
|
||||||
|
E: ID_MODEL_ENC=xHCI\x20Host\x20Controller
|
||||||
|
E: ID_MODEL_ID=0002
|
||||||
|
E: ID_REVISION=0503
|
||||||
|
E: ID_SERIAL=Linux_5.3.8-300.fc31.x86_64_xhci-hcd_xHCI_Host_Controller_0000:00:14.0
|
||||||
|
E: ID_SERIAL_SHORT=0000:00:14.0
|
||||||
|
E: ID_BUS=usb
|
||||||
|
E: ID_USB_INTERFACES=:090000:
|
||||||
|
E: ID_VENDOR_FROM_DATABASE=Linux Foundation
|
||||||
|
E: ID_MODEL_FROM_DATABASE=2.0 root hub
|
||||||
|
E: ID_PATH=pci-0000:00:14.0
|
||||||
|
E: ID_PATH_TAG=pci-0000_00_14_0
|
||||||
|
E: ID_FOR_SEAT=usb-pci-0000_00_14_0
|
||||||
|
E: TAGS=:seat:
|
||||||
|
A: authorized=1
|
||||||
|
A: authorized_default=1
|
||||||
|
A: avoid_reset_quirk=0
|
||||||
|
A: bConfigurationValue=1
|
||||||
|
A: bDeviceClass=09
|
||||||
|
A: bDeviceProtocol=01
|
||||||
|
A: bDeviceSubClass=00
|
||||||
|
A: bMaxPacketSize0=64
|
||||||
|
A: bMaxPower=0mA
|
||||||
|
A: bNumConfigurations=1
|
||||||
|
A: bNumInterfaces= 1
|
||||||
|
A: bcdDevice=0503
|
||||||
|
A: bmAttributes=e0
|
||||||
|
A: busnum=1
|
||||||
|
A: configuration=
|
||||||
|
H: descriptors=12010002090001406B1D020003050302010109021900010100E0000904000001090000000705810304000C
|
||||||
|
A: dev=189:0
|
||||||
|
A: devnum=1
|
||||||
|
A: devpath=0
|
||||||
|
L: driver=../../../../bus/usb/drivers/usb
|
||||||
|
A: idProduct=0002
|
||||||
|
A: idVendor=1d6b
|
||||||
|
A: interface_authorized_default=1
|
||||||
|
A: ltm_capable=no
|
||||||
|
A: manufacturer=Linux 5.3.8-300.fc31.x86_64 xhci-hcd
|
||||||
|
A: maxchild=12
|
||||||
|
A: power/active_duration=2372569822
|
||||||
|
A: power/autosuspend=0
|
||||||
|
A: power/autosuspend_delay_ms=0
|
||||||
|
A: power/connected_duration=2405642105
|
||||||
|
A: power/control=auto
|
||||||
|
A: power/level=auto
|
||||||
|
A: power/runtime_active_time=2372599414
|
||||||
|
A: power/runtime_status=active
|
||||||
|
A: power/runtime_suspended_time=33016992
|
||||||
|
A: power/wakeup=disabled
|
||||||
|
A: power/wakeup_abort_count=
|
||||||
|
A: power/wakeup_active=
|
||||||
|
A: power/wakeup_active_count=
|
||||||
|
A: power/wakeup_count=
|
||||||
|
A: power/wakeup_expire_count=
|
||||||
|
A: power/wakeup_last_time_ms=
|
||||||
|
A: power/wakeup_max_time_ms=
|
||||||
|
A: power/wakeup_total_time_ms=
|
||||||
|
A: product=xHCI Host Controller
|
||||||
|
A: quirks=0x0
|
||||||
|
A: removable=unknown
|
||||||
|
A: rx_lanes=1
|
||||||
|
A: serial=0000:00:14.0
|
||||||
|
A: speed=480
|
||||||
|
A: tx_lanes=1
|
||||||
|
A: urbnum=19225
|
||||||
|
A: version= 2.00
|
||||||
|
|
||||||
|
P: /devices/pci0000:00/0000:00:14.0
|
||||||
|
E: DRIVER=xhci_hcd
|
||||||
|
E: PCI_CLASS=C0330
|
||||||
|
E: PCI_ID=8086:9D2F
|
||||||
|
E: PCI_SUBSYS_ID=17AA:2238
|
||||||
|
E: PCI_SLOT_NAME=0000:00:14.0
|
||||||
|
E: MODALIAS=pci:v00008086d00009D2Fsv000017AAsd00002238bc0Csc03i30
|
||||||
|
E: SUBSYSTEM=pci
|
||||||
|
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
|
||||||
|
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
|
||||||
|
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
|
||||||
|
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
|
||||||
|
E: ID_MODEL_FROM_DATABASE=Sunrise Point-LP USB 3.0 xHCI Controller
|
||||||
|
A: ari_enabled=0
|
||||||
|
A: broken_parity_status=0
|
||||||
|
A: class=0x0c0330
|
||||||
|
H: config=86802F9D060490022130030C00008000040022E1000000000000000000000000000000000000000000000000AA1738220000000070000000000000000B010000
|
||||||
|
A: consistent_dma_mask_bits=64
|
||||||
|
A: d3cold_allowed=1
|
||||||
|
A: dbc=disabled
|
||||||
|
A: device=0x9d2f
|
||||||
|
A: dma_mask_bits=64
|
||||||
|
L: driver=../../../bus/pci/drivers/xhci_hcd
|
||||||
|
A: driver_override=(null)
|
||||||
|
A: enable=1
|
||||||
|
A: irq=125
|
||||||
|
A: local_cpulist=0-3
|
||||||
|
A: local_cpus=f
|
||||||
|
A: modalias=pci:v00008086d00009D2Fsv000017AAsd00002238bc0Csc03i30
|
||||||
|
A: msi_bus=1
|
||||||
|
A: msi_irqs/125=msi
|
||||||
|
A: numa_node=-1
|
||||||
|
A: pools=poolinfo - 0.1\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 0 0 128 0\nbuffer-32 0 0 32 0\nxHCI 1KB stream ctx arrays 0 0 1024 0\nxHCI 256 byte stream ctx arrays 0 0 256 0\nxHCI input/output contexts 37 38 2112 38\nxHCI ring segments 116 120 4096 120\nbuffer-2048 3 6 2048 3\nbuffer-512 0 0 512 0\nbuffer-128 30 32 128 1\nbuffer-32 0 0 32 0
|
||||||
|
A: power/control=on
|
||||||
|
A: power/runtime_active_time=2405617003
|
||||||
|
A: power/runtime_status=active
|
||||||
|
A: power/runtime_suspended_time=0
|
||||||
|
A: power/wakeup=enabled
|
||||||
|
A: power/wakeup_abort_count=0
|
||||||
|
A: power/wakeup_active=0
|
||||||
|
A: power/wakeup_active_count=0
|
||||||
|
A: power/wakeup_count=0
|
||||||
|
A: power/wakeup_expire_count=0
|
||||||
|
A: power/wakeup_last_time_ms=0
|
||||||
|
A: power/wakeup_max_time_ms=0
|
||||||
|
A: power/wakeup_total_time_ms=0
|
||||||
|
A: resource=0x00000000e1220000 0x00000000e122ffff 0x0000000000140204\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000
|
||||||
|
A: revision=0x21
|
||||||
|
A: subsystem_device=0x2238
|
||||||
|
A: subsystem_vendor=0x17aa
|
||||||
|
A: vendor=0x8086
|
||||||
|
|
||||||
+71
-14
@@ -4,7 +4,7 @@ envs.set('G_DEBUG', 'fatal-warnings')
|
|||||||
envs.set('G_MESSAGES_DEBUG', 'all')
|
envs.set('G_MESSAGES_DEBUG', 'all')
|
||||||
|
|
||||||
# Setup paths
|
# Setup paths
|
||||||
envs.set('MESON_SOURCE_ROOT', meson.build_root())
|
envs.set('MESON_SOURCE_ROOT', meson.source_root())
|
||||||
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint'))
|
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint'))
|
||||||
|
|
||||||
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
|
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
|
||||||
@@ -16,6 +16,12 @@ envs.set('FP_DRIVERS_WHITELIST', 'virtual_image')
|
|||||||
|
|
||||||
envs.set('NO_AT_BRIDGE', '1')
|
envs.set('NO_AT_BRIDGE', '1')
|
||||||
|
|
||||||
|
drivers_tests = [
|
||||||
|
'elan',
|
||||||
|
'vfs5011',
|
||||||
|
'synaptics',
|
||||||
|
]
|
||||||
|
|
||||||
if get_option('introspection')
|
if get_option('introspection')
|
||||||
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint'))
|
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint'))
|
||||||
|
|
||||||
@@ -26,24 +32,44 @@ if get_option('introspection')
|
|||||||
env: envs,
|
env: envs,
|
||||||
depends: libfprint_typelib,
|
depends: libfprint_typelib,
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
test('virtual-image',
|
||||||
|
find_program('sh'),
|
||||||
|
args: ['-c', 'exit 77']
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
drivers_tests = [
|
|
||||||
'vfs5011',
|
|
||||||
'synaptics',
|
|
||||||
]
|
|
||||||
|
|
||||||
foreach driver_test: drivers_tests
|
foreach driver_test: drivers_tests
|
||||||
driver_envs = envs
|
driver_envs = envs
|
||||||
driver_envs.set('FP_DRIVERS_WHITELIST', driver_test)
|
driver_envs.set('FP_DRIVERS_WHITELIST', driver_test)
|
||||||
|
|
||||||
|
if driver_test in drivers
|
||||||
|
test(driver_test,
|
||||||
|
find_program('umockdev-test.py'),
|
||||||
|
args: join_paths(meson.current_source_dir(), driver_test),
|
||||||
|
env: driver_envs,
|
||||||
|
suite: ['drivers'],
|
||||||
|
timeout: 10,
|
||||||
|
depends: libfprint_typelib,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
test(driver_test,
|
||||||
|
find_program('sh'),
|
||||||
|
args: ['-c', 'exit 77']
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
else
|
||||||
|
warning('Skipping all driver tests as introspection bindings are missing')
|
||||||
|
test('virtual-image',
|
||||||
|
find_program('sh'),
|
||||||
|
args: ['-c', 'exit 77']
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach driver_test: drivers_tests
|
||||||
test(driver_test,
|
test(driver_test,
|
||||||
find_program('umockdev-test.py'),
|
find_program('sh'),
|
||||||
args: join_paths(meson.current_source_dir(), driver_test),
|
args: ['-c', 'exit 77']
|
||||||
env: driver_envs,
|
|
||||||
suite: ['drivers'],
|
|
||||||
timeout: 10,
|
|
||||||
depends: libfprint_typelib,
|
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
@@ -59,6 +85,7 @@ test_utils = static_library('fprint-test-utils',
|
|||||||
unit_tests = [
|
unit_tests = [
|
||||||
'fpi-device',
|
'fpi-device',
|
||||||
'fpi-ssm',
|
'fpi-ssm',
|
||||||
|
'fpi-assembling',
|
||||||
]
|
]
|
||||||
|
|
||||||
if 'virtual_image' in drivers
|
if 'virtual_image' in drivers
|
||||||
@@ -68,11 +95,41 @@ if 'virtual_image' in drivers
|
|||||||
]
|
]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
unit_tests_deps = { 'fpi-assembling' : [cairo_dep] }
|
||||||
|
|
||||||
|
test_config = configuration_data()
|
||||||
|
test_config.set_quoted('SOURCE_ROOT', meson.source_root())
|
||||||
|
test_config_h = configure_file(output: 'test-config.h', configuration: test_config)
|
||||||
|
|
||||||
foreach test_name: unit_tests
|
foreach test_name: unit_tests
|
||||||
|
if unit_tests_deps.has_key(test_name)
|
||||||
|
missing_deps = false
|
||||||
|
foreach dep: unit_tests_deps[test_name]
|
||||||
|
if not dep.found()
|
||||||
|
missing_deps = true
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
if missing_deps
|
||||||
|
# Create a dummy test that always skips instead
|
||||||
|
warning('Test @0@ cannot be compiled due to missing dependencies'.format(test_name))
|
||||||
|
test(test_name,
|
||||||
|
find_program('sh'),
|
||||||
|
suite: ['unit-tests'],
|
||||||
|
args: ['-c', 'exit 77'],
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
extra_deps = unit_tests_deps[test_name]
|
||||||
|
else
|
||||||
|
extra_deps = []
|
||||||
|
endif
|
||||||
|
|
||||||
basename = 'test-' + test_name
|
basename = 'test-' + test_name
|
||||||
test_exe = executable(basename,
|
test_exe = executable(basename,
|
||||||
sources: basename + '.c',
|
sources: [basename + '.c', test_config_h],
|
||||||
dependencies: libfprint_private_dep,
|
dependencies: [ libfprint_private_dep ] + extra_deps,
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
link_with: test_utils,
|
link_with: test_utils,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Example fingerprint device prints listing and deletion
|
||||||
|
* Enrolls your right index finger and saves the print to disk
|
||||||
|
* Copyright (C) 2019 Benjamin Berg <bberg@redhat.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
#include "fpi-assembling.h"
|
||||||
|
#include "fpi-image.h"
|
||||||
|
#include "test-config.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
struct fpi_frame frame;
|
||||||
|
cairo_surface_t *surf;
|
||||||
|
guchar *data;
|
||||||
|
guint stride;
|
||||||
|
guint width;
|
||||||
|
guint height;
|
||||||
|
guint x;
|
||||||
|
guint y;
|
||||||
|
} cairo_frame;
|
||||||
|
|
||||||
|
static unsigned char
|
||||||
|
cairo_get_pixel (struct fpi_frame_asmbl_ctx *ctx,
|
||||||
|
struct fpi_frame *frame,
|
||||||
|
unsigned int x,
|
||||||
|
unsigned int y)
|
||||||
|
{
|
||||||
|
cairo_frame *c_frame = (void *) frame; /* Indirect cast to avoid alignment warning. */
|
||||||
|
|
||||||
|
x = x + c_frame->x;
|
||||||
|
y = y + c_frame->y;
|
||||||
|
|
||||||
|
g_assert (x < c_frame->width);
|
||||||
|
g_assert (y < c_frame->height);
|
||||||
|
|
||||||
|
return c_frame->data[x * 4 + y * c_frame->stride + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_frame_assembling (void)
|
||||||
|
{
|
||||||
|
g_autofree char *path = NULL;
|
||||||
|
cairo_surface_t *img = NULL;
|
||||||
|
int width, height, stride, offset;
|
||||||
|
int test_height;
|
||||||
|
guchar *data;
|
||||||
|
struct fpi_frame_asmbl_ctx ctx = { 0, };
|
||||||
|
|
||||||
|
g_autoptr(FpImage) fp_img = NULL;
|
||||||
|
GSList *frames = NULL;
|
||||||
|
|
||||||
|
g_assert_false (SOURCE_ROOT == NULL);
|
||||||
|
path = g_build_path (G_DIR_SEPARATOR_S, SOURCE_ROOT, "tests", "vfs5011", "capture.png", NULL);
|
||||||
|
|
||||||
|
img = cairo_image_surface_create_from_png (path);
|
||||||
|
data = cairo_image_surface_get_data (img);
|
||||||
|
width = cairo_image_surface_get_width (img);
|
||||||
|
height = cairo_image_surface_get_height (img);
|
||||||
|
stride = cairo_image_surface_get_stride (img);
|
||||||
|
g_assert_cmpint (cairo_image_surface_get_format (img), ==, CAIRO_FORMAT_RGB24);
|
||||||
|
|
||||||
|
ctx.get_pixel = cairo_get_pixel;
|
||||||
|
ctx.frame_width = width;
|
||||||
|
ctx.frame_height = 20;
|
||||||
|
ctx.image_width = width;
|
||||||
|
|
||||||
|
offset = 10;
|
||||||
|
test_height = height - (height - ctx.frame_height) % offset;
|
||||||
|
|
||||||
|
/* for now, fixed offset */
|
||||||
|
for (int y = 0; y + ctx.frame_height < height; y += offset)
|
||||||
|
{
|
||||||
|
cairo_frame *frame = g_new0 (cairo_frame, 1);
|
||||||
|
|
||||||
|
frame->surf = img;
|
||||||
|
frame->width = width;
|
||||||
|
frame->height = height;
|
||||||
|
frame->stride = stride;
|
||||||
|
frame->data = data;
|
||||||
|
frame->x = 0;
|
||||||
|
frame->y = y;
|
||||||
|
//frame->y = test_height - ctx.frame_height - y;
|
||||||
|
|
||||||
|
frames = g_slist_append (frames, frame);
|
||||||
|
}
|
||||||
|
//offset = -offset;
|
||||||
|
|
||||||
|
fpi_do_movement_estimation (&ctx, frames);
|
||||||
|
for (GSList *l = frames->next; l != NULL; l = l->next)
|
||||||
|
{
|
||||||
|
cairo_frame * frame = l->data;
|
||||||
|
|
||||||
|
g_assert_cmpint (frame->frame.delta_x, ==, 0);
|
||||||
|
g_assert_cmpint (frame->frame.delta_y, ==, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
fp_img = fpi_assemble_frames (&ctx, frames);
|
||||||
|
g_assert_cmpint (fp_img->height, ==, test_height);
|
||||||
|
|
||||||
|
/* The FpImage and cairo surface need to be identical in the test area */
|
||||||
|
for (int y = 0; y < test_height; y++)
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
g_assert_cmpint (data[x * 4 + y * stride + 1], ==, fp_img->data[x + y * width]);
|
||||||
|
|
||||||
|
g_slist_free_full (frames, g_free);
|
||||||
|
cairo_surface_destroy (img);
|
||||||
|
g_assert (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
|
g_test_add_func ("/assembling/frames", test_frame_assembling);
|
||||||
|
|
||||||
|
return g_test_run ();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user