Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Code suddenly stops at self.cam = QCamera() , PyQt5.9.2, Qt5.9.3, Python3.5

Code suddenly stops at self.cam = QCamera() , PyQt5.9.2, Qt5.9.3, Python3.5

Scheduled Pinned Locked Moved Unsolved Language Bindings
pyqtpython
55 Posts 4 Posters 19.2k Views
  • 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.
  • X Offline
    X Offline
    Xenoshell
    wrote on last edited by Xenoshell
    #1

    Hello,
    I am working on Ubuntu Mate with an Raspberry Pi 3.
    Here is my code:

    import sys
    from PyQt5 import QtCore , QtWidgets, QtGui, QtMultimedia, QtMultimediaWidgets
    from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
    from PyQt5.QtWidgets import QApplication, QPushButton, QMainWindow
    from PyQt5.QtMultimedia import QCamera, QCameraInfo, QMediaObject, QCameraViewfinderSettings, QCameraImageCapture
    from PyQt5.QtMultimediaWidgets import QCameraViewfinder
    
    
    class Camera(QObject):
        def __init__(self, parent = QObject()):
            super(Camera, self).__init__(parent)
            self.cam = QCamera()
            self.caminfo = QCameraInfo(self.cam)
            self.camvfind = QCameraViewfinder()
            self.camvfindset = QCameraViewfinderSettings()
            self.cammode = self.cam.CaptureMode(2)
            self.camimgcap = QCameraImageCapture(self.cam)
            
    
    if __name__ == '__main__':
        app = QtWidgets.QApplication(sys.argv)
        cam = Camera()
    
        
        sys.exit(app.exec_())
    

    I tested how far the compiler runs and it just stops at self.cam = QCamera(). No error, nothing. I dont know what could be wrong with something simple like QCamera(). Anyone got an idea?

    Greets,

    Xenoshell

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

      Hi,

      How do you know it stopped ?

      From the looks of it, you don't call show on anything so if you are expecting a GUI, you should at least show the QCameraViewfinder.

      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
      • X Offline
        X Offline
        Xenoshell
        wrote on last edited by
        #3

        Oh well hello @SGaist,
        I am just trying some stuff. My full code is here:

                    import sys
        from PyQt5 import QtCore , QtWidgets, QtGui, QtMultimedia, QtMultimediaWidgets
        from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
        from PyQt5.QtWidgets import QApplication, QPushButton, QMainWindow
        from PyQt5.QtMultimedia import QCamera, QCameraInfo, QMediaObject, QCameraViewfinderSettings, QCameraImageCapture
        from PyQt5.QtMultimediaWidgets import QCameraViewfinder
        
        
        class Camera(QObject):
            def __init__(self, parent = QObject()):
                super(Camera, self).__init__(parent)
                self.cam = QCamera()
                print("3")
                self.caminfo = QCameraInfo(self.cam)
                self.camvfind = QCameraViewfinder()
                self.camvfindset = QCameraViewfinderSettings()
                self.cammode = self.cam.CaptureMode(2)
                self.camimgcap = QCameraImageCapture(self.cam)
        
            def iniCamera(self):
                print(self.caminfo.description())
                print(self.caminfo.availableCameras())
                
                
                if self.cam.isCaptureModeSupported(self.cammode):
                    print("Capturemode supported")
            
            def startVid(self):
                self.camimgcap.CaptureDestination(2)
                
                self.camvfind.show()
                
                self.cam.setViewfinder(self.camvfind)
                
                self.cam.setCaptureMode(self.cammode)
                
                self.cam.start()
                
                
        
        if __name__ == '__main__':
            print("1")
            app = QtWidgets.QApplication(sys.argv)
            print("2")
            cam = Camera()
            print("4")
            cam.iniCamera()
            
            cam.startVid()
            
            sys.exit(app.exec_())
        

        I just wanted to show the "important" part. But yeah it basically prints 1 then 2 and not 3 so it obviously just stops there. No error message or anything like that. It just gets stuck

        JonBJ 1 Reply Last reply
        0
        • X Xenoshell

          Oh well hello @SGaist,
          I am just trying some stuff. My full code is here:

                      import sys
          from PyQt5 import QtCore , QtWidgets, QtGui, QtMultimedia, QtMultimediaWidgets
          from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
          from PyQt5.QtWidgets import QApplication, QPushButton, QMainWindow
          from PyQt5.QtMultimedia import QCamera, QCameraInfo, QMediaObject, QCameraViewfinderSettings, QCameraImageCapture
          from PyQt5.QtMultimediaWidgets import QCameraViewfinder
          
          
          class Camera(QObject):
              def __init__(self, parent = QObject()):
                  super(Camera, self).__init__(parent)
                  self.cam = QCamera()
                  print("3")
                  self.caminfo = QCameraInfo(self.cam)
                  self.camvfind = QCameraViewfinder()
                  self.camvfindset = QCameraViewfinderSettings()
                  self.cammode = self.cam.CaptureMode(2)
                  self.camimgcap = QCameraImageCapture(self.cam)
          
              def iniCamera(self):
                  print(self.caminfo.description())
                  print(self.caminfo.availableCameras())
                  
                  
                  if self.cam.isCaptureModeSupported(self.cammode):
                      print("Capturemode supported")
              
              def startVid(self):
                  self.camimgcap.CaptureDestination(2)
                  
                  self.camvfind.show()
                  
                  self.cam.setViewfinder(self.camvfind)
                  
                  self.cam.setCaptureMode(self.cammode)
                  
                  self.cam.start()
                  
                  
          
          if __name__ == '__main__':
              print("1")
              app = QtWidgets.QApplication(sys.argv)
              print("2")
              cam = Camera()
              print("4")
              cam.iniCamera()
              
              cam.startVid()
              
              sys.exit(app.exec_())
          

          I just wanted to show the "important" part. But yeah it basically prints 1 then 2 and not 3 so it obviously just stops there. No error message or anything like that. It just gets stuck

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Xenoshell

          Just to make absolutely sure it's the QCamera(), could you put a print("2.5") after the super() line and before the QCamera() line, please?

          Also, although doubtless it won't make any difference, have you at least tried one of the other QCamera() constructors which take an argument instead, e.g. QCamera(QCamera.FrontFace or QCamera.UnspecifiedPosition)?

          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xenoshell
            wrote on last edited by Xenoshell
            #5

            This is how it looks now. I tried using QCamera(QCamera::Position position, QObject *parent = Q_NULLPTR) with position = 0 which means default. How would i initalise the other constructors? i would have to check the devicename or the camerainfo before actually initialising the camera. Is that even possible?

            def __init__(self, parent = QObject()):
                    super(Camera, self).__init__(parent)
                    print("3")
                    self.cam = QCamera(0)
                    self.caminfo = QCameraInfo(self.cam)
                    self.camvfind = QCameraViewfinder()
                    self.camvfindset = QCameraViewfinderSettings()
                    self.cammode = self.cam.CaptureMode(2)
                    self.camimgcap = QCameraImageCapture(self.cam)
            

            Could it be that i am missing a repository and i need to install something?

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

              Did you try to just list the camera available on your system ?

              Write the python equivalent of:

              QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
              foreach (const QCameraInfo &cameraInfo, cameras) {
                  qDebug() << cameraInfo.deviceName();
              }
              

              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
              • X Offline
                X Offline
                Xenoshell
                wrote on last edited by
                #7

                Ok, somehow when i use sudo python3 qt5.py instead of python3 qt5.py the program doesnt stop at self.cam = QCamera(). I suspect this is just something with ubuntu mate.
                The bad part about this is that the camera window opens for a second and then my whole screen goes black. On the top left side is a underscore that blinks, then my raspberry is locked and i need to type in my password again.
                It almost looks like the terminal is going fullscreen but thats just my guess.
                Also the output for qcamerainfo.availablecameras() is PyQt5.QtMultimedia.QCameraInfo object at 0x72dbe3b0 so i guess i could write QCamera(0x72dbe3b0)?

                Greets,
                Xenoshell

                jsulmJ 1 Reply Last reply
                0
                • X Xenoshell

                  Ok, somehow when i use sudo python3 qt5.py instead of python3 qt5.py the program doesnt stop at self.cam = QCamera(). I suspect this is just something with ubuntu mate.
                  The bad part about this is that the camera window opens for a second and then my whole screen goes black. On the top left side is a underscore that blinks, then my raspberry is locked and i need to type in my password again.
                  It almost looks like the terminal is going fullscreen but thats just my guess.
                  Also the output for qcamerainfo.availablecameras() is PyQt5.QtMultimedia.QCameraInfo object at 0x72dbe3b0 so i guess i could write QCamera(0x72dbe3b0)?

                  Greets,
                  Xenoshell

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

                  @Xenoshell I guess the user you're using on your Ubuntu system does not have access rights to the camera device. You need to check the group of the camera device and add your user to that group.

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

                  JonBJ 1 Reply Last reply
                  1
                  • X Offline
                    X Offline
                    Xenoshell
                    wrote on last edited by Xenoshell
                    #9

                    Is that really the problem if i can just use sudo? I am more worried about the screen just going blank. Can you maybe recommend a good debuggin program? I use geany but it doesnt even has a step option and eclipse is very complicated to set up with python or i just didnt managed to link all the libraries

                    Oh i just ran gdb python3 just to see the error and if it would give more informations. This was the output:

                    Program received signal SIGSEGV, Segmentation fault.
                    0x76fd9dde in ?? () from /lib/ld-linux-armhf.so.3
                    
                    
                    (gdb) bt
                    #0  0x76fd9dde in ?? () from /lib/ld-linux-armhf.so.3
                    #1  0x76fd9df6 in ?? () from /lib/ld-linux-armhf.so.3
                    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
                    

                    So it seems like i have also a segmentation fault with ubuntu mate. I also tried the same program with raspbian and i also got a segmentation fault. The only difference is that it is now another file that gets called.

                    JonBJ 1 Reply Last reply
                    0
                    • X Xenoshell

                      Is that really the problem if i can just use sudo? I am more worried about the screen just going blank. Can you maybe recommend a good debuggin program? I use geany but it doesnt even has a step option and eclipse is very complicated to set up with python or i just didnt managed to link all the libraries

                      Oh i just ran gdb python3 just to see the error and if it would give more informations. This was the output:

                      Program received signal SIGSEGV, Segmentation fault.
                      0x76fd9dde in ?? () from /lib/ld-linux-armhf.so.3
                      
                      
                      (gdb) bt
                      #0  0x76fd9dde in ?? () from /lib/ld-linux-armhf.so.3
                      #1  0x76fd9df6 in ?? () from /lib/ld-linux-armhf.so.3
                      Backtrace stopped: previous frame identical to this frame (corrupt stack?)
                      

                      So it seems like i have also a segmentation fault with ubuntu mate. I also tried the same program with raspbian and i also got a segmentation fault. The only difference is that it is now another file that gets called.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #10

                      @Xenoshell

                      Is that really the problem if i can just use sudo?

                      You really should not run your application as root just to get around this issue! If you expect non-root users to access your camera, you need to set whatever Linux permissions are necessary to allow them access to it.

                      gdb python

                      But you run your application via python3, so there's no point trying to debug python, which under Linux is Python 2.... You need to run gdb python3, and then type run qt5.py....

                      1 Reply Last reply
                      0
                      • X Offline
                        X Offline
                        Xenoshell
                        wrote on last edited by
                        #11

                        The issue with python or python3 was a typo on my part so all the outputs are with python3. If my code is finished i actually planned to put it on autostart so the raspberry pi can only be used as a camera with also some other functions. What should i do if i wanna fix this issue with sudo?

                        1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Xenoshell I guess the user you're using on your Ubuntu system does not have access rights to the camera device. You need to check the group of the camera device and add your user to that group.

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #12

                          @Xenoshell

                          @jsulm said in Code suddenly stops at self.cam = QCamera() , PyQt5.9.2, Qt5.9.3, Python3.5:

                          @Xenoshell I guess the user you're using on your Ubuntu system does not have access rights to the camera device. You need to check the group of the camera device and add your user to that group.

                          What have you done about about what @jsulm suggested?

                          X 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @Xenoshell

                            @jsulm said in Code suddenly stops at self.cam = QCamera() , PyQt5.9.2, Qt5.9.3, Python3.5:

                            @Xenoshell I guess the user you're using on your Ubuntu system does not have access rights to the camera device. You need to check the group of the camera device and add your user to that group.

                            What have you done about about what @jsulm suggested?

                            X Offline
                            X Offline
                            Xenoshell
                            wrote on last edited by
                            #13

                            @JNBarchan What group are you talking about? I am pretty new in python programming or general speaking ubuntu so i dont know how to check the group of the camera device and add me to that group. I set up this Ubuntu Mate myself and i am the only user on the Raspberry Pi besides root

                            JonBJ jsulmJ 2 Replies Last reply
                            0
                            • X Xenoshell

                              @JNBarchan What group are you talking about? I am pretty new in python programming or general speaking ubuntu so i dont know how to check the group of the camera device and add me to that group. I set up this Ubuntu Mate myself and i am the only user on the Raspberry Pi besides root

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by JonB
                              #14

                              @Xenoshell
                              Sorry, I know nothing about "camera device access/groups under Ubuntu" other than what @jsulm wrote. (I use Ubuntu, but not Mate/Pi, and I don't have a camera.) He may return to offer more information, or he may just be giving you a hint as to what you need to look for.

                              If you're new to Ubuntu/Linux, here's just a word about sudo/root user.

                              • Linux (like Windows) has users & groups, who have different permissions. Files and devices have permissions, and if your user/groups doesn't have permission to access something you'll be blocked from it.
                              • Ubuntu doesn't really have a root user that you can log in as, per se, but you can use the sudo command to gain root privileges.
                              • You are saying that if you run your code normally as you, it "hangs" at QCamera().
                              • But if you run it as root via sudo it does not hang.
                              • That would imply you as you lack permission to access the camera (perhaps a device), while root does not have that problem.
                              • Therefore we are thinking there might be a "group" who have access to the camera, and you need to be a member of that group.
                              • You can list all groups with cat /etc/groups. You'd have to look through yours to see if there looks like anything "likely". You add users to groups via adduser user group.
                              • You can run sudo python3 qt5.py if you really want. But it's a really bad idea (haven't got time to list myriad reasons), and I think you'll really regret it as you try to do other stuff in your app.

                              BTW, did you have to install your "camera device/software"? If so did it come with any instructions about this?

                              Your Python code looks OK, and I doubt it will have anything to do with Python/PyQt.

                              I am a little surprised that just plain QCamera() hangs/requires permissions, because you're not even naming a device there, but it might do, or it might try to access the "default" camera device, i don't know. @jsulm / @SGaist know more than me.

                              Try @SGaist's suggestion of just enumerating the available cameras. You're going to need to learn soon how to turn his bit of Qt C++ code into Python to get anywhere much with Qt.... (Not meaning to be rude or disheartening, just a heads-up, but if you think you could just write code QCamera(0x72dbe3b0) in Python or C++ you have quite a bit still to learn before you'll be able to do stuff.)

                              Finally, I don't like the look of gdb python3 itself generating a SIGSEGV, but I don't know exactly what you did, could be a red-herring.

                              Your "screen going black and locking up" might be to do with it requesting a password to access, I really don't know. I assume you've got your camera all working and you can play with it OK outside of your application?

                              X 1 Reply Last reply
                              2
                              • X Xenoshell

                                @JNBarchan What group are you talking about? I am pretty new in python programming or general speaking ubuntu so i dont know how to check the group of the camera device and add me to that group. I set up this Ubuntu Mate myself and i am the only user on the Raspberry Pi besides root

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

                                @Xenoshell Please take a look at https://www.tutorialspoint.com/unix/unix-file-permission.htm
                                Each device is represented by a device file which. To read from such a device you read from the device file to write to the device you write into this file. UNIX/Linux access rights apply to device files as well. So, you have user, user groups and others. You have read/write and execute rights. My guess is that the user you are using on your machine does not have access rights to the camera device file. Usually to solve this you just need to add this user to the correct user group (probably this group is called "video"). To see in which groups your user is member execute the command "groups" in a terminal. To add a user to a group see https://askubuntu.com/questions/79565/how-to-add-existing-user-to-an-existing-group

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

                                1 Reply Last reply
                                1
                                • JonBJ JonB

                                  @Xenoshell
                                  Sorry, I know nothing about "camera device access/groups under Ubuntu" other than what @jsulm wrote. (I use Ubuntu, but not Mate/Pi, and I don't have a camera.) He may return to offer more information, or he may just be giving you a hint as to what you need to look for.

                                  If you're new to Ubuntu/Linux, here's just a word about sudo/root user.

                                  • Linux (like Windows) has users & groups, who have different permissions. Files and devices have permissions, and if your user/groups doesn't have permission to access something you'll be blocked from it.
                                  • Ubuntu doesn't really have a root user that you can log in as, per se, but you can use the sudo command to gain root privileges.
                                  • You are saying that if you run your code normally as you, it "hangs" at QCamera().
                                  • But if you run it as root via sudo it does not hang.
                                  • That would imply you as you lack permission to access the camera (perhaps a device), while root does not have that problem.
                                  • Therefore we are thinking there might be a "group" who have access to the camera, and you need to be a member of that group.
                                  • You can list all groups with cat /etc/groups. You'd have to look through yours to see if there looks like anything "likely". You add users to groups via adduser user group.
                                  • You can run sudo python3 qt5.py if you really want. But it's a really bad idea (haven't got time to list myriad reasons), and I think you'll really regret it as you try to do other stuff in your app.

                                  BTW, did you have to install your "camera device/software"? If so did it come with any instructions about this?

                                  Your Python code looks OK, and I doubt it will have anything to do with Python/PyQt.

                                  I am a little surprised that just plain QCamera() hangs/requires permissions, because you're not even naming a device there, but it might do, or it might try to access the "default" camera device, i don't know. @jsulm / @SGaist know more than me.

                                  Try @SGaist's suggestion of just enumerating the available cameras. You're going to need to learn soon how to turn his bit of Qt C++ code into Python to get anywhere much with Qt.... (Not meaning to be rude or disheartening, just a heads-up, but if you think you could just write code QCamera(0x72dbe3b0) in Python or C++ you have quite a bit still to learn before you'll be able to do stuff.)

                                  Finally, I don't like the look of gdb python3 itself generating a SIGSEGV, but I don't know exactly what you did, could be a red-herring.

                                  Your "screen going black and locking up" might be to do with it requesting a password to access, I really don't know. I assume you've got your camera all working and you can play with it OK outside of your application?

                                  X Offline
                                  X Offline
                                  Xenoshell
                                  wrote on last edited by Xenoshell
                                  #16

                                  @JNBarchan

                                  1. input: cat /etc/group -> output (i am in the group video)
                                    I just post this if i dont see a group i should be in:
                                  root:x:0:
                                  daemon:x:1:
                                  bin:x:2:
                                  sys:x:3:
                                  adm:x:4:syslog,blz
                                  tty:x:5:
                                  disk:x:6:
                                  lp:x:7:
                                  mail:x:8:
                                  news:x:9:
                                  uucp:x:10:
                                  man:x:12:
                                  proxy:x:13:
                                  kmem:x:15:
                                  dialout:x:20:
                                  fax:x:21:
                                  voice:x:22:
                                  cdrom:x:24:blz
                                  floppy:x:25:
                                  tape:x:26:
                                  sudo:x:27:blz
                                  audio:x:29:pulse,blz
                                  dip:x:30:blz
                                  www-data:x:33:
                                  backup:x:34:
                                  operator:x:37:
                                  list:x:38:
                                  irc:x:39:
                                  src:x:40:
                                  gnats:x:41:
                                  shadow:x:42:
                                  utmp:x:43:
                                  video:x:44:blz
                                  sasl:x:45:
                                  plugdev:x:46:blz
                                  staff:x:50:
                                  games:x:60:
                                  users:x:100:
                                  nogroup:x:65534:
                                  systemd-journal:x:101:
                                  systemd-timesync:x:102:
                                  systemd-network:x:103:
                                  systemd-resolve:x:104:
                                  systemd-bus-proxy:x:105:
                                  input:x:106:blz
                                  crontab:x:107:
                                  syslog:x:108:
                                  netdev:x:109:
                                  messagebus:x:110:
                                  uuidd:x:111:
                                  mlocate:x:112:
                                  ssh:x:113:
                                  ssl-cert:x:114:
                                  lpadmin:x:115:blz
                                  lightdm:x:116:
                                  nopasswdlogin:x:117:
                                  ntp:x:118:
                                  avahi-autoipd:x:119:
                                  avahi:x:120:
                                  bluetooth:x:121:
                                  scanner:x:122:saned
                                  colord:x:123:
                                  pulse:x:124:
                                  pulse-access:x:125:
                                  rtkit:x:126:
                                  saned:x:127:
                                  whoopsie:x:128:
                                  gpio:x:999:blz
                                  i2c:x:998:blz
                                  spi:x:997:blz
                                  blz:x:1000:
                                  sambashare:x:129:blz
                                  
                                  
                                  QCamera(0x72dbe3b0)
                                  

                                  From the QCamera documentation: "QCamera::QCamera(const QByteArray &deviceName, QObject *parent = Q_NULLPTR) Construct a QCamera from deviceName and parent."
                                  Correct me if i'm wrong but that means if i know the deviceName that i can just initialize the Camera with QCamera(0x72dbe3b0).
                                  3)
                                  gdb is a debug program which can be used for segmentation fault errors.

                                  @jsulm
                                  4)
                                  Input:

                                  ls -l /home/blz/Schreibtisch/qt5.py
                                  

                                  Output:
                                  -rwxrwxrwx 1 blz blz 1537 Dez 7 10:33 /home/blz/Schreibtisch/qt5.py
                                  I guess that means that i have full accessibility to qt5.py

                                  Thanks for your help. I appreciate your feedback.

                                  Greets

                                  jsulmJ JonBJ 2 Replies Last reply
                                  0
                                  • X Xenoshell

                                    @JNBarchan

                                    1. input: cat /etc/group -> output (i am in the group video)
                                      I just post this if i dont see a group i should be in:
                                    root:x:0:
                                    daemon:x:1:
                                    bin:x:2:
                                    sys:x:3:
                                    adm:x:4:syslog,blz
                                    tty:x:5:
                                    disk:x:6:
                                    lp:x:7:
                                    mail:x:8:
                                    news:x:9:
                                    uucp:x:10:
                                    man:x:12:
                                    proxy:x:13:
                                    kmem:x:15:
                                    dialout:x:20:
                                    fax:x:21:
                                    voice:x:22:
                                    cdrom:x:24:blz
                                    floppy:x:25:
                                    tape:x:26:
                                    sudo:x:27:blz
                                    audio:x:29:pulse,blz
                                    dip:x:30:blz
                                    www-data:x:33:
                                    backup:x:34:
                                    operator:x:37:
                                    list:x:38:
                                    irc:x:39:
                                    src:x:40:
                                    gnats:x:41:
                                    shadow:x:42:
                                    utmp:x:43:
                                    video:x:44:blz
                                    sasl:x:45:
                                    plugdev:x:46:blz
                                    staff:x:50:
                                    games:x:60:
                                    users:x:100:
                                    nogroup:x:65534:
                                    systemd-journal:x:101:
                                    systemd-timesync:x:102:
                                    systemd-network:x:103:
                                    systemd-resolve:x:104:
                                    systemd-bus-proxy:x:105:
                                    input:x:106:blz
                                    crontab:x:107:
                                    syslog:x:108:
                                    netdev:x:109:
                                    messagebus:x:110:
                                    uuidd:x:111:
                                    mlocate:x:112:
                                    ssh:x:113:
                                    ssl-cert:x:114:
                                    lpadmin:x:115:blz
                                    lightdm:x:116:
                                    nopasswdlogin:x:117:
                                    ntp:x:118:
                                    avahi-autoipd:x:119:
                                    avahi:x:120:
                                    bluetooth:x:121:
                                    scanner:x:122:saned
                                    colord:x:123:
                                    pulse:x:124:
                                    pulse-access:x:125:
                                    rtkit:x:126:
                                    saned:x:127:
                                    whoopsie:x:128:
                                    gpio:x:999:blz
                                    i2c:x:998:blz
                                    spi:x:997:blz
                                    blz:x:1000:
                                    sambashare:x:129:blz
                                    
                                    
                                    QCamera(0x72dbe3b0)
                                    

                                    From the QCamera documentation: "QCamera::QCamera(const QByteArray &deviceName, QObject *parent = Q_NULLPTR) Construct a QCamera from deviceName and parent."
                                    Correct me if i'm wrong but that means if i know the deviceName that i can just initialize the Camera with QCamera(0x72dbe3b0).
                                    3)
                                    gdb is a debug program which can be used for segmentation fault errors.

                                    @jsulm
                                    4)
                                    Input:

                                    ls -l /home/blz/Schreibtisch/qt5.py
                                    

                                    Output:
                                    -rwxrwxrwx 1 blz blz 1537 Dez 7 10:33 /home/blz/Schreibtisch/qt5.py
                                    I guess that means that i have full accessibility to qt5.py

                                    Thanks for your help. I appreciate your feedback.

                                    Greets

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

                                    @Xenoshell 1. Well, the question is: what is the group of the camera device file?
                                    2. You can use this code to see all the camera device names (http://doc.qt.io/qt-5/qcamera.html):

                                    QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
                                    foreach (const QCameraInfo &cameraInfo, cameras) {
                                        qDebug() << cameraInfo.deviceName();
                                    }
                                    
                                    1. Yes, you can use GDB to get more information if your app crashes
                                    2. Everyone has full access to Schreibtisch/qt5.py. Not sure how is this related?

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

                                    1 Reply Last reply
                                    0
                                    • X Xenoshell

                                      @JNBarchan

                                      1. input: cat /etc/group -> output (i am in the group video)
                                        I just post this if i dont see a group i should be in:
                                      root:x:0:
                                      daemon:x:1:
                                      bin:x:2:
                                      sys:x:3:
                                      adm:x:4:syslog,blz
                                      tty:x:5:
                                      disk:x:6:
                                      lp:x:7:
                                      mail:x:8:
                                      news:x:9:
                                      uucp:x:10:
                                      man:x:12:
                                      proxy:x:13:
                                      kmem:x:15:
                                      dialout:x:20:
                                      fax:x:21:
                                      voice:x:22:
                                      cdrom:x:24:blz
                                      floppy:x:25:
                                      tape:x:26:
                                      sudo:x:27:blz
                                      audio:x:29:pulse,blz
                                      dip:x:30:blz
                                      www-data:x:33:
                                      backup:x:34:
                                      operator:x:37:
                                      list:x:38:
                                      irc:x:39:
                                      src:x:40:
                                      gnats:x:41:
                                      shadow:x:42:
                                      utmp:x:43:
                                      video:x:44:blz
                                      sasl:x:45:
                                      plugdev:x:46:blz
                                      staff:x:50:
                                      games:x:60:
                                      users:x:100:
                                      nogroup:x:65534:
                                      systemd-journal:x:101:
                                      systemd-timesync:x:102:
                                      systemd-network:x:103:
                                      systemd-resolve:x:104:
                                      systemd-bus-proxy:x:105:
                                      input:x:106:blz
                                      crontab:x:107:
                                      syslog:x:108:
                                      netdev:x:109:
                                      messagebus:x:110:
                                      uuidd:x:111:
                                      mlocate:x:112:
                                      ssh:x:113:
                                      ssl-cert:x:114:
                                      lpadmin:x:115:blz
                                      lightdm:x:116:
                                      nopasswdlogin:x:117:
                                      ntp:x:118:
                                      avahi-autoipd:x:119:
                                      avahi:x:120:
                                      bluetooth:x:121:
                                      scanner:x:122:saned
                                      colord:x:123:
                                      pulse:x:124:
                                      pulse-access:x:125:
                                      rtkit:x:126:
                                      saned:x:127:
                                      whoopsie:x:128:
                                      gpio:x:999:blz
                                      i2c:x:998:blz
                                      spi:x:997:blz
                                      blz:x:1000:
                                      sambashare:x:129:blz
                                      
                                      
                                      QCamera(0x72dbe3b0)
                                      

                                      From the QCamera documentation: "QCamera::QCamera(const QByteArray &deviceName, QObject *parent = Q_NULLPTR) Construct a QCamera from deviceName and parent."
                                      Correct me if i'm wrong but that means if i know the deviceName that i can just initialize the Camera with QCamera(0x72dbe3b0).
                                      3)
                                      gdb is a debug program which can be used for segmentation fault errors.

                                      @jsulm
                                      4)
                                      Input:

                                      ls -l /home/blz/Schreibtisch/qt5.py
                                      

                                      Output:
                                      -rwxrwxrwx 1 blz blz 1537 Dez 7 10:33 /home/blz/Schreibtisch/qt5.py
                                      I guess that means that i have full accessibility to qt5.py

                                      Thanks for your help. I appreciate your feedback.

                                      Greets

                                      JonBJ Offline
                                      JonBJ Offline
                                      JonB
                                      wrote on last edited by
                                      #18

                                      @Xenoshell

                                      Nothing looks interesting in your groups. Never mind, it was only an idea of @jsulm's, maybe or maybe not relevant.

                                      Correct me if i'm wrong but that means if i know the deviceName that i can just initialize the Camera with QCamera(0x72dbe3b0).

                                      It's so wrong. Fortunately in C++ it won't compile, in Python I hope it will spit it back at you. You really need to understand why this is plain wrong in any language/circumstance, if you're new to programming. You must pass a string which has the value of a device name to QCamera(), e.g. QCamera("camera-device-name"), or a device name picked up from a QCameraInfo.deviceName() (which itself is a string).

                                      Please try @jsulm's suggestion of enumerating the available cameras you have. In Python it'll be like:

                                      for cameraInfo in QCameraInfo.availableCameras():
                                          print(cameraInfo.deviceName())
                                      

                                      QString QCameraInfo::deviceName() const
                                      Returns the device name of the camera
                                      This is a unique ID to identify the camera and may not be human-readable.

                                      So a device name might come out like abc1234 (I don't know 'coz I haven't got one to test). Then the actual Linux device will be /dev/abc1234, or something like that. We want you to ls -l that, and look at its owner & group permissions, and see if you have access to it under your own user, not sudo. This is what we mean about "permissions", not the permissions you list for /home/blz/Schreibtisch/qt5.py.

                                      X 1 Reply Last reply
                                      0
                                      • JonBJ JonB

                                        @Xenoshell

                                        Nothing looks interesting in your groups. Never mind, it was only an idea of @jsulm's, maybe or maybe not relevant.

                                        Correct me if i'm wrong but that means if i know the deviceName that i can just initialize the Camera with QCamera(0x72dbe3b0).

                                        It's so wrong. Fortunately in C++ it won't compile, in Python I hope it will spit it back at you. You really need to understand why this is plain wrong in any language/circumstance, if you're new to programming. You must pass a string which has the value of a device name to QCamera(), e.g. QCamera("camera-device-name"), or a device name picked up from a QCameraInfo.deviceName() (which itself is a string).

                                        Please try @jsulm's suggestion of enumerating the available cameras you have. In Python it'll be like:

                                        for cameraInfo in QCameraInfo.availableCameras():
                                            print(cameraInfo.deviceName())
                                        

                                        QString QCameraInfo::deviceName() const
                                        Returns the device name of the camera
                                        This is a unique ID to identify the camera and may not be human-readable.

                                        So a device name might come out like abc1234 (I don't know 'coz I haven't got one to test). Then the actual Linux device will be /dev/abc1234, or something like that. We want you to ls -l that, and look at its owner & group permissions, and see if you have access to it under your own user, not sudo. This is what we mean about "permissions", not the permissions you list for /home/blz/Schreibtisch/qt5.py.

                                        X Offline
                                        X Offline
                                        Xenoshell
                                        wrote on last edited by Xenoshell
                                        #19

                                        @JNBarchan, @jsulm
                                        The output for the for-loop is:

                                        /dev/video0
                                        

                                        Here the output is:

                                        blz@blz-desktop:~$ ls -l /dev/video0
                                        crw-rw----+ 1 root video 81, 0 Dez 11 10:55 /dev/video0
                                        
                                        

                                        To me it looks like i dont have the permission to everything.

                                        jsulmJ JonBJ 2 Replies Last reply
                                        0
                                        • X Xenoshell

                                          @JNBarchan, @jsulm
                                          The output for the for-loop is:

                                          /dev/video0
                                          

                                          Here the output is:

                                          blz@blz-desktop:~$ ls -l /dev/video0
                                          crw-rw----+ 1 root video 81, 0 Dez 11 10:55 /dev/video0
                                          
                                          

                                          To me it looks like i dont have the permission to everything.

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

                                          @Xenoshell Add yourself to the video group if it's not already the case

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

                                          X 1 Reply Last reply
                                          2

                                          • Login

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