Exemplo n.º 1
0
static bool read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
	ssize_t bytes_read;
	char buf[pipe_crc->buffer_len];

	igt_set_timeout(5, "CRC reading");
	bytes_read = read(pipe_crc->crc_fd, &buf, pipe_crc->line_len);
	igt_reset_timeout();

	igt_assert_eq(bytes_read, pipe_crc->line_len);
	buf[bytes_read] = '\0';

	if (!pipe_crc_init_from_string(out, buf))
		return false;

	return true;
}
Exemplo n.º 2
0
static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
{
	ssize_t bytes_read;
	char buf[pipe_crc->buffer_len];

	igt_set_timeout(5, "CRC reading");
	bytes_read = read(pipe_crc->crc_fd, &buf, pipe_crc->line_len);
	igt_reset_timeout();

	if (bytes_read < 0 && errno == EAGAIN) {
		igt_assert(pipe_crc->flags & O_NONBLOCK);
		bytes_read = 0;
	} else {
		igt_assert_eq(bytes_read, pipe_crc->line_len);
	}
	buf[bytes_read] = '\0';

	if (bytes_read && !pipe_crc_init_from_string(out, buf))
		return -EINVAL;

	return bytes_read;
}