Re: [PATCH 1/2] edid-decode: add function to enable usage as a library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ilia,

I pushed my patch to initialize edid_state in the constructor to the
edid-decode git repo.

I've also split off the 'write to a file' part from edid_from_file into
a separate edid_to_file function, so you'll have to rebase your patch.

Two comments below:

On 2/9/20 6:49 PM, Ilia Mirkin wrote:
> This is helpful for an emscripten setup, as there's no great way to
> reinitialize the object from scratch.
> 
> Signed-off-by: Ilia Mirkin <imirkin@xxxxxxxxxxxx>
> ---
>  edid-decode.cpp | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/edid-decode.cpp b/edid-decode.cpp
> index ef50da2..fd17bc6 100644
> --- a/edid-decode.cpp
> +++ b/edid-decode.cpp
> @@ -1005,3 +1005,21 @@ int main(int argc, char **argv)
>  		return edid_from_file(argv[optind], argv[optind + 1], out_fmt);
>  	return ret ? ret : state.parse_edid();
>  }
> +
> +#ifdef __EMSCRIPTEN__
> +/*
> + * The surrounding JavaScript implementation will call this function
> + * each time it wants to decode an EDID. So this should reset all the
> + * state and start over.
> + */
> +extern "C" int parse_edid(const char *input) {

'{' should start on the next line. Let's keep the coding style consistent.

> +	for (unsigned i = 0; i < EDID_MAX_BLOCKS + 1; i++) {
> +		s_msgs[i][0].clear();
> +		s_msgs[i][1].clear();
> +	}

I'm pretty sure that this for loop is not necessary. Can you drop this
for loop and see if it works?

> +	options[OptCheck] = 1;
> +	state = edid_state();
> +	int ret = edid_from_file(input, NULL, OUT_FMT_DEFAULT);
> +	return ret ? ret : state.parse_edid();
> +}
> +#endif
> 

Regards,

	Hans



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux