Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use symlink for camera deviceId
Forum Updated to NodeBB v4.3 + New Features

Use symlink for camera deviceId

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 1.6k Views 2 Watching
  • 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.
  • M Offline
    M Offline
    MHermann
    wrote on last edited by
    #1

    Hi all,

    usually I write:

    camera.deviceId = "/dev/video1"
    

    Now I created some symlinks in my Linux.
    Is it possible to use these symlinks for the camera deviceId?

    camera.deviceId = "/dev/camera_usbport2"
    

    Because every time I try to use these symlinks camera.deviceId is set to "/dev/video0" and not to the symlink or the correct device "/device/video1".

    Kind regards,
    MHermann

    jsulmJ 1 Reply Last reply
    0
    • M MHermann

      Hi all,

      usually I write:

      camera.deviceId = "/dev/video1"
      

      Now I created some symlinks in my Linux.
      Is it possible to use these symlinks for the camera deviceId?

      camera.deviceId = "/dev/camera_usbport2"
      

      Because every time I try to use these symlinks camera.deviceId is set to "/dev/video0" and not to the symlink or the correct device "/device/video1".

      Kind regards,
      MHermann

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @MHermann I don't understand your problem description.
      You created a symlink /dev/camera_usbport2 pointing to /dev/video1, is that correct?
      You assigned

      camera.deviceId = "/dev/camera_usbport2"
      

      right?
      Then what does this mean "Because every time I try to use these symlinks camera.deviceId is set to "/dev/video0""? Where is it set wrongly?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • jsulmJ jsulm

        @MHermann I don't understand your problem description.
        You created a symlink /dev/camera_usbport2 pointing to /dev/video1, is that correct?
        You assigned

        camera.deviceId = "/dev/camera_usbport2"
        

        right?
        Then what does this mean "Because every time I try to use these symlinks camera.deviceId is set to "/dev/video0""? Where is it set wrongly?

        M Offline
        M Offline
        MHermann
        wrote on last edited by
        #3

        @jsulm : Yes, I created a symlink "/dev/camera_usbport2" that points to "/dev/video1".
        Then I try to assign this symlink to the camera:

        camera.deviceId = "/dev/camera_usbport2"
        

        But that does not work.
        If I am looking into camera.deviceId after this line, camera.deviceId is always "/dev/video0".

        I searched for "/dev/video0". I have no line in my code where I assign "/dev/video0" to camera.deviceId.
        Maybe it is using the default camera in case the deviceId is not valid?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          Hi,

          The enumeration is done through GStreamer so it might not care about your symlink at all. If you want to change the name of the device used by the system you may have to modify your device manager in order to change the name used globally.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          1
          • SGaistS SGaist

            Hi,

            The enumeration is done through GStreamer so it might not care about your symlink at all. If you want to change the name of the device used by the system you may have to modify your device manager in order to change the name used globally.

            M Offline
            M Offline
            MHermann
            wrote on last edited by
            #5

            @SGaist : It's not because of changing the name of the device.
            I defined a .rule, so that each USB port has a fix name.
            I want to avoid that one time a camera is video0 and the next time it is video1.

            M 1 Reply Last reply
            0
            • M MHermann

              @SGaist : It's not because of changing the name of the device.
              I defined a .rule, so that each USB port has a fix name.
              I want to avoid that one time a camera is video0 and the next time it is video1.

              M Offline
              M Offline
              MHermann
              wrote on last edited by
              #6

              Or is there an other way to make sure, that a camera, that is connected to USB port 1 has always the same device name?

              jsulmJ 1 Reply Last reply
              0
              • M MHermann

                Or is there an other way to make sure, that a camera, that is connected to USB port 1 has always the same device name?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @MHermann said in Use symlink for camera deviceId:

                Or is there an other way to make sure, that a camera, that is connected to USB port 1 has always the same device name?

                Not using Qt, it's an OS thing

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                M 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @MHermann said in Use symlink for camera deviceId:

                  Or is there an other way to make sure, that a camera, that is connected to USB port 1 has always the same device name?

                  Not using Qt, it's an OS thing

                  M Offline
                  M Offline
                  MHermann
                  wrote on last edited by
                  #8

                  @jsulm :
                  Ok.
                  And what is the reason that

                  camera.deviceId = "/dev/camera_usbport2"
                  

                  is not working?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Likely because an additional symlink doesn't make it an id.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved