mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
upektc_img: Add asserts for expected height reported by the device
This commit is contained in:
committed by
Vasily Khoruzhick
parent
29a24ba67f
commit
9c900789de
@@ -557,39 +557,44 @@ init_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
|||||||
if (data[12] == 0x06 && data[13] == 0x14) /* if get_info */
|
if (data[12] == 0x06 && data[13] == 0x14) /* if get_info */
|
||||||
{
|
{
|
||||||
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_GET_CLASS (dev);
|
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_GET_CLASS (dev);
|
||||||
uint16_t width = 0;
|
uint16_t width = (data[51] << 8) | data[50];
|
||||||
|
uint16_t height = (data[53] << 8) | data[52];
|
||||||
|
|
||||||
self->area_sensor = !(data[49] & 0x80);
|
self->area_sensor = !(data[49] & 0x80);
|
||||||
width = (data[51] << 8) | data[50];
|
|
||||||
|
|
||||||
switch (width)
|
switch (width)
|
||||||
{
|
{
|
||||||
case 256:
|
case 256:
|
||||||
fp_dbg ("Sensor type : TCS1x"); /* 360x256 --- 270x192 must be set*/
|
fp_dbg ("Sensor type : TCS1x, width x height: %hu x %hu", width, height); /* 360x256 --- 270x192 must be set */
|
||||||
|
BUG_ON (height != 360);
|
||||||
img_class->img_width = 192;
|
img_class->img_width = 192;
|
||||||
img_class->img_height = 270;
|
img_class->img_height = 270;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 208:
|
case 208:
|
||||||
fp_dbg ("Sensor type : TCS2"); /* 288x208 --- 216x156 must be set*/
|
fp_dbg ("Sensor type : TCS2, width x height: %hu x %hu", width, height); /* 288x208 --- 216x156 must be set */
|
||||||
|
BUG_ON (height != 288);
|
||||||
img_class->img_width = 156;
|
img_class->img_width = 156;
|
||||||
img_class->img_height = 216;
|
img_class->img_height = 216;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 248:
|
case 248:
|
||||||
fp_dbg ("Sensor type : TCS3"); /* 360x248 --- 270x186 must be set*/
|
fp_dbg ("Sensor type : TCS3, width x height: %hu x %hu", width, height); /* 360x248 --- 270x186 must be set */
|
||||||
|
BUG_ON (height != 360);
|
||||||
img_class->img_width = 186;
|
img_class->img_width = 186;
|
||||||
img_class->img_height = 270;
|
img_class->img_height = 270;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 192:
|
case 192:
|
||||||
fp_dbg ("Sensor type : TCS4x"); /* 512x192 --- 384x144 must be set*/
|
fp_dbg ("Sensor type : TCS4x, width x height: %hu x %hu", width, height); /* 512x192 --- 384x144 must be set */
|
||||||
|
BUG_ON (height != 512);
|
||||||
img_class->img_width = 144;
|
img_class->img_width = 144;
|
||||||
img_class->img_height = 384;
|
img_class->img_height = 384;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 144:
|
case 144:
|
||||||
fp_dbg ("Sensor type : TCS5x"); /* 512x144 --- 384x108 must be set*/
|
fp_dbg ("Sensor type : TCS5x, width x height: %hu x %hu", width, height); /* 512x144 --- 384x108 must be set */
|
||||||
|
BUG_ON (height != 512);
|
||||||
img_class->img_width = 108;
|
img_class->img_width = 108;
|
||||||
img_class->img_height = 384;
|
img_class->img_height = 384;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user