elan: Work-around sensors returning incorrect dimensions
The dimensions some sensors return is the maximum zero-based index rather than the number of pixels. Assuming every sensor has an even number of pixels is safe.
This commit is contained in:
parent
66461e4c81
commit
b20a74a22c
1 changed files with 8 additions and 0 deletions
|
@ -755,6 +755,14 @@ static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_dat
|
||||||
elandev->frame_height = elandev->raw_frame_height =
|
elandev->frame_height = elandev->raw_frame_height =
|
||||||
elandev->last_read[0];
|
elandev->last_read[0];
|
||||||
}
|
}
|
||||||
|
/* Work-around sensors returning the sizes as zero-based index
|
||||||
|
* rather than the number of pixels. */
|
||||||
|
if ((elandev->frame_width % 2 == 1) &&
|
||||||
|
(elandev->frame_height % 2 == 1)) {
|
||||||
|
elandev->frame_width++;
|
||||||
|
elandev->frame_height++;
|
||||||
|
elandev->raw_frame_height = elandev->frame_height;
|
||||||
|
}
|
||||||
if (elandev->frame_height > ELAN_MAX_FRAME_HEIGHT)
|
if (elandev->frame_height > ELAN_MAX_FRAME_HEIGHT)
|
||||||
elandev->frame_height = ELAN_MAX_FRAME_HEIGHT;
|
elandev->frame_height = ELAN_MAX_FRAME_HEIGHT;
|
||||||
fp_dbg("sensor dimensions, WxH: %dx%d", elandev->frame_width,
|
fp_dbg("sensor dimensions, WxH: %dx%d", elandev->frame_width,
|
||||||
|
|
Loading…
Reference in a new issue