eclipse-kura / kura

Eclipse Kura™ is a versatile framework to supercharge your edge devices, streamlining the process of configuring your gateway, connecting sensors, and IoT devices to seamlessly collect, process, and send data to the cloud.
https://eclipse.dev/kura/
Eclipse Public License 2.0
506 stars 312 forks source link

feat(linux.gpio): Added support to gpio symlinks #5246

Closed pierantoniomerlino closed 5 months ago

pierantoniomerlino commented 5 months ago

Note: We are using the Conventional Commits convention for our pull request titles. Please take a look at the PR title format document for the supported types and scopes.

This PR adds the support to symlinks in the jdk.dio.properties file.

Related Issue: This PR fixes/closes N/A

Description of the solution adopted: The current implementation of the GPIOService parses the jdk.dio.properties and reads the GPIO indexes/numbers. The entry looks like:

123 = deviceType: gpio.GPIOPin, pinNumber:123, name:GPIO123

This PR allows to set a symlink instead of a pin number in the configuration file:

/dev/dio1 = deviceType: gpio.GPIOPin, name:DIGITAL_INPUT1

where the /dev/dio1 points to /sys/class/gpio/gpioXYZ. The GPIOService implementation will follow the symlink and read the pin number (XYZ) from the path.