Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. VOXL Compute & Autopilot
  3. VOXL
  4. Detect Camera Attached

Detect Camera Attached

Scheduled Pinned Locked Moved VOXL
12 Posts 4 Posters 1.9k Views 1 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.
  • tomT Offline
    tomT Offline
    tom
    admin
    wrote on last edited by
    #2

    @wilkinsaf Others will know better but I believe when the cameras have enumerated they will show up in /run/mpa

    SmittyHalibutS 1 Reply Last reply
    0
    • SmittyHalibutS Offline
      SmittyHalibutS Offline
      SmittyHalibut
      wrote on last edited by
      #3

      If voxl-camera-server is up and running, you'll see a directory for the camera in /run/mpa/[camera name].

      Otherwise, I'd look in the source code for voxl-configure-cameras to see wha tit does for detection.

      1 Reply Last reply
      0
      • tomT tom

        @wilkinsaf Others will know better but I believe when the cameras have enumerated they will show up in /run/mpa

        SmittyHalibutS Offline
        SmittyHalibutS Offline
        SmittyHalibut
        wrote on last edited by
        #4

        @tom /run/mpa directories are setup by voxl-camera-server so it has to be configured and running first. And, I'm not sure it verifies the presence of the camera before setting up the MPA hierarchy. I could be wrong, I'm relatively new here. 🙂

        1 Reply Last reply
        0
        • tomT Offline
          tomT Offline
          tom
          admin
          wrote on last edited by
          #5

          @SmittyHalibut That's correct, I made the assumption that voxl-camera-server was being used which could be wrong. There's also https://docs.modalai.com/voxl-uvc-server/

          wilkinsafW 1 Reply Last reply
          0
          • tomT tom

            @SmittyHalibut That's correct, I made the assumption that voxl-camera-server was being used which could be wrong. There's also https://docs.modalai.com/voxl-uvc-server/

            wilkinsafW Offline
            wilkinsafW Offline
            wilkinsaf
            ModalAI Team
            wrote on last edited by
            #6

            @tom Right, but that just handles the UVC cameras correct?

            I am trying to detect the tracking, hi-res, and stereo cameras that are plugging directly into the J* ports on the board.
            I wonder if I have to do something like attempt to read from them to see if they are there.

            I will keep looking in the source code

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              Hi all,

              One of the features in the works for voxl-camera-server is a mode to only check the hal module directly for the available cameras. Since we're not sure exactly when we're going to be able to have this release up and this has been a very asked for feature, I'm going to extract that code real quick from our internal branch and publish a small executable that will list the cameras that are plugged into the mipi ports. I'll have a link for you if you give me 15-20 minutes.

              wilkinsafW 1 Reply Last reply
              0
              • ? A Former User

                Hi all,

                One of the features in the works for voxl-camera-server is a mode to only check the hal module directly for the available cameras. Since we're not sure exactly when we're going to be able to have this release up and this has been a very asked for feature, I'm going to extract that code real quick from our internal branch and publish a small executable that will list the cameras that are plugged into the mipi ports. I'll have a link for you if you give me 15-20 minutes.

                wilkinsafW Offline
                wilkinsafW Offline
                wilkinsaf
                ModalAI Team
                wrote on last edited by
                #8

                @Alex-Gardner Oh ok cool.

                Thanks for doing that Alex. I was going to say, I know where that hal code lives. Just having you verify that for me is great help.
                I can work on that code in the branch you post and make a pull request once i make some progress on it.

                Is there a TODO list left before release is acceptable?

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by A Former User
                  #9

                  The package (voxl-list-cameras) is live on our dev repo. you can manually download it from there or on voxl run:
                  voxl-configure-opkg dev

                  opkg update
                  opkg install voxl-list-cameras

                  There will be a command voxl-list-cameras that will list the available cameras and their resolutions from the hal module, and return the number of cameras connected. Additionally, since this is a temporary package that won't have a gitlab repo, the source for the executable is in /etc/modalai/voxl-list-cameras-src/ . This tool is pretty crude at the moment, the final design will filter out resolutions that aren't actually available/sort by format, but this is enough for you to tell which cameras are connected. I can tell you that in it's final form, this will be the behavior of running voxl-camera-server -l or voxl-camera-server --list.

                  As for the time frame/publicity of the other branch, it's hard to know, this feature was added as part of a major restructure of camera server for our rb5 platform that will be backported to voxl once proper behavior has been verified on both platforms. Until then, you can use this tool or make your own program that uses it (the entire source for the executable is around 100 lines of c even with comments/license, so if you want to make your own for whatever test bench you're using it shouldn't be too hard).

                  Lastly, I can give you a hint that if you're looking at the source and trying to filter different cameras, you can modify the source around the print loop:

                  printf("Available resolutions for camera: %d:\n", camId);
                  for (size_t j = 0; j < entry.count; j+=4)
                  {
                      if (entry.data.i32[j + 3] == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT)
                      {
                          printf("\t%d x %d\n", entry.data.i32[j+1], entry.data.i32[j+2]);
                      }
                  }
                  

                  to also check entry.data.i32[j] which will be the format of that resolution (which is why you will see duplicates in the available resolutions, same resolutions in different formats). The main ones that you'll see are HAL_PIXEL_FORMAT_YCbCr_420_888 for YUV data, HAL_PIXEL_FORMAT_RAW10 for raw grayscale (note that some of our drivers actually output raw8 data not raw10, you can see the check for this in camera server), or HAL_PIXEL_FORMAT_BLOB for data coming out of the PMD TOF sensor.

                  Hope that's all a good starting point for what you're trying, let me know if you have any additional questions

                  wilkinsafW 2 Replies Last reply
                  1
                  • ? A Former User

                    The package (voxl-list-cameras) is live on our dev repo. you can manually download it from there or on voxl run:
                    voxl-configure-opkg dev

                    opkg update
                    opkg install voxl-list-cameras

                    There will be a command voxl-list-cameras that will list the available cameras and their resolutions from the hal module, and return the number of cameras connected. Additionally, since this is a temporary package that won't have a gitlab repo, the source for the executable is in /etc/modalai/voxl-list-cameras-src/ . This tool is pretty crude at the moment, the final design will filter out resolutions that aren't actually available/sort by format, but this is enough for you to tell which cameras are connected. I can tell you that in it's final form, this will be the behavior of running voxl-camera-server -l or voxl-camera-server --list.

                    As for the time frame/publicity of the other branch, it's hard to know, this feature was added as part of a major restructure of camera server for our rb5 platform that will be backported to voxl once proper behavior has been verified on both platforms. Until then, you can use this tool or make your own program that uses it (the entire source for the executable is around 100 lines of c even with comments/license, so if you want to make your own for whatever test bench you're using it shouldn't be too hard).

                    Lastly, I can give you a hint that if you're looking at the source and trying to filter different cameras, you can modify the source around the print loop:

                    printf("Available resolutions for camera: %d:\n", camId);
                    for (size_t j = 0; j < entry.count; j+=4)
                    {
                        if (entry.data.i32[j + 3] == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT)
                        {
                            printf("\t%d x %d\n", entry.data.i32[j+1], entry.data.i32[j+2]);
                        }
                    }
                    

                    to also check entry.data.i32[j] which will be the format of that resolution (which is why you will see duplicates in the available resolutions, same resolutions in different formats). The main ones that you'll see are HAL_PIXEL_FORMAT_YCbCr_420_888 for YUV data, HAL_PIXEL_FORMAT_RAW10 for raw grayscale (note that some of our drivers actually output raw8 data not raw10, you can see the check for this in camera server), or HAL_PIXEL_FORMAT_BLOB for data coming out of the PMD TOF sensor.

                    Hope that's all a good starting point for what you're trying, let me know if you have any additional questions

                    wilkinsafW Offline
                    wilkinsafW Offline
                    wilkinsaf
                    ModalAI Team
                    wrote on last edited by
                    #10

                    @Alex-Gardner Thank you for that information!

                    I was able to easily get it installed and working. However, I am trying to modify the source code for it.

                    My question is: did you compile this on the VOXL board or through voxl-emulator/voxl-hexagon/etc...

                    I want to make sure my environment is the same. Thanks

                    1 Reply Last reply
                    0
                    • wilkinsafW Offline
                      wilkinsafW Offline
                      wilkinsaf
                      ModalAI Team
                      wrote on last edited by
                      #11

                      Nevermind. Forgot docker does not save image state automatically and I had to reinstall dependencies.

                      I swear I fix these issue 5 minutes after I post things

                      1 Reply Last reply
                      0
                      • ? A Former User

                        The package (voxl-list-cameras) is live on our dev repo. you can manually download it from there or on voxl run:
                        voxl-configure-opkg dev

                        opkg update
                        opkg install voxl-list-cameras

                        There will be a command voxl-list-cameras that will list the available cameras and their resolutions from the hal module, and return the number of cameras connected. Additionally, since this is a temporary package that won't have a gitlab repo, the source for the executable is in /etc/modalai/voxl-list-cameras-src/ . This tool is pretty crude at the moment, the final design will filter out resolutions that aren't actually available/sort by format, but this is enough for you to tell which cameras are connected. I can tell you that in it's final form, this will be the behavior of running voxl-camera-server -l or voxl-camera-server --list.

                        As for the time frame/publicity of the other branch, it's hard to know, this feature was added as part of a major restructure of camera server for our rb5 platform that will be backported to voxl once proper behavior has been verified on both platforms. Until then, you can use this tool or make your own program that uses it (the entire source for the executable is around 100 lines of c even with comments/license, so if you want to make your own for whatever test bench you're using it shouldn't be too hard).

                        Lastly, I can give you a hint that if you're looking at the source and trying to filter different cameras, you can modify the source around the print loop:

                        printf("Available resolutions for camera: %d:\n", camId);
                        for (size_t j = 0; j < entry.count; j+=4)
                        {
                            if (entry.data.i32[j + 3] == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT)
                            {
                                printf("\t%d x %d\n", entry.data.i32[j+1], entry.data.i32[j+2]);
                            }
                        }
                        

                        to also check entry.data.i32[j] which will be the format of that resolution (which is why you will see duplicates in the available resolutions, same resolutions in different formats). The main ones that you'll see are HAL_PIXEL_FORMAT_YCbCr_420_888 for YUV data, HAL_PIXEL_FORMAT_RAW10 for raw grayscale (note that some of our drivers actually output raw8 data not raw10, you can see the check for this in camera server), or HAL_PIXEL_FORMAT_BLOB for data coming out of the PMD TOF sensor.

                        Hope that's all a good starting point for what you're trying, let me know if you have any additional questions

                        wilkinsafW Offline
                        wilkinsafW Offline
                        wilkinsaf
                        ModalAI Team
                        wrote on last edited by
                        #12

                        @Alex-Gardner

                        I see why you created a separate tool for checking the connected cameras as the code in that tool is implemented in much lower level files on voxl-camera-server.

                        I did quickly put together a flag option that would list cameras if they are setup in /etc/modalai/voxl-camera-server.conf

                        I created a pull request here

                        Let me know if this is useful. If the needed feature requires all cameras to be listed let me know and I can see what I can do.

                        Also, I was trying to find a way to get some form of id off of the cameras, but I see in code that we compare the resolutions and that is how we distinguish a stereo from a tracking. Was trying to find some HAL3 data member that could give more of an "id". I found this ANDROID_REQUEST_ID variable in this documentation, but I could not get it working

                        1 Reply Last reply
                        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
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        ModalAI
                        Categories Recent Tags ModalAI.com Docs
                        © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups