summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang kim <wchang.kim@samsung.com>2016-11-28 14:59:12 +0900
committerwchang kim <wchang.kim@samsung.com>2016-11-29 08:18:56 +0900
commit4a834faa9656c02c3eea6a1a0307d8bcf6f4b340 (patch)
tree998dff0cc4ccde1343a6c485aa9014033bd8c913
parent512fc76fbd4b4e1904cbdc5bcbaf1af753f450b3 (diff)
downloadsystem-plugin-4a834faa9656c02c3eea6a1a0307d8bcf6f4b340.tar.gz
system-plugin-4a834faa9656c02c3eea6a1a0307d8bcf6f4b340.tar.bz2
system-plugin-4a834faa9656c02c3eea6a1a0307d8bcf6f4b340.zip
It is required for Tizen IoT minimal set. It includes a udev ruls of sdb, a shell script to run sdbd and XDG_RUNTIME_DIR environment. Change-Id: I24d85c2351c50787eee7b86f0f37ebb877e13d0e
-rw-r--r--packaging/system-plugin.spec23
-rw-r--r--rules/99-sdb-switch.rules4
-rw-r--r--scripts/headless_env.sh4
-rw-r--r--scripts/sdb-mode.sh27
4 files changed, 55 insertions, 3 deletions
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec
index 2887f7a..d65ac9e 100644
--- a/packaging/system-plugin.spec
+++ b/packaging/system-plugin.spec
@@ -15,7 +15,6 @@ Source2: liblazymount.manifest
Source3: systemd-user-helper.manifest
Requires(post): /usr/bin/systemctl
-Requires(post): /usr/bin/vconftool
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libtzplatform-config)
@@ -68,6 +67,7 @@ This package provides Circle specific system configuration files.
%package -n liblazymount
Summary: Library for lazy mount feature
License: Apache-2.0
+Requires(post): /usr/bin/vconftool
Requires: vconf
Requires: liblazymount = %{version}
@@ -113,6 +113,14 @@ BuildArch: noarch
%description init_wrapper
This package provides init.wrapper and init symlink file for init wrapper booting.
+%package headless
+Summary: Support headless device.
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description headless
+This package provides the functions for headless device.
+
%prep
%setup -q
@@ -197,6 +205,13 @@ ln -s %{_datadir}/upgrade %{buildroot}/system-update
mkdir -p %{buildroot}%{_sbindir}
install -m 755 scripts/init.wrapper %{buildroot}%{_sbindir}
+# headless
+mkdir -p %{buildroot}%{_sbindir}
+install -m 755 scripts/sdb-mode.sh %{buildroot}%{_bindir}
+mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d/
+install -m 644 rules/99-sdb-switch.rules %{buildroot}%{_prefix}/lib/udev/rules.d/
+mkdir -p %{buildroot}%{_sysconfdir}/profile.d
+install -m 755 scripts/headless_env.sh %{buildroot}%{_sysconfdir}/profile.d
%clean
rm -rf %{buildroot}
@@ -332,3 +347,9 @@ echo 'RemainAfterExit=yes' >> /usr/lib/systemd/system/user\@.service
%posttrans init_wrapper
rm -f /sbin/init
ln -s /sbin/init.wrapper /sbin/init
+
+
+%files headless
+%{_bindir}/sdb-mode.sh
+%{_prefix}/lib/udev/rules.d/99-sdb-switch.rules
+%{_sysconfdir}/profile.d/headless_env.sh
diff --git a/rules/99-sdb-switch.rules b/rules/99-sdb-switch.rules
index 75238f5..00804a0 100644
--- a/rules/99-sdb-switch.rules
+++ b/rules/99-sdb-switch.rules
@@ -1,2 +1,2 @@
-SUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="1", RUN+="/usr/bin/direct_set_debug.sh --sdb-set"
-SUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="0", RUN+="/usr/bin/direct_set_debug.sh --sdb-unset"
+SUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="1", RUN+="/usr/bin/sdb-mode.sh --on"
+SUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="0", RUN+="/usr/bin/sdb-mode.sh --off"
diff --git a/scripts/headless_env.sh b/scripts/headless_env.sh
new file mode 100644
index 0000000..5af9a52
--- /dev/null
+++ b/scripts/headless_env.sh
@@ -0,0 +1,4 @@
+if [ "$XDG_RUNTIME_DIR" = "" ]
+then
+export XDG_RUNTIME_DIR=/run
+fi
diff --git a/scripts/sdb-mode.sh b/scripts/sdb-mode.sh
new file mode 100644
index 0000000..54d2253
--- /dev/null
+++ b/scripts/sdb-mode.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+
+case "$1" in
+ "--on")
+ echo 0 > /sys/class/usb_mode/usb0/enable
+ echo 04e8 > /sys/class/usb_mode/usb0/idVendor
+ echo 6860 > /sys/class/usb_mode/usb0/idProduct
+ echo "sdb" > /sys/class/usb_mode/usb0/funcs_fconf
+ echo 239 > /sys/class/usb_mode/usb0/bDeviceClass
+ echo 2 > /sys/class/usb_mode/usb0/bDeviceSubClass
+ echo 1 > /sys/class/usb_mode/usb0/bDeviceProtocol
+ echo 1 > /sys/class/usb_mode/usb0/enable
+ systemctl start sdbd.service
+ ;;
+
+ "--off")
+ systemctl stop sdbd.service
+ echo 0 > /sys/class/usb_mode/usb0/enable
+ ;;
+
+ *)
+ echo "Wrong parameters. Please use option --help to check options "
+ ;;
+esac