diff options
| -rw-r--r-- | flashlight/Android.mk | 6 | ||||
| -rw-r--r-- | flashlight/flashlight.c | 93 | ||||
| -rw-r--r-- | include/hardware_legacy/flashlight.h | 32 |
3 files changed, 0 insertions, 131 deletions
diff --git a/flashlight/Android.mk b/flashlight/Android.mk deleted file mode 100644 index 237d0df..0000000 --- a/flashlight/Android.mk +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2007 The Android Open Source Project - -LOCAL_SRC_FILES += flashlight/flashlight.c -ifeq ($(QEMU_HARDWARE),yes) - LOCAL_CFLAGS += -DQEMU_FLASHLIGHT -endif diff --git a/flashlight/flashlight.c b/flashlight/flashlight.c deleted file mode 100644 index 0325e11..0000000 --- a/flashlight/flashlight.c +++ /dev/null @@ -1,93 +0,0 @@ -#include <hardware_legacy/flashlight.h> - -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include "qemu.h" - -#define FLASHLIGHT "/sys/class/leds/spotlight/brightness" -#define CAMERA_FLASH "/sys/class/timed_output/flash/enable" - -#ifdef QEMU_HARDWARE -int qemu_get_flashlight_enabled() -{ - char question[256]; - char answer[256]; - int len; - - len = qemu_command_format( question, sizeof question, - "get_flashlight_enabled" ); - - len = qemu_control_query( question, len, answer, sizeof answer ); - if (len <= 0) return 0; - - /* we expect an answer of 0 or 1 */ - return (answer[0] == '1'); -} - -int qemu_set_flashlight_enabled(int on) -{ - return qemu_control_command( "set_flashlight_enabled:%d", on ); -} - -int qemu_enable_camera_flash(int milliseconds) -{ - return qemu_control_command( "enable_camera_flash:%d", milliseconds ); -} -#endif - -int get_flashlight_enabled() -{ - int fd; - int ret = 0; - char value; - - QEMU_FALLBACK(get_flashlight_enabled()); - - fd = open(FLASHLIGHT, O_RDONLY); - if(fd && read(fd, &value, 1) == 1) { - ret = (value == '1'); - } - close(fd); - - return ret; -} - -int set_flashlight_enabled(int on) -{ - int nwr, ret, fd; - char value[20]; - - QEMU_FALLBACK(set_flashlight_enabled(on)); - - fd = open(FLASHLIGHT, O_RDWR); - if(fd < 0) - return errno; - - nwr = sprintf(value, "%d\n", !!on); - ret = write(fd, value, nwr); - - close(fd); - - return (ret == nwr) ? 0 : -1; -} - -int enable_camera_flash(int milliseconds) -{ - int nwr, ret, fd; - char value[20]; - - QEMU_FALLBACK(enable_camera_flash(milliseconds)); - - fd = open(CAMERA_FLASH, O_RDWR); - if(fd < 0) - return errno; - - nwr = sprintf(value, "%d\n", milliseconds); - ret = write(fd, value, nwr); - - close(fd); - - return (ret == nwr) ? 0 : -1; -} diff --git a/include/hardware_legacy/flashlight.h b/include/hardware_legacy/flashlight.h deleted file mode 100644 index d372307..0000000 --- a/include/hardware_legacy/flashlight.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * 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. - */ - -#ifndef _HARDWARE_FLASHLIGHT_H
-#define _HARDWARE_FLASHLIGHT_H
-
-#if __cplusplus
-extern "C" {
-#endif
-
-int get_flashlight_enabled();
-int set_flashlight_enabled(int on);
-int enable_camera_flash(int milliseconds);
-
-#if __cplusplus
-} // extern "C"
-#endif
-
-#endif // _HARDWARE_FLASHLIGHT_H
|
