2 * Copyright (C) 2012 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "emulator PowerHAL"
18 #include <utils/Log.h>
20 #include <hardware/hardware.h>
21 #include <hardware/power.h>
22 #include <hardware/qemud.h>
28 static void power_qemu_init(struct power_module *module)
30 qemud_fd = qemud_channel_open("hw-control");
33 ALOGE("Error connecting to qemud hw-control service\n");
36 static void power_qemu_set_interactive(struct power_module *module, int on)
40 r = qemud_channel_send(qemud_fd, on ? "power:screen_state:wake"
41 : "power:screen_state:standby", -1);
44 ALOGE("Error sending power command to qemud hw-control service\n");
47 static struct hw_module_methods_t power_qemu_module_methods = {
51 struct power_module HAL_MODULE_INFO_SYM = {
53 .tag = HARDWARE_MODULE_TAG,
56 .id = POWER_HARDWARE_MODULE_ID,
57 .name = "Emulator Power HAL",
58 .author = "The Android Open Source Project",
59 .methods = &power_qemu_module_methods,
62 .init = power_qemu_init,
63 .setInteractive = power_qemu_set_interactive,