Source1001: sdbd_device.service
Source1002: sdbd_emulator.service
Source1003: %{name}.manifest
+Source1004: sdbd_tcp.service
BuildRequires: capi-system-info-devel >= 0.2.0
BuildRequires: cmake >= 2.8.3
ln -s %{_libdir}/systemd/system/sdbd.service %{buildroot}/%{_libdir}/systemd/system/emulator.target.wants/
%else
install -m 0644 %SOURCE1001 %{buildroot}%{_libdir}/systemd/system/sdbd.service
+install -m 0644 %SOURCE1004 %{buildroot}%{_libdir}/systemd/system/sdbd_tcp.service
%endif
mkdir -p %{buildroot}%{_prefix}/sbin
%{_libdir}/systemd/system/sdbd.service
%if 0%{?simulator}
%{_libdir}/systemd/system/emulator.target.wants/sdbd.service
+%else
+%{_libdir}/systemd/system/sdbd_tcp.service
%endif
%changelog
--- /dev/null
+[Unit]
+Description=sdbd
+After=default.target
+
+[Service]
+Type=forking
+Environment=DISPLAY=:0
+PIDFile=/tmp/.sdbd.pid
+RemainAfterExit=yes
+ExecStart=/usr/sbin/sdbd --listen=26101
if (split_retval != SDBD_COMMANDLINE_SUCCESS) {
return split_retval;
}
+ /* if we are on emulator we listen using local transport
+ * so we should set port to default value but this can
+ * be overwritten by command line options */
+ if (sdbd_args->sdbd_port < 0) {
+ sdbd_args->sdbd_port = DEFAULT_SDB_LOCAL_TRANSPORT_PORT;
+ }
break;
case ARG_S_SENSORS:
split_retval = split_host_port(optarg,
sdbd_args->sdb.host = strdup(QEMU_FORWARD_IP);
sdbd_args->sdb.port = DEFAULT_SDB_PORT;
- sdbd_args->sdbd_port = DEFAULT_SDB_LOCAL_TRANSPORT_PORT;
+ // by default don't listen on local transport
+ sdbd_args->sdbd_port = -1;
}
if (!is_emulator()) {
// listen on USB
usb_init();
- // listen on tcp
- //local_init(DEFAULT_SDB_LOCAL_TRANSPORT_PORT);
- } else {
- // listen on default port
- local_init(DEFAULT_SDB_LOCAL_TRANSPORT_PORT);
+ }
+
+ /* by default don't listen on local transport but
+ * listen if suitable command line argument has been provided */
+ if (sdbd_commandline_args.sdbd_port >= 0) {
+ local_init(sdbd_commandline_args.sdbd_port);
}
#if 0 /* tizen specific */
} END_TEST
+START_TEST(test_emul_default_tcp_port) {
+ char *test_argv[] = {
+ "./test",
+ "--emulator=tizen:101",
+ };
+
+ SdbdCommandlineArgs sdbd_args = {0};
+
+ apply_sdbd_commandline_defaults(&sdbd_args);
+ int parse_res = parse_sdbd_commandline(&sdbd_args, array_size(test_argv), test_argv);
+
+ if (parse_res != SDBD_COMMANDLINE_SUCCESS) {
+ ck_abort_msg("parsing commandline failed");
+ return;
+ }
+
+ ck_assert_hostport_eq(&sdbd_args.emulator, "tizen", 101);
+ ck_assert_int_eq(sdbd_args.sdbd_port, DEFAULT_SDB_LOCAL_TRANSPORT_PORT);
+} END_TEST
+
+START_TEST(test_tcp_port) {
+ char *test_argv[] = {
+ "./test",
+ "--listen-port=101",
+ };
+
+ SdbdCommandlineArgs sdbd_args = {0};
+
+ apply_sdbd_commandline_defaults(&sdbd_args);
+ int parse_res = parse_sdbd_commandline(&sdbd_args, array_size(test_argv), test_argv);
+
+ if (parse_res != SDBD_COMMANDLINE_SUCCESS) {
+ ck_abort_msg("parsing commandline failed");
+ return;
+ }
+
+ ck_assert_int_eq(sdbd_args.sdbd_port, 101);
+} END_TEST
START_TEST(test_empty) {
char *test_argv[] = {
ck_assert_hostport_eq(&sdbd_args.emulator, NULL, 0);
ck_assert_hostport_eq(&sdbd_args.sensors, QEMU_FORWARD_IP, DEFAULT_SENSORS_LOCAL_TRANSPORT_PORT);
ck_assert_hostport_eq(&sdbd_args.sdb, QEMU_FORWARD_IP, DEFAULT_SDB_PORT);
- ck_assert_int_eq(sdbd_args.sdbd_port, DEFAULT_SDB_LOCAL_TRANSPORT_PORT);
+ ck_assert_int_eq(sdbd_args.sdbd_port, -1);
} END_TEST