Polina Bondarenko | 1c408b0 | 2015-11-13 17:04:00 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
Polina Bondarenko | 81b83b3 | 2016-01-26 14:26:37 +0100 | [diff] [blame] | 17 | #include <errno.h> |
Polina Bondarenko | 0cd87cf | 2016-01-26 17:31:39 +0100 | [diff] [blame] | 18 | #include <stdlib.h> |
| 19 | #include <string.h> |
| 20 | |
| 21 | #define LOG_TAG "HardwarePropertiesHAL" |
| 22 | #include <utils/Log.h> |
Polina Bondarenko | 81b83b3 | 2016-01-26 14:26:37 +0100 | [diff] [blame] | 23 | |
Polina Bondarenko | 1c408b0 | 2015-11-13 17:04:00 +0100 | [diff] [blame] | 24 | #include <hardware/hardware.h> |
| 25 | #include <hardware/hardware_properties.h> |
| 26 | |
| 27 | static ssize_t get_device_temperatures( |
| 28 | struct hardware_properties_module *module, float **temps) { |
| 29 | *temps = NULL; |
| 30 | errno = ENOSYS; |
| 31 | ALOGE("getDeviceTemperatures: %s", strerror(errno)); |
| 32 | return -1; |
| 33 | } |
| 34 | |
| 35 | static ssize_t get_cpu_usages(struct hardware_properties_module *module, |
| 36 | int64_t **active_times, int64_t **total_times) { |
| 37 | *active_times = NULL; |
| 38 | *total_times = NULL; |
| 39 | errno = ENOSYS; |
| 40 | ALOGE("getCpuUsages: %s", strerror(errno)); |
| 41 | return -1; |
| 42 | } |
| 43 | |
| 44 | static ssize_t get_fan_speeds(struct hardware_properties_module *module, |
| 45 | float **fan_speeds) { |
| 46 | *fan_speeds = NULL; |
| 47 | errno = ENOSYS; |
| 48 | ALOGE("getFanSpeeds: %s", strerror(errno)); |
| 49 | return -1; |
| 50 | } |
| 51 | |
| 52 | static struct hw_module_methods_t hardware_properties_module_methods = { |
| 53 | .open = NULL, |
| 54 | }; |
| 55 | |
| 56 | struct hardware_properties_module HAL_MODULE_INFO_SYM = { |
| 57 | .common = { |
| 58 | .tag = HARDWARE_MODULE_TAG, |
| 59 | .module_api_version = HARDWARE_PROPERTIES_HARDWARE_MODULE_API_VERSION_0_1, |
| 60 | .hal_api_version = HARDWARE_HAL_API_VERSION, |
| 61 | .id = HARDWARE_PROPERTIES_HARDWARE_MODULE_ID, |
| 62 | .name = "Default Hardware Properties HAL", |
| 63 | .author = "The Android Open Source Project", |
| 64 | .methods = &hardware_properties_module_methods, |
| 65 | }, |
| 66 | |
| 67 | .getCpuTemperatures = get_device_temperatures, |
| 68 | .getGpuTemperatures = get_device_temperatures, |
| 69 | .getBatteryTemperatures = get_device_temperatures, |
| 70 | .getCpuUsages = get_cpu_usages, |
| 71 | .getFanSpeeds = get_fan_speeds, |
| 72 | }; |