Important: Please read the Qt Code of Conduct -

[LINUX] QtSensors

  • Hi all,
    I'm trying to understand the QtSensor framework under Linux.

    It's not clear, for me, what kind of sensors are supported by Linux and what kind of API the kernel drivers have to export to user space to be compliant with Qt framework.
    What I understand is that:

    • some sensors need iio:device interface
    • some sensors need Ddbus services

    I don't understand what is needed to develop to add a new sensor to QtSensor framework ( with sensorfw plugin or linux framework plugin ). I don't what to add a new "sensor type" but I would like to integrate, for example, a LightSensor driver into QtSensor framework and use the QtLightSensor class to retrieve data from low-level kernel driver.

    Can you help me to identify the steps needed to add the compatibility of a sensor ?

    Alessandro Biasci.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Guessing from a quick look at the LinuxSysAccelerometer:

    1. Create a new QSensorBackend
    2. Register it LinuxSensorPlugin::registerSensors method

    AFAIK, there's no predefined API needed. You can implement your backend to talk with whatever data source you have at hand (provided that your user has the rights to access these data)

    Or do you mean, create your own plugin and get the QtSensors module to use it ?

  • Hi,
    thanks for your answer. Let me see if I understand what you means. Suppose that I need to add a new that uses iio:device. So, I will add the new sensor to iio:device project, implementing the new sensor's class. Than I will register the new sensor in sensorManager. At the end, I will implement the low-level interface between Qt iio:device sensor and the real-hardware inside iio:sensor:proxy daemon.

    It's right ?

    Best regards,
    Alessandro Biasci.

  • Lifetime Qt Champion

    I haven't used the iio subsystem but for the rest it looks good.

Log in to reply