VEYE IMAGING Forum
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc
    • Register
    • Login

    radxa zero 3e, debian, linux 5.10, imx287: Inappropriate ioctl for device

    Scheduled Pinned Locked Moved Rockchip App camera
    4 Posts 2 Posters 3.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      nkos
      last edited by

      Hi, I'm trying to use imx287 on radxa zero 3e using the same C code I successfully used for rpi zero 2w:

      ...
      int fd = open("/dev/video0", O_RDWR);
      ...
      int camIdx = 0;
      int input = camIdx;
      int ret = ioctl(m_cam_fd, VIDIOC_S_INPUT, &input);
      // ret < 0: strerror(errno) == "Inappropriate ioctl for device"
      

      Could you please tell if I'm missing something?
      Do I need to select different device or VIDIOC_S_INPUT argument?

      After selecting the camera, I was going to use the same approach which worked for rpi zero 2w: VIDIOC_TRY_FMT/VIDIOC_S_FMT/VIDIOC_REQBUFS/VIDIOC_QUERYBUF/VIDIOC_QBUF/VIDIOC_DQBUF, is it possible? Does driver support this?

      I'm able to set cam params using mv_mipi_i2c_new.sh and it works (I set different metime values - and I see that laser (connected to cam output) brightness is changing)

      v4l2-ctl --set-fmt-video=width=$WIDTH,height=$HEIGHT,pixelformat=GREY --stream-mmap --stream-count=-1 --stream-to=/dev/null
      
      ./i2c_tools$ sudo ./mv_mipi_i2c_new.sh -b 2 -w metime 18
      ./i2c_tools$ sudo ./mv_mipi_i2c_new.sh -b 2 -w metime 180
      
      $ media-ctl -p -d /dev/media0
      Media controller API version 5.10.160
      
      Media device information
      ------------------------
      driver          rkcif
      model           rkcif_mipi_lvds
      serial          
      bus info        
      hw revision     0x0
      driver version  5.10.160
      
      Device topology
      - entity 1: stream_cif_mipi_id0 (1 pad, 4 links)
                  type Node subtype V4L flags 0
                  device node name /dev/video0
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 [ENABLED]
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 5: stream_cif_mipi_id1 (1 pad, 4 links)
                  type Node subtype V4L flags 0
                  device node name /dev/video1
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 [ENABLED]
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 9: stream_cif_mipi_id2 (1 pad, 4 links)
                  type Node subtype V4L flags 0
                  device node name /dev/video2
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 [ENABLED]
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 13: stream_cif_mipi_id3 (1 pad, 4 links)
                   type Node subtype V4L flags 0
                   device node name /dev/video3
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 [ENABLED]
      
      - entity 17: rkcif_tools_id0 (1 pad, 4 links)
                   type Node subtype V4L flags 0
                   device node name /dev/video4
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 21: rkcif_tools_id1 (1 pad, 4 links)
                   type Node subtype V4L flags 0
                   device node name /dev/video5
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 25: rkcif_tools_id2 (1 pad, 4 links)
                   type Node subtype V4L flags 0
                   device node name /dev/video6
      	pad0: Sink
      		<- "rockchip-mipi-csi2":1 []
      		<- "rockchip-mipi-csi2":2 []
      		<- "rockchip-mipi-csi2":3 []
      		<- "rockchip-mipi-csi2":4 []
      
      - entity 29: rkcif-mipi-luma (0 pad, 0 link)
                   type Node subtype V4L flags 0
                   device node name /dev/video7
      
      - entity 32: rockchip-mipi-csi2 (5 pads, 29 links)
                   type V4L2 subdev subtype Unknown flags 0
                   device node name /dev/v4l-subdev0
      	pad0: Sink
      		[fmt:Y8_1X8/704x544 field:none
      		 crop.bounds:(0,0)/704x544
      		 crop:(0,0)/704x544]
      		<- "rockchip-csi2-dphy0":1 [ENABLED]
      	pad1: Source
      		-> "stream_cif_mipi_id0":0 [ENABLED]
      		-> "stream_cif_mipi_id1":0 []
      		-> "stream_cif_mipi_id2":0 []
      		-> "stream_cif_mipi_id3":0 []
      		-> "rkcif_tools_id0":0 []
      		-> "rkcif_tools_id1":0 []
      		-> "rkcif_tools_id2":0 []
      	pad2: Source
      		-> "stream_cif_mipi_id0":0 []
      		-> "stream_cif_mipi_id1":0 [ENABLED]
      		-> "stream_cif_mipi_id2":0 []
      		-> "stream_cif_mipi_id3":0 []
      		-> "rkcif_tools_id0":0 []
      		-> "rkcif_tools_id1":0 []
      		-> "rkcif_tools_id2":0 []
      	pad3: Source
      		-> "stream_cif_mipi_id0":0 []
      		-> "stream_cif_mipi_id1":0 []
      		-> "stream_cif_mipi_id2":0 [ENABLED]
      		-> "stream_cif_mipi_id3":0 []
      		-> "rkcif_tools_id0":0 []
      		-> "rkcif_tools_id1":0 []
      		-> "rkcif_tools_id2":0 []
      	pad4: Source
      		-> "stream_cif_mipi_id0":0 []
      		-> "stream_cif_mipi_id1":0 []
      		-> "stream_cif_mipi_id2":0 []
      		-> "stream_cif_mipi_id3":0 [ENABLED]
      		-> "rkcif_tools_id0":0 []
      		-> "rkcif_tools_id1":0 []
      		-> "rkcif_tools_id2":0 []
      
      - entity 38: rockchip-csi2-dphy0 (2 pads, 2 links)
                   type V4L2 subdev subtype Unknown flags 0
                   device node name /dev/v4l-subdev1
      	pad0: Sink
      		[fmt:Y8_1X8/704x544@100/52300 field:none]
      		<- "m00_b_mvcam 2-003b":0 [ENABLED]
      	pad1: Source
      		-> "rockchip-mipi-csi2":0 [ENABLED]
      
      - entity 43: m00_b_mvcam 2-003b (1 pad, 1 link)
                   type V4L2 subdev subtype Sensor flags 0
                   device node name /dev/v4l-subdev2
      	pad0: Source
      		[fmt:Y8_1X8/704x544@100/52300 field:none]
      		-> "rockchip-csi2-dphy0":0 [ENABLED]
      
      
      veye_xummV 1 Reply Last reply Reply Quote 0
      • veye_xummV Offline
        veye_xumm @nkos
        last edited by

        @nkos
        Below is a tutorial on using this camera module on Radxa boards.
        https://wiki.veye.cc/index.php/MV_Camera_on_Radxa_Boards

        Unlike the Raspberry Pi platform, on RK platforms, some preparatory work is required to use our module, which involves configuring the appropriate image parameters using media-ctl.
        However, based on the information you provided, it seems you have already set it up correctly.

        Once this preparation is complete, the process of capturing images is the same as on the Raspberry Pi.

        If you encounter any issues, you can refer to the code example at:
        https://wiki.veye.cc/index.php/MV_Camera_on_Radxa_Boards#Example_of_yavta

        Additionally, we have an open-source client software available for your use and reference.

        https://github.com/veyeimaging/veye_viewer

        Questions will be answered as soon as possible, please be patient.
        如果你使用中文,请直接用中文提问。
        May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          nkos @veye_xumm
          last edited by

          @veye_xumm, thanks a lot, yavta example helped, I can receive images now, topic is resolved

          There are diffirences between rpi and radxa: buffer format, image packing and setting params (I can use approach from i2cwrite.c)

          Both my code and yavta are not able to do some things I can do on rpi (e.g. VIDIOC_S_INPUT), but it seems I can use camera without them

          veye_xummV 1 Reply Last reply Reply Quote 0
          • veye_xummV Offline
            veye_xumm @nkos
            last edited by

            @nkos Cheers!

            Questions will be answered as soon as possible, please be patient.
            如果你使用中文,请直接用中文提问。
            May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post