ir: remove legacy ir codes 26/93426/3
authortaeyoung <ty317.kim@samsung.com>
Mon, 24 Oct 2016 08:33:34 +0000 (17:33 +0900)
committertaeyoung <ty317.kim@samsung.com>
Mon, 24 Oct 2016 08:43:26 +0000 (17:43 +0900)
The legacy ir codes are not working.

Change-Id: I05c1bbe920f810c49879f4723996b4d2e9fccd8b
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/ir/ir.c
src/led/ir.c [deleted file]
src/libdeviced/led.c

index 8d7327d..3110090 100644 (file)
@@ -78,11 +78,24 @@ exit:
        return reply;
 }
 
+static DBusMessage *edbus_set_ir_command(E_DBus_Object *obj, DBusMessage *msg)
+{
+       int ret = -ENOTSUP;
+
+       _E("The method is not supported. Use device_ir_transmit() of capi-system-device");
+
+       return make_reply_message(msg, ret);
+}
+
 static const struct edbus_method edbus_methods[] = {
        { "IRIsAvailable", NULL, "i", edbus_ir_is_available},
        { "TransmitIR", "ai", "i", edbus_ir_transmit},
 };
 
+static const struct edbus_method edbus_methods_legacy[] = {
+       { "SetIrCommand",      "s",   "i", edbus_set_ir_command },
+};
+
 static int ir_probe(void *data)
 {
        struct hw_info *info;
@@ -121,9 +134,15 @@ static void ir_init(void *data)
        ret = register_edbus_interface_and_method(DEVICED_PATH_IR,
                        DEVICED_INTERFACE_IR,
                        edbus_methods, ARRAY_SIZE(edbus_methods));
-
        if (ret < 0)
                _E("fail to init edbus interface and method(%d)", ret);
+
+       /* Legacy interfaces */
+       ret = register_edbus_interface_and_method(DEVICED_PATH_LED,
+                       DEVICED_INTERFACE_LED,
+                       edbus_methods_legacy, ARRAY_SIZE(edbus_methods_legacy));
+       if (ret < 0)
+               _E("fail to init edbus interfce and method(%d)", ret);
 }
 
 static void ir_exit(void *data)
diff --git a/src/led/ir.c b/src/led/ir.c
deleted file mode 100644 (file)
index f668a44..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <errno.h>
-#include <device-node.h>
-
-#include "core/log.h"
-#include "core/edbus-handler.h"
-#include "core/devices.h"
-
-static DBusMessage *edbus_set_ir_command(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       char *str;
-       int ret;
-
-       ret = dbus_message_get_args(msg, NULL,
-                       DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID);
-       if (!ret) {
-               _I("there is no message");
-               ret = -EINVAL;
-               goto error;
-       }
-
-       ret = device_set_property(DEVICE_TYPE_LED, PROP_LED_IR_COMMAND, (int)str);
-
-error:
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-       return reply;
-}
-
-static const struct edbus_method edbus_methods[] = {
-       { "SetIrCommand",      "s",   "i", edbus_set_ir_command },
-       /* Add methods here */
-};
-
-static void ir_init(void *data)
-{
-       int ret;
-
-       /* init dbus interface */
-       ret = register_edbus_interface_and_method(DEVICED_PATH_LED,
-                       DEVICED_INTERFACE_LED,
-                       edbus_methods, ARRAY_SIZE(edbus_methods));
-       if (ret < 0)
-               _E("fail to init edbus interfce and method(%d)", ret);
-}
-
-static const struct device_ops irled_device_ops = {
-       .name     = "irled",
-       .init     = ir_init,
-};
-
-DEVICE_OPS_REGISTER(&irled_device_ops)
index 0248fec..b27c3f3 100644 (file)
@@ -112,35 +112,3 @@ API int led_set_brightness_with_noti(int val, bool enable)
        dbus_message_unref(msg);
        return ret_val;
 }
-
-API int led_set_ir_command(char *value)
-{
-       if (value == NULL) {
-               return -EINVAL;
-       }
-
-       DBusError err;
-       DBusMessage *msg;
-       char *arr[1];
-       int ret, ret_val;
-
-       arr[0] = value;
-
-       msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
-                       DEVICED_PATH_LED, DEVICED_INTERFACE_LED,
-                       METHOD_SET_IR_COMMAND, "s", arr);
-       if (!msg)
-               return -EBADMSG;
-
-       dbus_error_init(&err);
-
-       ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &ret_val, DBUS_TYPE_INVALID);
-       if (!ret) {
-               _E("no message : [%s:%s]", err.name, err.message);
-               dbus_error_free(&err);
-               ret_val = -EBADMSG;
-       }
-
-       dbus_message_unref(msg);
-       return ret_val;
-}