0.2.0: allow direct IO for clients in priv_peripheralio group 34/260034/5 accepted/tizen/unified/20210630.005908 submit/tizen/20210629.012223 submit/tizen/20210629.111329
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 17 Jun 2021 22:38:19 +0000 (00:38 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 29 Jun 2021 01:03:29 +0000 (01:03 +0000)
The priv_periperalio will be granted automatically for all apps having the
http://tizen.org/privilege/peripheralio privilege.

This bumps up the release number to 0.2.0.

Change-Id: I35bb10d72820c5696aed6842fd2ee92a51aa9bab

packaging/capi-system-peripheral-io.spec
packaging/peripheral-io.tmpfiles.conf [new file with mode: 0644]
packaging/peripheral-io.udev.rules [new file with mode: 0644]

index be714b3..60f874c 100644 (file)
@@ -1,11 +1,14 @@
 Name:       capi-system-peripheral-io
 Summary:    Tizen Peripheral Input & Output library
-Version:    0.1.0
+Version:    0.2.0
 Release:    0
 Group:      System & System Tools
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1:    %{name}.manifest
+Source10:   peripheral-io.udev.rules
+Source11:   peripheral-io.tmpfiles.conf
+Conflicts:  peripheral-bus
 BuildRequires:  awk
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
@@ -44,6 +47,8 @@ Tizen Peripheral Input & Output Test Programs (test)
 %prep
 %setup -q
 cp %{SOURCE1} ./%{name}.manifest
+cp %{SOURCE10} .
+cp %{SOURCE11} .
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
@@ -51,6 +56,10 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 
 %install
 %make_install
+mkdir -p %{buildroot}/usr/lib/tmpfiles.d
+install -m0644 peripheral-io.tmpfiles.conf %{buildroot}/usr/lib/tmpfiles.d/peripheral-io.conf
+mkdir -p %{buildroot}/usr/lib/udev/rules.d
+install -m0644 peripheral-io.udev.rules %{buildroot}/usr/lib/udev/rules.d/90-peripheral-io.rules
 
 %post -p /sbin/ldconfig
 
@@ -60,6 +69,8 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_libdir}/lib%{name}.so*
+/usr/lib/tmpfiles.d/peripheral-io.conf
+/usr/lib/udev/rules.d/90-peripheral-io.rules
 %license LICENSE.APLv2
 
 %files devel
diff --git a/packaging/peripheral-io.tmpfiles.conf b/packaging/peripheral-io.tmpfiles.conf
new file mode 100644 (file)
index 0000000..18c1a51
--- /dev/null
@@ -0,0 +1,7 @@
+# Type Path                                            Mode UID  GID           Age     Argument
+z      /sys/class/gpio/export                          0220 root priv_peripheralio     -
+t      /sys/class/gpio/export                          -       -       -       -       security.SMACK64="*"
+z      /sys/class/gpio/unexport                        0220 root priv_peripheralio     -
+t      /sys/class/gpio/unexport                        -       -       -       -       security.SMACK64="*"
+z      /sys/devices/platform/soc/*.gpio/gpiochip*      0775 root priv_peripheralio     -
+t      /sys/devices/platform/soc/*.gpio/gpiochip*      -       -       -       -       security.SMACK64="*"
diff --git a/packaging/peripheral-io.udev.rules b/packaging/peripheral-io.udev.rules
new file mode 100644 (file)
index 0000000..b36aeb2
--- /dev/null
@@ -0,0 +1,35 @@
+SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/value",\
+ RUN+="/bin/chmod 0660 /sys%p/value",\
+ RUN+="/bin/chsmack -a * /sys%p/value"
+SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/direction",\
+ RUN+="/bin/chmod 0660 /sys%p/direction",\
+ RUN+="/bin/chsmack -a * /sys%p/direction"
+SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/edge",\
+ RUN+="/bin/chmod 0660 /sys%p/edge",\
+ RUN+="/bin/chsmack -a * /sys%p/edge"
+
+SUBSYSTEM=="pwm", KERNEL=="pwm*", ACTION=="change",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/%E{EXPORT}/period",\
+ RUN+="/bin/chmod 0660 /sys%p/%E{EXPORT}/period",\
+ RUN+="/bin/chsmack -a * /sys%p/%E{EXPORT}/period"
+SUBSYSTEM=="pwm", KERNEL=="pwm*", ACTION=="change",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/%E{EXPORT}/duty_cycle",\
+ RUN+="/bin/chmod 0660 /sys%p/%E{EXPORT}/duty_cycle",\
+ RUN+="/bin/chsmack -a * /sys%p/%E{EXPORT}/duty_cycle"
+SUBSYSTEM=="pwm", KERNEL=="pwm*", ACTION=="change",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/%E{EXPORT}/polarity",\
+ RUN+="/bin/chmod 0660 /sys%p/%E{EXPORT}/polarity",\
+ RUN+="/bin/chsmack -a * /sys%p/%E{EXPORT}/polarity"
+SUBSYSTEM=="pwm", KERNEL=="pwm*", ACTION=="change",\
+ RUN+="/bin/chown root:priv_peripheralio /sys%p/%E{EXPORT}/enable",\
+ RUN+="/bin/chmod 0660 /sys%p/%E{EXPORT}/enable",\
+ RUN+="/bin/chsmack -a * /sys%p/%E{EXPORT}/enable"
+
+SUBSYSTEM=="i2c-dev", KERNEL=="i2c-*", ACTION=="add", \
+ MODE="0660", OWNER="root", GROUP="priv_peripheralio", SECLABEL{smack}="*"
+
+SUBSYSTEM=="spidev", KERNEL=="spidev*.*", ACTION=="add", \
+ MODE="0660", OWNER="root", GROUP="priv_peripheralio", SECLABEL{smack}="*"