I'm working through the vpfe_capture.c driver code and the mt90p031 driver code in the hopes of understanding it so I can implement my own sub device driver for an imager. I'm using the dvsk-4_02_00_06 with the RidgeRun SDK.
I noticed that there is some faulty logic in vpfe_config_image_format() specifically when the sub device doesn't support the g_fmt ioctl (the case for the mt9p031 driver).
The function sets up some defaults for in the vpfe_dev.fmt struct then attempts to get the actual format from the sub device in a temporary structure sd_fmt.
If the g_fmt call fails with ENOICTLCMD (i.e. the sub device doesn't implement it) the function goes ahead and overwrites the defaults with the crap values in the temporary sd_fmt and things are likely to fail further on.
I think the code following code:
if (ret && ret != -ENOIOCTLCMD) {
v4l2_err(&vpfe_dev->v4l2_dev,
"error in getting g_fmt from sub device\n");
return ret;
}
vpfe_dev->fmt = sd_fmt;
Should be changed to
if (ret && ret != -ENOIOCTLCMD) {
v4l2_err(&vpfe_dev->v4l2_dev,
"error in getting g_fmt from sub device\n");
return ret;
}
else if( !ret )
vpfe_dev->fmt = sd_fmt;
So we only fail on a true error and only overwrite the defaults g_fmt really succeeds.
I'm brand new to working with Linux driver code so don't know the proper way to go about submitting this as a bug and a corresponding fix so please advise me on what to do.
Thanks,
Matt Schuckmann