Updated: May 06, 2022

You can retrieve sensor information on your target from /dev/sensor.

When the Sensor service is running, you can query status and configuration information from /dev/sensor on each sensor that is in your sensor configuration file.

To query this information, use the cat command on the sensor unit for which you want information:

  1. On the target where you're running the Sensor service, confirm that this service recognizes all your sensors.

    Do so by using the ls command on /dev/sensor. For example, you may see the following if your sensor configuration file includes one camera, two interim data sensors, and seven sensors:

    # ls /dev/sensor
    camera1    data1      data2      sensor2    sensor3    sensor4    sensor5    sensor6    sensor7    sensor8
    Each sensor is listed in the format of <sensor_type><sensor_unit> where sensor_type corresponds to the type of sensor (camera, data, or sensor) and sensor_unit corresponds to the enumerator as specified in the sensor configuration file. For example, a configuration file entry of the following:
    begin SENSOR_UNIT_1
        type = usb_camera
        name = front
        position = 0, 0, 0
        direction = 0, 0, 1
        address = /dev/usb/io-usb-otg, -1, -1, -1, -1
    end SENSOR_UNIT_1
    results in camera1 in your list when you use the ls command on /dev/sensor.

    Entries in your interim data configuration file result in data<interim_data_unit>. For example:

        num_buffers = 5
        buffer_size = 65535
        queue_depth = 5
        data_format = SENSOR_FORMAT_USER_DATA
        data_id = 1
        name = tracked_objects
        position = -25.2, 13.25, -7.278
        direction = 128.9, -221, 17.98
    results in data1 in your list when you use the ls command on /dev/sensor.
  2. Use the cat command on the sensor you want to query. For example:
    # cat /dev/sensor/sensor2
    The output from this command depends on the state of the sensor. If the sensor is not streaming any data, you may see this:
    # cat /dev/sensor/sensor2
    Stream Info: refCount 0 status 0 # underflows 0
    If the sensor is streaming data, you may see this:
    # cat /dev/sensor/sensor2 
    Stream Info: refCount 1 status 27 # underflows 0
    Stream State: size 5760 format 20 last time 12ac562326d adjust 0
    Q Info: pid 6094875 key 0 r/w 0 q 0 held 0 # queued 503 # overflows 0
    Pool Info: inUse 1 buf 852a000 phys 260704000 len 115200 refCount 1
    Pool Info: inUse 0 buf 82cb000 phys 260fce000 len 115200 refCount 0
    Pool Info: inUse 0 buf 82e8000 phys 260fb1000 len 115200 refCount 0
    Note: The format and information that you see in the output of your commands may vary depending on the type of sensor and its status.