#define CAMERA_BACK_PATH "/sys/class/leds/torch-sec1"
#endif
-static int camera_back_set_state(struct led_state *state)
+static int camera_back_set_state(enum led_device_type type, struct led_state *state)
{
static int max = -1;
int brt, r;
- if (!state) {
+ if ((type != CAMERA_BACK) || !state) {
_E("wrong parameter");
return -EINVAL;
}
static int led_init(void **data)
{
- hal_backend_led_funcs *led_funcs;
+ hal_backend_led_funcs *led_device;
- led_funcs = calloc(1, sizeof(hal_backend_led_funcs));
- if (!led_funcs)
+ led_device = calloc(1, sizeof(hal_backend_led_funcs));
+ if (!led_device)
return -ENOMEM;
- led_funcs->set_state = camera_back_set_state;
+ led_device->camera_front = NULL;
+ led_device->notification = NULL;
+ led_device->touch_key = NULL;
+ led_device->camera_back = calloc(1, sizeof(struct led_funcs));
+ if (!led_device->camera_back) {
+ free(led_device);
+ return -ENOMEM;
+ }
+
+ led_device->camera_back->set_state = camera_back_set_state;
+ led_device->camera_back->get_state = NULL;
+ led_device->camera_back->get_number = NULL;
+ led_device->camera_back->set_num = NULL;
+ led_device->camera_back->get_max_num = NULL;
+ led_device->camera_back->keyled_set_state = NULL;
+ led_device->camera_back->keyled_get_state = NULL;
- *data = (void *)led_funcs;
+ *data = (void *)led_device;
return 0;
}
static int led_exit(void *data)
{
+ hal_backend_led_funcs *led_device;
+
if (!data)
return 0;
- free(data);
+ led_device = (hal_backend_led_funcs *)data;
+ free(led_device->camera_back);
+ free(led_device);
+
return 0;
}