• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Nanohub sensor HAL usage instructions:
17#
18# Add the following to your device.mk file.
19#
20# # Enable the nanohub sensor HAL
21# TARGET_USES_NANOHUB_SENSORHAL := true
22#
23# # Nanohub sensor list source file
24# NANOHUB_SENSORHAL_SENSORLIST := $(LOCAL_PATH)/sensorhal/sensorlist.cpp
25#
26# # Sensor HAL name override (optional)
27# NANOHUB_SENSORHAL_NAME_OVERRIDE := sensors.nanohub
28#
29# # Enable lid-state reporting (optional)
30# NANOHUB_SENSORHAL_LID_STATE_ENABLED := true
31#
32# # Enable mag-bias reporting (optional)
33# NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED := true
34#
35
36LOCAL_PATH := $(call my-dir)
37
38ifeq ($(TARGET_USES_NANOHUB_SENSORHAL), true)
39
40COMMON_CFLAGS := -Wall -Werror -Wextra
41
42################################################################################
43
44include $(CLEAR_VARS)
45
46ifeq ($(NANOHUB_SENSORHAL_NAME_OVERRIDE),)
47ifeq ($(TARGET_DEVICE),angler_treble)
48LOCAL_MODULE := sensors.angler
49LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
50LOCAL_LICENSE_CONDITIONS := notice
51else
52ifeq ($(TARGET_DEVICE),bullhead_treble)
53LOCAL_MODULE := sensors.bullhead
54LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
55LOCAL_LICENSE_CONDITIONS := notice
56else
57LOCAL_MODULE := sensors.$(TARGET_DEVICE)
58LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
59LOCAL_LICENSE_CONDITIONS := notice
60endif
61endif
62else
63LOCAL_MODULE := $(NANOHUB_SENSORHAL_NAME_OVERRIDE)
64LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
65LOCAL_LICENSE_CONDITIONS := notice
66endif
67
68LOCAL_MODULE_RELATIVE_PATH := hw
69LOCAL_MODULE_TAGS := optional
70LOCAL_MODULE_OWNER := google
71LOCAL_PROPRIETARY_MODULE := true
72
73LOCAL_CFLAGS += $(COMMON_CFLAGS)
74
75LOCAL_C_INCLUDES += \
76	device/google/contexthub/firmware/os/inc \
77	device/google/contexthub/util/common
78
79LOCAL_SRC_FILES := \
80	sensors.cpp \
81	../../../../$(NANOHUB_SENSORHAL_SENSORLIST)
82
83LOCAL_HEADER_LIBRARIES := \
84    libhardware_headers
85
86LOCAL_SHARED_LIBRARIES := \
87	liblog \
88	libcutils \
89	libhubconnection \
90	libstagefright_foundation \
91	libutils
92
93ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
94LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
95endif
96
97ifeq ($(NANOHUB_SENSORHAL_DYNAMIC_SENSOR_EXT_ENABLED), true)
98LOCAL_CFLAGS += -DDYNAMIC_SENSOR_EXT_ENABLED
99LOCAL_SHARED_LIBRARIES += libdynamic_sensor_ext
100endif
101
102ifeq ($(NANOHUB_SENSORHAL_LEFTY_SERVICE_ENABLED), true)
103LOCAL_CFLAGS += -DLEFTY_SERVICE_ENABLED
104LOCAL_SHARED_LIBRARIES += liblefty_service_nanohub
105endif
106
107include $(BUILD_SHARED_LIBRARY)
108
109################################################################################
110
111include $(CLEAR_VARS)
112
113LOCAL_MODULE := libhubconnection
114LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
115LOCAL_LICENSE_CONDITIONS := notice
116LOCAL_MODULE_TAGS := optional
117LOCAL_MODULE_OWNER := google
118LOCAL_PROPRIETARY_MODULE := true
119
120LOCAL_CFLAGS += $(COMMON_CFLAGS)
121
122ifeq ($(NANOHUB_SENSORHAL_LID_STATE_ENABLED), true)
123LOCAL_CFLAGS += -DLID_STATE_REPORTING_ENABLED
124endif
125
126ifeq ($(NANOHUB_SENSORHAL_USB_MAG_BIAS_ENABLED), true)
127LOCAL_CFLAGS += -DUSB_MAG_BIAS_REPORTING_ENABLED
128endif
129
130ifeq ($(NANOHUB_SENSORHAL_DOUBLE_TOUCH_ENABLED), true)
131LOCAL_CFLAGS += -DDOUBLE_TOUCH_ENABLED
132endif
133
134ifeq ($(NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED), true)
135LOCAL_CFLAGS += -DDIRECT_REPORT_ENABLED
136endif
137
138LOCAL_C_INCLUDES += \
139    device/google/contexthub/firmware/os/inc
140
141LOCAL_SRC_FILES := \
142    hubconnection.cpp \
143    directchannel.cpp
144
145LOCAL_STATIC_LIBRARIES := \
146    libhubutilcommon
147
148LOCAL_SHARED_LIBRARIES := \
149    libcutils \
150    libhardware \
151    libhardware_legacy \
152    liblog \
153    libstagefright_foundation \
154    libutils \
155
156include $(BUILD_SHARED_LIBRARY)
157
158################################################################################
159
160endif
161