digiapix: update script and rules for watchdog and IIO

The watchdog and ADC devices were not being modified to belong
to 'digiapix' group, so the examples did not run properly when
ran as a user different than root.

Reported-by: Andreas Burghart <andreas.burghart@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://jira.digi.com/browse/DEL-6581
This commit is contained in:
Hector Palacios 2019-05-07 16:32:08 +02:00
parent 995212a213
commit e467623483
2 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,10 @@
# libdigiapix: configure interfaces so they can be used by group 'digiapix' # libdigiapix: configure interfaces so they can be used by group 'digiapix'
SUBSYSTEM=="i2c-dev", GROUP="digiapix", MODE="0660" SUBSYSTEM=="i2c-dev", GROUP="digiapix", MODE="0660"
SUBSYSTEM=="iio", GROUP="digiapix", MODE="0660"
SUBSYSTEM=="misc", GROUP="digiapix", MODE="0660", ENV{DEVNAME}=="/dev/watchdog"
SUBSYSTEM=="spidev", GROUP="digiapix", MODE="0660" SUBSYSTEM=="spidev", GROUP="digiapix", MODE="0660"
SUBSYSTEM=="watchdog",GROUP="digiapix", MODE="0660"
# #
# Use two different rules for GPIO's. # Use two different rules for GPIO's.
@ -20,3 +23,4 @@ SUBSYSTEM=="gpio", KERNEL=="gpiochip0", ACTION=="add", RUN="/etc/udev/scripts/di
SUBSYSTEM=="gpio", KERNEL!="gpiochip*", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh" SUBSYSTEM=="gpio", KERNEL!="gpiochip*", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh"
SUBSYSTEM=="pwm", ACTION=="add|change", RUN="/etc/udev/scripts/digiapix.sh" SUBSYSTEM=="pwm", ACTION=="add|change", RUN="/etc/udev/scripts/digiapix.sh"
SUBSYSTEM=="iio", ACTION=="add", RUN="/etc/udev/scripts/digiapix.sh"

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2017, Digi International Inc. # Copyright (c) 2017-2019, Digi International Inc.
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
@ -28,8 +28,7 @@ elif basename "${DEVPATH}" | grep -qs "pwmchip[0-9]\+$" && [ "${ACTION}" = "chan
chown root:digiapix /sys${DEVPATH}/${EXPORT} /sys${DEVPATH}/${EXPORT}/* chown root:digiapix /sys${DEVPATH}/${EXPORT} /sys${DEVPATH}/${EXPORT}/*
chmod g+w /sys${DEVPATH}/${EXPORT}/* chmod g+w /sys${DEVPATH}/${EXPORT}/*
else else
# Change group and mode of the sysfs files created whenever a 'gpioX' # Change group and mode of the sysfs files
# is exported
chown -h root:digiapix /sys${DEVPATH}/* chown -h root:digiapix /sys${DEVPATH}/*
chmod g+w /sys${DEVPATH}/* chmod g+w /sys${DEVPATH}/*
fi fi