Add socket for ffs socket activation 16/63016/6
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 7 Mar 2018 19:17:01 +0000 (20:17 +0100)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 7 Mar 2018 19:17:59 +0000 (20:17 +0100)
Adapt the sdbd service to support ffs socket activation via sockets
with ListenUSBFunction option. Add a socket unit for socket activation.

Change-Id: Iefd15fb318230c2bf10b39680ef495bb78c49864
Signed-off-by: Georgia Brikis <g.brikis@samsung.com>
[Rebased for Tizen 5.0]
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
packaging/sdbd.service
packaging/sdbd.socket [new file with mode: 0644]
packaging/sdbd.spec
packaging/sdbd@.socket [new file with mode: 0644]
packaging/sdbd_device.service
packaging/sdbd_device_tv.service
packaging/sdbd_emulator.service

index 70b5139..8f65db9 100644 (file)
@@ -8,3 +8,5 @@ Type=forking
 PIDFile=/tmp/.sdbd.pid
 RemainAfterExit=yes
 ExecStart=/usr/sbin/sdbd
+USBFunctionDescriptors=/etc/sdbd/descs
+USBFunctionStrings=/etc/sdbd/strs
diff --git a/packaging/sdbd.socket b/packaging/sdbd.socket
new file mode 100644 (file)
index 0000000..486b377
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=sdbd Socket for sdb
+
+[Socket]
+ListenUSBFunction=/dev/usb-funcs/sdb
+Service=sdbd.service
index 3c09c79..e3751b9 100644 (file)
@@ -14,6 +14,7 @@ Source1003:    %{name}.manifest
 Source1004:    sdbd_tcp.service
 Source1005:    sdbd_device_tv.service
 Source1006:    sdbd_emulator_tv.service
+Source1007:    sdbd.socket
 
 BuildRequires: capi-system-info-devel >= 0.2.0
 BuildRequires: cmake >= 2.8.3
@@ -94,6 +95,7 @@ ln -s %{_unitdir}/sdbd.service %{buildroot}/%{_unitdir}/multi-user.target.wants/
 
 mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d/
 install -m 644 rules/99-sdbd.rules %{buildroot}%{_prefix}/lib/udev/rules.d/
+install -m 0644 %SOURCE1007 %{buildroot}%{_unitdir}/sdbd.socket
 
 mkdir -p %{buildroot}%{_prefix}/sbin
 install -m 755 script/sdk_launch %{buildroot}%{_prefix}/sbin/
@@ -130,6 +132,7 @@ chsmack -e "User::Shell" /sbin/sdbd-user
 %{_prefix}/sbin/sdk_launch
 %attr(0755, root, root) %{_sysconfdir}/init.d/sdbd
 %{_unitdir}/sdbd.service
+%{_unitdir}/sdbd.socket
 %{_unitdir}/sdbd_tcp.service
 %{_unitdir}/multi-user.target.wants/sdbd.service
 %{_prefix}/lib/udev/rules.d/99-sdbd.rules
diff --git a/packaging/sdbd@.socket b/packaging/sdbd@.socket
new file mode 100644 (file)
index 0000000..d53479e
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=sdbd Socket for %I
+
+[Socket]
+ListenUSBFunction=%I
+Service=sdbd.service
index 8fe2e4a..38851a8 100644 (file)
@@ -17,6 +17,8 @@ SmackProcessLabel=System
 Capabilities=cap_dac_override,cap_setgid,cap_setuid,cap_sys_admin=i
 SecureBits=keep-caps
 ExecStart=/usr/sbin/sdbd
+USBFunctionDescriptors=/etc/sdbd/descs
+USBFunctionStrings=/etc/sdbd/strs
 
 [Install]
 WantedBy=multi-user.target
index 7ca53a3..416c818 100644 (file)
@@ -16,6 +16,8 @@ Restart=on-failure
 Capabilities=cap_dac_override,cap_setgid,cap_setuid,cap_sys_admin=i
 SecureBits=keep-caps
 ExecStart=/usr/sbin/sdbd
+USBFunctionDescriptors=/etc/sdbd/descs
+USBFunctionStrings=/etc/sdbd/strs
 
 [Install]
 WantedBy=multi-user.target
index 7bf20f5..e6a4d3e 100644 (file)
@@ -18,6 +18,8 @@ SmackProcessLabel=System
 Capabilities=cap_dac_override,cap_setgid,cap_setuid,cap_sys_admin=i
 SecureBits=keep-caps
 ExecStart=/bin/sh -c "/usr/sbin/sdbd `/usr/bin/awk '{match($0, /sdb_port=([0-9]+)/,port_match); match($0, /vm_name=([^, ]*)/,vm_match); print \"--emulator=\" vm_match[1] \":\" port_match[1] \" --connect-to=10.0.2.2:26099\" \" --sensors=10.0.2.2:\"port_match[1]+3 }' /proc/cmdline`"
+USBFunctionDescriptors=/etc/sdbd/descs
+USBFunctionStrings=/etc/sdbd/strs
 
 [Install]
 WantedBy=emulator_preinit.target