veyeimaging / raspberrypi_v4l2

GNU General Public License v3.0
16 stars 5 forks source link

Why is exposure and other controls commented in the source code? #7

Open pacoferre opened 3 years ago

pacoferre commented 3 years ago

Hello,

I'm trying to connect the camera to INDI Library for Astrophotography and it warns about lack of features (exposure).

So I dig in the source code and found code with #if 0 and return statements.

https://github.com/veyeimaging/raspberrypi_v4l2/blob/2443c50d197fa7cd124f89edabdd8c93fba217c2/driver_source/cam_drv_src/rpi-5.x_all/veye327.c#L737

https://github.com/veyeimaging/raspberrypi_v4l2/blob/2443c50d197fa7cd124f89edabdd8c93fba217c2/driver_source/cam_drv_src/rpi-5.x_all/veye327.c#L285

Is it possible to uncomment them and recompile again using a Raspberry PI 4b?... I'll give it a try.

pacoferre commented 3 years ago

I was able to compile, but errors :(...

CC [M] drivers/media/i2c/veye327.o drivers/media/i2c/veye327.c: In function ‘veye327_set_ctrl’: drivers/media/i2c/veye327.c:301:36: error: ‘VEYE327_REG_ANALOG_GAIN’ undeclared (first use in this function); did you mean ‘V4L2_CID_ANALOGUE_GAIN’? ret = veye327_write_reg(veye327, VEYE327_REG_ANALOG_GAIN, ^~~~~~~ V4L2_CID_ANALOGUE_GAIN drivers/media/i2c/veye327.c:301:36: note: each undeclared identifier is reported only once for each function it appears in drivers/media/i2c/veye327.c:302:12: error: ‘VEYE327_REG_VALUE_08BIT’ undeclared (first use in this function); did you mean ‘VEYE327_DEVICE_ID’? VEYE327_REG_VALUE_08BIT, ctrl->val); ^~~~~~~ VEYE327_DEVICE_ID drivers/media/i2c/veye327.c:301:9: error: too many arguments to function ‘veye327_write_reg’ ret = veye327_write_reg(veye327, VEYE327_REG_ANALOG_GAIN, ^~~~~ drivers/media/i2c/veye327.c:171:12: note: declared here static int veye327_write_reg(struct veye327 veye327, u16 reg, u8 val) ^~~~~ drivers/media/i2c/veye327.c:305:36: error: ‘VEYE327_REG_EXPOSURE’ undeclared (first use in this function); did you mean ‘V4L2_CID_EXPOSURE’? ret = veye327_write_reg(veye327, VEYE327_REG_EXPOSURE, ^~~~~~~~ V4L2_CID_EXPOSURE drivers/media/i2c/veye327.c:306:12: error: ‘VEYE327_REG_VALUE_16BIT’ undeclared (first use in this function); did you mean ‘VEYE327_DEVICE_ID’? VEYE327_REG_VALUE_16BIT, ctrl->val); ^~~~~~~ VEYE327_DEVICE_ID drivers/media/i2c/veye327.c:305:9: error: too many arguments to function ‘veye327_write_reg’ ret = veye327_write_reg(veye327, VEYE327_REG_EXPOSURE, ^~~~~ drivers/media/i2c/veye327.c:171:12: note: declared here static int veye327_write_reg(struct veye327 veye327, u16 reg, u8 val) ^~~~~ drivers/media/i2c/veye327.c:309:36: error: ‘VEYE327_REG_DIGITAL_GAIN’ undeclared (first use in this function); did you mean ‘V4L2_CID_DIGITAL_GAIN’? ret = veye327_write_reg(veye327, VEYE327_REG_DIGITAL_GAIN, ^~~~~~~~ V4L2_CID_DIGITAL_GAIN drivers/media/i2c/veye327.c:309:9: error: too many arguments to function ‘veye327_write_reg’ ret = veye327_write_reg(veye327, VEYE327_REG_DIGITAL_GAIN, ^~~~~ drivers/media/i2c/veye327.c:171:12: note: declared here static int veye327_write_reg(struct veye327 veye327, u16 reg, u8 val) ^~~~~ drivers/media/i2c/veye327.c:314:36: error: ‘VEYE327_REG_ORIENTATION’ undeclared (first use in this function); did you mean ‘ACPI_PLD_GET_ORIENTATION’? ret = veye327_write_reg(veye327, VEYE327_REG_ORIENTATION, 1, ^~~~~~~ ACPI_PLD_GET_ORIENTATION drivers/media/i2c/veye327.c:314:9: error: too many arguments to function ‘veye327_write_reg’ ret = veye327_write_reg(veye327, VEYE327_REG_ORIENTATION, 1, ^~~~~ drivers/media/i2c/veye327.c:171:12: note: declared here static int veye327_write_reg(struct veye327 veye327, u16 reg, u8 val) ^~~~~ drivers/media/i2c/veye327.c:319:36: error: ‘VEYE327_REG_VTS’ undeclared (first use in this function); did you mean ‘VEYE327_PIXEL_RATE’? ret = veye327_write_reg(veye327, VEYE327_REG_VTS, ^~~~~~~ VEYE327_PIXEL_RATE drivers/media/i2c/veye327.c:319:9: error: too many arguments to function ‘veye327_write_reg’ ret = veye327_write_reg(veye327, VEYE327_REG_VTS, ^~~~~ drivers/media/i2c/veye327.c:171:12: note: declared here static int veye327_write_reg(struct veye327 *veye327, u16 reg, u8 val) ^~~~~ In file included from ./include/linux/device.h:15, from ./include/linux/acpi.h:15, from ./include/linux/i2c.h:13, from drivers/media/i2c/veye327.c:20: drivers/media/i2c/veye327.c:325:13: error: ‘client’ undeclared (first use in this function); did you mean ‘rlimit’? dev_info(&client->dev, ^~ ./include/linux/dev_printk.h:118:12: note: in definition of macro ‘dev_info’ _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~ drivers/media/i2c/veye327.c: In function ‘veye327_init_controls’: drivers/media/i2c/veye327.c:737:26: error: ‘VEYE327_VBLANK_MIN’ undeclared (first use in this function); did you mean ‘VEYE327_XCLK_FREQ’? V4L2_CID_VBLANK, VEYE327_VBLANK_MIN, ^~~~~~ VEYE327_XCLK_FREQ drivers/media/i2c/veye327.c:738:9: error: ‘VEYE327_VTS_MAX’ undeclared (first use in this function); did you mean ‘VEYE327_XCLK_FREQ’? VEYE327_VTS_MAX - height, 1, ^~~~~~~ VEYE327_XCLK_FREQ drivers/media/i2c/veye327.c:738:27: error: ‘height’ undeclared (first use in this function); did you mean ‘hweight8’? VEYE327_VTS_MAX - height, 1, ^~ hweight8 drivers/media/i2c/veye327.c:739:22: error: ‘const struct veye327_mode’ has no member named ‘vts_def’ veye327->mode->vts_def - height); ^~ drivers/media/i2c/veye327.c:740:2: error: ‘hblank’ undeclared (first use in this function) hblank = VEYE327_PPL_DEFAULT - veye327->mode->width; ^~ drivers/media/i2c/veye327.c:740:11: error: ‘VEYE327_PPL_DEFAULT’ undeclared (first use in this function); did you mean ‘NET_DCCP_DEFAULT’? hblank = VEYE327_PPL_DEFAULT - veye327->mode->width; ^~~~~~~ NET_DCCP_DEFAULT drivers/media/i2c/veye327.c:746:2: error: ‘exposure_max’ undeclared (first use in this function); did you mean ‘ioport_map’? exposure_max = veye327->mode->vts_def - 4; ^~~~ ioport_map drivers/media/i2c/veye327.c:746:30: error: ‘const struct veye327_mode’ has no member named ‘vts_def’ exposure_max = veye327->mode->vts_def - 4; ^~ drivers/media/i2c/veye327.c:747:2: error: ‘exposure_def’ undeclared (first use in this function) exposure_def = (exposure_max < VEYE327_EXPOSURE_DEFAULT) ? ^~~~ drivers/media/i2c/veye327.c:747:33: error: ‘VEYE327_EXPOSURE_DEFAULT’ undeclared (first use in this function); did you mean ‘V4L2_EXPOSURE_AUTO’? exposure_def = (exposure_max < VEYE327_EXPOSURE_DEFAULT) ? ^~~~~~~~ V4L2_EXPOSURE_AUTO drivers/media/i2c/veye327.c:751:11: error: ‘VEYE327_EXPOSURE_MIN’ undeclared (first use in this function); did you mean ‘V4L2_EXPOSURE_MANUAL’? VEYE327_EXPOSURE_MIN, exposure_max, ^~~~~~~~ V4L2_EXPOSURE_MANUAL drivers/media/i2c/veye327.c:752:11: error: ‘VEYE327_EXPOSURE_STEP’ undeclared (first use in this function); did you mean ‘V4L2_EXPOSURE_AUTO’? VEYE327_EXPOSURE_STEP, ^~~~~ V4L2_EXPOSURE_AUTO drivers/media/i2c/veye327.c:756:6: error: ‘VEYE327_ANA_GAIN_MIN’ undeclared (first use in this function); did you mean ‘VEYE327_DEVICE_ID’? VEYE327_ANA_GAIN_MIN, VEYE327_ANA_GAIN_MAX, ^~~~~~~~ VEYE327_DEVICE_ID drivers/media/i2c/veye327.c:756:28: error: ‘VEYE327_ANA_GAIN_MAX’ undeclared (first use in this function) VEYE327_ANA_GAIN_MIN, VEYE327_ANA_GAIN_MAX, ^~~~~~~~ drivers/media/i2c/veye327.c:757:6: error: ‘VEYE327_ANA_GAIN_STEP’ undeclared (first use in this function) VEYE327_ANA_GAIN_STEP, VEYE327_ANA_GAIN_DEFAULT); ^~~~~ drivers/media/i2c/veye327.c:757:29: error: ‘VEYE327_ANA_GAIN_DEFAULT’ undeclared (first use in this function); did you mean ‘VEYE327_XCLR_MIN_DELAY_US’? VEYE327_ANA_GAIN_STEP, VEYE327_ANA_GAIN_DEFAULT); ^~~~~~~~ VEYE327_XCLR_MIN_DELAY_US drivers/media/i2c/veye327.c:760:6: error: ‘VEYE327_DGTL_GAIN_MIN’ undeclared (first use in this function); did you mean ‘VEYE327_DEVICE_ID’? VEYE327_DGTL_GAIN_MIN, VEYE327_DGTL_GAIN_MAX, ^~~~~ VEYE327_DEVICE_ID drivers/media/i2c/veye327.c:760:29: error: ‘VEYE327_DGTL_GAIN_MAX’ undeclared (first use in this function) VEYE327_DGTL_GAIN_MIN, VEYE327_DGTL_GAIN_MAX, ^~~~~ drivers/media/i2c/veye327.c:761:6: error: ‘VEYE327_DGTL_GAIN_STEP’ undeclared (first use in this function); did you mean ‘VEYE327_PIXEL_RATE’? VEYE327_DGTL_GAIN_STEP, VEYE327_DGTL_GAIN_DEFAULT); ^~~~~~ VEYE327_PIXEL_RATE drivers/media/i2c/veye327.c:761:30: error: ‘VEYE327_DGTL_GAIN_DEFAULT’ undeclared (first use in this function); did you mean ‘VEYE327_XCLR_MIN_DELAY_US’? VEYE327_DGTL_GAIN_STEP, VEYE327_DGTL_GAIN_DEFAULT); ^~~~~~~~~ VEYE327_XCLR_MIN_DELAY_US In file included from ./include/linux/clk.h:13, from drivers/media/i2c/veye327.c:15: drivers/media/i2c/veye327.c:775:21: error: ‘veye327_test_pattern_menu’ undeclared (first use in this function); did you mean ‘veye327_stop_streaming’? ARRAY_SIZE(veye327_test_pattern_menu) - 1, ^~~~~~~~~ ./include/linux/kernel.h:48:33: note: in definition of macro ‘ARRAY_SIZE’

define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

                             ^~~

In file included from ./include/linux/bits.h:22, from ./include/linux/bitops.h:5, from ./include/linux/kernel.h:12, from ./include/linux/clk.h:13, from drivers/media/i2c/veye327.c:15: ./include/linux/build_bug.h:16:51: error: bit-field ‘’ width not an integer constant

define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))

                                               ^

./include/linux/compiler.h:238:28: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’

define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

                        ^~~~~~~~~~~~~~~~~

./include/linux/kernel.h:48:59: note: in expansion of macro ‘__must_be_array’

define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

                                                       ^~~~~~~~~~~~~~~

drivers/media/i2c/veye327.c:775:10: note: in expansion of macro ‘ARRAY_SIZE’ ARRAY_SIZE(veye327_test_pattern_menu) - 1, ^~~~~~ drivers/media/i2c/veye327.c:777:7: error: ‘i’ undeclared (first use in this function) for (i = 0; i < 4; i++) { ^ drivers/media/i2c/veye327.c:786:7: error: ‘VEYE327_TESTP_COLOUR_MIN’ undeclared (first use in this function); did you mean ‘VEYE327_DEVICE_ID’? VEYE327_TESTP_COLOUR_MIN, ^~~~~~~~ VEYE327_DEVICE_ID drivers/media/i2c/veye327.c:787:7: error: ‘VEYE327_TESTP_COLOUR_MAX’ undeclared (first use in this function) VEYE327_TESTP_COLOUR_MAX, ^~~~~~~~ drivers/media/i2c/veye327.c:788:7: error: ‘VEYE327_TESTP_COLOUR_STEP’ undeclared (first use in this function); did you mean ‘VEYE327_PIXEL_RATE’? VEYE327_TESTP_COLOUR_STEP, ^~~~~~~~~ VEYE327_PIXEL_RATE drivers/media/i2c/veye327.c:800:48: error: ‘props’ undeclared (first use in this function); did you mean pr_ops’? ret = v4l2_fwnode_device_parse(&client->dev, &props); ^~~~~ pr_ops make[3]: *** [scripts/Makefile.build:279: drivers/media/i2c/veye327.o] Error 1

mmxuxp commented 2 years ago

Sorry for the very late reply. You can ask questions in the future at forum.veye.cc. The veye series mode is including isp function, no driver is needed to do ae operation.

pacoferre commented 2 years ago

Sorry for the very late reply. You can ask questions in the future at forum.veye.cc. The veye series mode is including isp function, no driver is needed to do ae operation.

Thanks a lot. The problem occurs when trying to use the camera for astrophotography. The software needs to have control over the exposure and the driver does not allow it.

uboatsalamander commented 2 years ago

Sorry for the very late reply. You can ask questions in the future at forum.veye.cc. The veye series mode is including isp function, no driver is needed to do ae operation.

Thanks a lot. The problem occurs when trying to use the camera for astrophotography. The software needs to have control over the exposure and the driver does not allow it.

Greetings,

I have the same use case for the camera to use it under INDI. Maybe we can collaborate on this together? I am not sure if the V4L2 is the right way however. Does it allow single frame exposure, or just video stream is possible?

salamander

pacoferre commented 2 years ago

Sorry for the very late reply. You can ask questions in the future at forum.veye.cc. The veye series mode is including isp function, no driver is needed to do ae operation.

Thanks a lot. The problem occurs when trying to use the camera for astrophotography. The software needs to have control over the exposure and the driver does not allow it.

Greetings,

I have the same use case for the camera to use it under INDI. Maybe we can collaborate on this together? I am not sure if the V4L2 is the right way however. Does it allow single frame exposure, or just video stream is possible?

salamander

Hello,

I tried to "fix" the code, also looking to other V4L2 drivers for IMX327, such as https://github.com/54shady/qop_kernel/blob/master/drivers/media/i2c/imx327.c, but finally I quit.

Regarding V4L2, I think it is perfectly valid (https://indilib.org/ccds/web-cameras.html), but, if the driver does not provide control for exposure... INDI cannot use that feature.

This summer perhaps I'll buy an USB camera, just to play with the kids and make some photos.

Best regards,

Paco

uboatsalamander commented 2 years ago

Hello Paco,

thank you, I will look it up.

As for the non-suitability, I thought that V4L2 maybe do not have control for the single exposure, but did test yesterday with cheap webcam and was able to make one second single frame captures with it in EKOS. So it is just missing from driver, same as most of the other controls, I will look up the source of the USB webcam driver and also the IMX327 driver you linked. I am pretty much noob as far as doing something under linux goes, but I am determined :)