├── superior.dependencies
├── README.md
├── Android.mk
├── extract-files.sh
├── setup-makefiles.sh
├── AndroidProducts.mk
├── releasetools
├── releasetools.py
└── device_check.sh
├── init
├── Android.bp
└── libinit_ef63.cpp
├── bluetooth
└── bdroid_buildcfg.h
├── overlay
├── frameworks
│ └── base
│ │ └── core
│ │ └── res
│ │ └── res
│ │ ├── values
│ │ ├── strings.xml
│ │ ├── dot_config.xml
│ │ └── config.xml
│ │ └── xml
│ │ └── power_profile.xml
└── lineage-sdk
│ └── lineage
│ └── res
│ └── res
│ └── values
│ └── config.xml
├── conn_init
├── wfc_util_log.h
├── wfc_util_common.h
├── wfc_util_qcom.h
├── conn_init.c
├── Android.mk
├── wfc_util_fctrl.h
├── wfc_util_common.c
├── wfc_util_main.c
├── NOTICE
├── wfc_util_fctrl.c
└── wfc_util_qcom.c
├── light
├── Android.bp
├── android.hardware.light@2.0-service.ef63.rc
├── Light.h
├── service.cpp
└── Light.cpp
├── BoardConfig.mk
├── ef63.mk
├── superior_ef63.mk
├── keylayout
└── cr-tk-300k.kl
├── device-proprietary-files.txt
└── configs
├── nfc-nci.conf
├── libnfc-nxp.conf
└── libnfc-nci.conf
/superior.dependencies:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "repository": "device_pantech_msm8974-common",
4 | "target_path": "device/pantech/msm8974-common"
5 | },
6 | {
7 | "repository": "vendor_pantech_ef63",
8 | "target_path": "vendor/pantech"
9 | },
10 | {
11 | "repository": "kernel_pantech_msm8x74",
12 | "target_path": "kernel/pantech/msm8x74"
13 | }
14 | ]
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Copyright 2016, TekCafe Team
2 |
3 | Device Tree For PANTECH SKY VEGA IRON 2
4 | =======================================
5 |
6 | Basic | Spec Sheet
7 | -------:|:-------------------------
8 | CPU | Quad-core 2.3 GHz Krait 400
9 | CHIPSET | Qualcomm Snapdragon 801
10 | GPU | Adreno 330
11 | Display | 5.3" Full HD Super AMOLED Display (1920 x 1080)
12 | Memory | 3GB RAM
13 | Storage | 32GB
14 | MicroSD | Up to 256 GB
15 | Battery | 3,220 mAh
16 | Dimensions | 144.2 x 73.5 x 7.9mm - 152g(Black), 153g(White)
17 | Camera | 13M wide OIS / 2.1M FULL HD
18 |
19 |
20 | 
21 |
--------------------------------------------------------------------------------
/Android.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2014 The LineageOS 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 |
17 | LOCAL_PATH := $(call my-dir)
18 |
19 | ifeq ($(TARGET_DEVICE),ef63)
20 | include $(call all-subdir-makefiles,$(LOCAL_PATH))
21 | endif
22 |
--------------------------------------------------------------------------------
/extract-files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (C) 2016 The LineageOS Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | set -e
19 |
20 | export DEVICE=ef63
21 | export DEVICE_COMMON=msm8974-common
22 | export VENDOR=pantech
23 |
24 | ./../$DEVICE_COMMON/extract-files.sh $@
25 |
--------------------------------------------------------------------------------
/setup-makefiles.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (C) 2016 The LineageOS Project
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | set -e
19 |
20 | export DEVICE=ef63
21 | export DEVICE_COMMON=msm8974-common
22 | export VENDOR=pantech
23 |
24 | ./../$DEVICE_COMMON/setup-makefiles.sh $@
25 |
--------------------------------------------------------------------------------
/AndroidProducts.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2018 The LineageOS 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 | PRODUCT_MAKEFILES := \
17 | $(LOCAL_DIR)/superior_ef63.mk
18 |
19 | COMMON_LUNCH_CHOICES := \
20 | superior_ef63-user \
21 | superior_ef63-userdebug \
22 | superior_ef63-eng
23 |
--------------------------------------------------------------------------------
/releasetools/releasetools.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2016 The LineageOS 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 |
17 | def FullOTA_InstallEnd(info):
18 | info.script.Mount("/system");
19 | info.script.AppendExtra('assert(run_program("/system/system/bin/device_check.sh") == 0);');
20 | info.script.Unmount("/system");
21 |
--------------------------------------------------------------------------------
/init/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2019 The LineageOS 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 |
17 | cc_library_static {
18 | name: "libinit_ef63",
19 | recovery_available: true,
20 | srcs: ["libinit_ef63.cpp"],
21 | include_dirs: [
22 | "system/core/base/include",
23 | "system/core/init"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/bluetooth/bdroid_buildcfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 The LineageOS 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 |
17 | #ifndef _BDROID_BUILDCFG_H
18 | #define _BDROID_BUILDCFG_H
19 |
20 | #define BTM_DEF_LOCAL_NAME "Vega Iron 2"
21 |
22 | // #define BLE_VND_INCLUDED TRUE
23 | #define BLUETOOTH_QTI_SW TRUE
24 | #define BT_CLEAN_TURN_ON_DISABLED TRUE
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/releasetools/device_check.sh:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 |
3 | if grep -q "IM-A910S" /dev/block/mmcblk0p10 ; then
4 |
5 | if grep -q "KIVN07172014" /dev/block/mmcblk0p10 ; then
6 | mv /system/system/vendor/etc/firmware_ef63l/* /system/system/vendor/etc/firmware/
7 | elif grep -q "KIVN05042015" /dev/block/mmcblk0p10 ; then
8 | mv /system/system/vendor/etc/firmware_ef63l/* /system/system/vendor/firmware/
9 | else
10 | mv /system/system/vendor/etc/firmware_ef63s/* /system/system/vendor/firmware/
11 | fi
12 |
13 | elif grep -q "IM-A910K" /dev/block/mmcblk0p10 ; then
14 | mv /system/system/vendor/etc/firmware_ef63k/* /system/system/vendor/firmware/
15 |
16 | elif grep -q "IM-A910L" /dev/block/mmcblk0p10 ; then
17 | mv /system/system/vendor/etc/firmware_ef63l/* /system/system/vendor/firmware/
18 | fi
19 |
20 | rm -rf /system/system/vendor/etc/firmware_ef63s
21 | rm -rf /system/system/vendor/etc/firmware_ef63k
22 | rm -rf /system/system/vendor/etc/firmware_ef63l
23 | rm -rf /system/system/bin/device_check.sh
24 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 | VEGA IRON 2
18 |
19 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #ifndef __WFC_UTIL_LOG_H__
18 | #define __WFC_UTIL_LOG_H__
19 |
20 | #ifdef ANDROID
21 | #define LOG_TAG "WifiUtil"
22 | #include
23 |
24 | #define wfc_util_log_info(...) ALOGI(__VA_ARGS__)
25 | #define wfc_util_log_error(...) ALOGE(__VA_ARGS__)
26 | #else /* ANDROID */
27 | #define wfc_util_log_info(...) printf(__VA_ARGS__);printf("\n")
28 | #define wfc_util_log_error(...) printf(__VA_ARGS__);printf("\n")
29 | #endif /* ANDROID */
30 |
31 | #endif
32 |
33 |
--------------------------------------------------------------------------------
/light/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018 The LineageOS 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 | cc_binary {
17 | name: "android.hardware.light@2.0-service.ef63",
18 | defaults: ["hidl_defaults"],
19 | relative_install_path: "hw",
20 | init_rc: ["android.hardware.light@2.0-service.ef63.rc"],
21 | srcs: ["service.cpp", "Light.cpp"],
22 | shared_libs: [
23 | "libbase",
24 | "libhidlbase",
25 | "liblog",
26 | "libutils",
27 | "libhardware",
28 | "android.hardware.light@2.0",
29 | ],
30 | arch: {
31 | arm: {
32 | cflags: [
33 | "-DARCH_ARM_32"
34 | ],
35 | },
36 | },
37 | vendor: true,
38 | }
39 |
--------------------------------------------------------------------------------
/BoardConfig.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2014 The LineageOS 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 |
17 | PLATFORM_PATH := device/pantech/ef63
18 | # Inherit from msm8974-common
19 | -include device/pantech/msm8974-common/BoardConfigCommon.mk
20 |
21 | # Assert
22 | TARGET_OTA_ASSERT_DEVICE := ef63l,ef63s,ef63k
23 |
24 | # Bluetooth
25 | BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(PLATFORM_PATH)/bluetooth
26 |
27 | # Kernel
28 | TARGET_KERNEL_CONFIG := LineageOS_ef63_defconfig
29 |
30 | # ReleaseTools
31 | TARGET_RELEASETOOLS_EXTENSIONS := $(PLATFORM_PATH)/releasetools
32 |
33 | # Filesystem
34 | BOARD_USERDATAIMAGE_PARTITION_SIZE := 26534215680
35 |
36 | # Init
37 | TARGET_INIT_VENDOR_LIB := libinit_ef63
38 | TARGET_RECOVERY_DEVICE_MODULES := libinit_ef63
39 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/dot_config.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
30 | 71
31 | true
32 |
33 |
--------------------------------------------------------------------------------
/ef63.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2014 The LineageOS 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 |
17 | # Overlays
18 | DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
19 |
20 | # Checking model
21 | PRODUCT_COPY_FILES += \
22 | $(LOCAL_PATH)/releasetools/device_check.sh:system/bin/device_check.sh
23 |
24 | # Vendor security patch level
25 | PRODUCT_PROPERTY_OVERRIDES += \
26 | ro.lineage.build.vendor_security_patch=2016-09-01
27 |
28 | # Lights
29 | PRODUCT_PACKAGES += \
30 | android.hardware.light@2.0-service.ef63
31 |
32 | # NFC
33 | PRODUCT_COPY_FILES += \
34 | $(LOCAL_PATH)/configs/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf \
35 | $(LOCAL_PATH)/configs/nfc-nci.conf:$(TARGET_COPY_OUT_VENDOR)/etc/nfc-nci.conf \
36 | $(LOCAL_PATH)/configs/libnfc-nci.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nci.conf
37 |
38 | # Inherit from msm8974-common
39 | $(call inherit-product, device/pantech/msm8974-common/msm8974.mk)
40 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_common.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #ifndef __WFC_UTIL_COMMON_H__
18 | #define __WFC_UTIL_COMMON_H__
19 |
20 | /*
21 | * wfc_util_htoa
22 | *
23 | * return : void
24 | */
25 | extern void wfc_util_htoa(unsigned char *pHexaBuff, int szHexaBuff, char *pAsciiStringBuff, int szAsciiStringBuff);
26 |
27 | /*
28 | * wfc_util_atoh
29 | *
30 | * return : void
31 | */
32 | extern void wfc_util_atoh(char *pAsciiString, int szAsciiString, unsigned char *pHexaBuff, int szHexaBuff);
33 |
34 | /*
35 | * wfc_util_is_random_mac
36 | *
37 | * return : it will return 1 if [mac_add] is same with WFC_UTIL_RANDOM_MAC_HEADER
38 | * or will return 0 if not.
39 | */
40 | extern int wfc_util_is_random_mac(char *mac_add);
41 |
42 | /*
43 | * wfc_util_random_mac
44 | *
45 | * Create random MAC address
46 | *
47 | * return : void
48 | */
49 | void wfc_util_random_mac(unsigned char* mac_addr);
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_qcom.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #ifndef __WFC_UTIL_QCOM_H__
18 | #define __WFC_UTIL_QCOM_H__
19 |
20 | #ifdef CONFIG_SKY_WLAN_QCOM_PATCH
21 | /*
22 | * wfc_util_qcom_check_config
23 | *
24 | * check the qcom wlan driver config file
25 | *
26 | * return : it will return 0 if procedure is success
27 | * or will return -1 if not.
28 | */
29 | extern int wfc_util_qcom_check_config(unsigned char *nv_mac_addr);
30 |
31 | /*
32 | * wfc_util_qcom_reset_mac
33 | *
34 | * reset the mac address of config file
35 | *
36 | * return : void
37 | */
38 | extern void wfc_util_qcom_reset_mac(void);
39 |
40 | /*
41 | * wfc_util_qcom_ota_enable/disable
42 | *
43 | * enable OTA mode for Wi-Fi related certificiation
44 | *
45 | * return : int (boolean)
46 | */
47 | extern int wfc_util_qcom_ota_enable(void);
48 | extern int wfc_util_qcom_ota_disable(void);
49 | extern int wfc_util_qcom_checkt_roaming_off(void);
50 | #endif /* CONFIG_SKY_WLAN_QCOM_PATCH */
51 | #endif
52 |
53 |
--------------------------------------------------------------------------------
/superior_ef63.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2015-2016 The CyanogenMod Project
3 | # 2017-2018 The LineageOS Projec
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | # Inherit from those products. Most specific first.
18 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
19 |
20 | # Inherit from ef63 device
21 | $(call inherit-product, device/pantech/ef63/ef63.mk)
22 |
23 | # Inherit some common Superior stuff.
24 | $(call inherit-product, vendor/superior/config/common.mk)
25 |
26 | # Call the proprietary setup
27 | $(call inherit-product-if-exists, vendor/pantech/ef63/ef63-vendor.mk)
28 |
29 | PRODUCT_NAME := superior_ef63
30 | PRODUCT_DEVICE := ef63
31 | PRODUCT_MANUFACTURER := PANTECH
32 | PRODUCT_MODEL := VEGA IRON 2
33 |
34 | PRODUCT_BRAND := PANTECH
35 | TARGET_VENDOR := PANTECH
36 | TARGET_VENDOR_PRODUCT_NAME := ef63
37 | TARGET_VENDOR_DEVICE_NAME := ef63
38 |
39 |
40 | PRODUCT_BUILD_PROP_OVERRIDES += \
41 | PRIVATE_BUILD_DESC="ef63-user 6.0.1 MHC19Q ZNH2KAS1KN release-keys"
42 |
43 | BUILD_FINGERPRINT := pantech/ef63:6.0.1/MHC19Q/ZNH2KAS1KN:user/release-keys
44 |
45 |
--------------------------------------------------------------------------------
/keylayout/cr-tk-300k.kl:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016, The Sayanogen Project. All rights reserved.
2 | #
3 | # Redistribution and use in source and binary forms, with or without
4 | # modification, are permitted provided that the following conditions are
5 | # met:
6 | # * Redistributions of source code must retain the above copyright
7 | # notice, this list of conditions and the following disclaimer.
8 | # * Redistributions in binary form must reproduce the above
9 | # copyright notice, this list of conditions and the following
10 | # disclaimer in the documentation and/or other materials provided
11 | # with the distribution.
12 | # * Neither the name of The Linux Foundation nor the names of its
13 | # contributors may be used to endorse or promote products derived
14 | # from this software without specific prior written permission.
15 | #
16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 |
27 | key 139 MENU VIRTUAL
28 | key 158 BACK VIRTUAL
29 | key 102 HOME
30 |
--------------------------------------------------------------------------------
/conn_init/conn_init.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 | #include
17 | #include
18 | #include
19 | #include
20 | extern int wfc_util_qcom_check_config(unsigned char *nv_mac_addr);
21 | extern void wfc_util_atoh(char *pAsciiString, int szAsciiString, unsigned char *pHexaBuff, int szHexaBuff);
22 |
23 | static int wifi_check_qcom_cfg_files()
24 | {
25 | char macAddress[13];
26 | char hex[7];
27 | memset(macAddress, 0, 13);
28 | memset(hex, 0, 7);
29 |
30 | // Read MAC String
31 | FILE *fp = NULL;
32 | int n = 0;
33 | fp = fopen("/dev/block/platform/msm_sdcc.1/by-name/rawdata", "r");
34 | if ( fp == NULL )
35 | {
36 | ALOGD("Failed to open NV for wlan macaddr read");
37 | return -1;
38 | }
39 | else
40 | {
41 | unsigned char macbuf[6];
42 | fseek(fp,0x4f604,SEEK_SET);
43 | n = fread(macbuf, 6, 1, fp);
44 | sprintf(macAddress,"%02X%02X%02X%02X%02X%02X",
45 | macbuf[0], macbuf[1], macbuf[2],
46 | macbuf[3], macbuf[4], macbuf[5]);
47 | fclose(fp);
48 |
49 | // Write MAC String
50 | wfc_util_atoh( macAddress, 12, (unsigned char *)hex, 6);
51 | wfc_util_qcom_check_config((unsigned char *)hex);
52 | }
53 | return 1;
54 | }
55 |
56 | int main(void)
57 | {
58 | wifi_check_qcom_cfg_files();
59 |
60 | return 0;
61 | }
62 |
--------------------------------------------------------------------------------
/conn_init/Android.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2012 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 |
17 | ifneq ($(filter ef63,$(TARGET_DEVICE)),)
18 |
19 | LOCAL_PATH:= $(call my-dir)
20 |
21 | include $(CLEAR_VARS)
22 | LOCAL_MODULE := libwfcu
23 | LOCAL_SRC_FILES := wfc_util_fctrl.c \
24 | wfc_util_common.c
25 | LOCAL_CFLAGS := -Wall \
26 | -Werror
27 | LOCAL_CFLAGS += -DCONFIG_SKY_WLAN_WIFI_PATCH
28 | ifeq ($(strip $(BOARD_HAS_QCOM_WLAN)),true)
29 | LOCAL_SRC_FILES += wfc_util_qcom.c
30 | LOCAL_CFLAGS += -DCONFIG_SKY_WLAN_QCOM_PATCH
31 | LOCAL_CFLAGS += -DWLAN_CHIP_VERSION_WCNSS
32 | endif
33 | LOCAL_SHARED_LIBRARIES := libcutils liblog
34 | LOCAL_PRELINK_MODULE := false
35 | LOCAL_MODULE_TAGS := optional
36 | LOCAL_MODULE_OWNER := pantech
37 | include $(BUILD_SHARED_LIBRARY)
38 |
39 | include $(CLEAR_VARS)
40 | LOCAL_SRC_FILES := conn_init.c
41 | LOCAL_SHARED_LIBRARIES := libcutils liblog
42 | LOCAL_SHARED_LIBRARIES += libwfcu
43 | LOCAL_CFLAGS += -Wall -Werror
44 | LOCAL_MODULE_TAGS := optional
45 | LOCAL_MODULE_PATH := $(TARGET_OUT)/bin
46 | LOCAL_MODULE := conn_init
47 | LOCAL_MODULE_OWNER := pantech
48 |
49 | # Install symlinks with targets unavailable at build time
50 | LOCAL_POST_INSTALL_CMD := \
51 | mkdir -p $(TARGET_OUT_VENDOR)/firmware/wlan/prima/; \
52 | ln -sf /data/misc/wifi/WCNSS_qcom_cfg.ini $(TARGET_OUT_VENDOR)/firmware/wlan/prima/WCNSS_qcom_cfg.ini; \
53 | ln -sf /data/misc/wifi/WCNSS_qcom_wlan_nv.bin $(TARGET_OUT_VENDOR)/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
54 |
55 | include $(BUILD_EXECUTABLE)
56 |
57 | endif
58 |
--------------------------------------------------------------------------------
/light/android.hardware.light@2.0-service.ef63.rc:
--------------------------------------------------------------------------------
1 | on early-boot
2 | chown system radio /sys/class/leds/led:rgb_red/brightness
3 | chown system radio /sys/class/leds/led:rgb_red/blink
4 | chown system radio /sys/class/leds/led:rgb_red/pan_blink
5 | chown system radio /sys/class/leds/led:rgb_red/pan_brightness
6 | chown system radio /sys/class/leds/led:rgb_red/pan_loop
7 | chown system radio /sys/class/leds/led:rgb_red/pan_oneshot
8 | chown system radio /sys/class/leds/led:rgb_red/pan_rainbow
9 | chown system radio /sys/class/leds/led:rgb_red/pan_rgb_off
10 |
11 | chown system radio /sys/class/leds/led:rgb_green/brightness
12 | chown system radio /sys/class/leds/led:rgb_green/blink
13 | chown system radio /sys/class/leds/led:rgb_green/pan_blink
14 | chown system radio /sys/class/leds/led:rgb_green/pan_brightness
15 | chown system radio /sys/class/leds/led:rgb_green/pan_loop
16 | chown system radio /sys/class/leds/led:rgb_green/pan_oneshot
17 | chown system radio /sys/class/leds/led:rgb_green/pan_rainbow
18 | chown system radio /sys/class/leds/led:rgb_green/pan_rgb_off
19 |
20 | chown system radio /sys/class/leds/led:rgb_blue/brightness
21 | chown system radio /sys/class/leds/led:rgb_blue/blink
22 | chown system radio /sys/class/leds/led:rgb_blue/pan_blink
23 | chown system radio /sys/class/leds/led:rgb_blue/pan_brightness
24 | chown system radio /sys/class/leds/led:rgb_blue/pan_loop
25 | chown system radio /sys/class/leds/led:rgb_blue/pan_oneshot
26 | chown system radio /sys/class/leds/led:rgb_blue/pan_rainbow
27 | chown system radio /sys/class/leds/led:rgb_blue/pan_rgb_off
28 |
29 | chown system radio /sys/class/leds/led:rgb_red/brightness
30 | chown system radio /sys/class/leds/led:rgb_green/brightness
31 | chown system radio /sys/class/leds/led:rgb_blue/brightness
32 |
33 | chown system radio /sys/class/leds/pan_tm_led/brightness
34 |
35 | chmod 0660 /sys/class/leds/pan_tm_led/brightness
36 |
37 | service light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.ef63
38 | interface android.hardware.light@2.0::ILight default
39 | class hal
40 | user system
41 | group system
42 | # shutting off lights while powering-off
43 | shutdown critical
44 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/xml/power_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 0
4 | - 2.8
5 | - 26
6 | - 4
7 |
8 | 300000
9 | 422400
10 | 652800
11 | 729600
12 | 883200
13 | 960000
14 | 1036800
15 | 1190400
16 | 1267200
17 | 1497600
18 | 1574400
19 | 1728000
20 | 1958400
21 | 2265600
22 |
23 |
24 | 86
25 | 103
26 | 121
27 | 142
28 | 164
29 | 186
30 | 193
31 | 206
32 | 261
33 | 287
34 | 299
35 | 314
36 | 323
37 | 357
38 |
39 | - 139.34
40 | - 304.34
41 | - 80
42 | - 1
43 | - 1
44 | - 1
45 | - 200
46 | - 130
47 | - 41
48 | - 21
49 | - 57
50 | - 232
51 | - 3200
52 | - 10
53 | - 50
54 |
55 | .0008
56 | .0062
57 | .0503
58 | .4029
59 | 3.2235
60 |
61 |
62 | - 3220
63 |
64 |
--------------------------------------------------------------------------------
/device-proprietary-files.txt:
--------------------------------------------------------------------------------
1 | # Camera
2 | lib/hw/camera.msm8974.so:vendor/lib/hw/camera.msm8974.so
3 | lib/libmmcamera_rohm_eeprom.so
4 | lib/libmmcamera_rumba_sa_eeprom.so
5 | lib/libmmcamera_s5k6b2yx.so
6 | lib/libmm-qcamera.so
7 | vendor/lib/libmmcamera_hdr_gb_lib.so
8 | vendor/lib/libmmcamera_hdr_lib.so
9 | vendor/lib/libmmcamera_hi256.so
10 | vendor/lib/libmmcamera_imglib.so
11 | vendor/lib/libmmcamera_imx134.so
12 | vendor/lib/libmmcamera_imx135.so
13 | vendor/lib/libmmcamera_imx214.so
14 | vendor/lib/libmmcamera_mt9m114.so
15 | vendor/lib/libmmcamera_ofilm_oty5f03_eeprom.so
16 | vendor/lib/libmmcamera_ov2720.so
17 | vendor/lib/libmmcamera_ov5648_oty5f03.so
18 | vendor/lib/libmmcamera_ov8825.so
19 | vendor/lib/libmmcamera_ov8865_q8v18a.so
20 | vendor/lib/libmmcamera_ov9724.so
21 | vendor/lib/libmmcamera_s5k3l1yx.so
22 | vendor/lib/libmmcamera_SKUAA_ST_gc0339.so
23 | vendor/lib/libmmcamera_skuab_shinetech_gc0339.so
24 | vendor/lib/libmmcamera_SKUAB_ST_s5k4e1.so
25 | vendor/lib/libmmcamera_skuf_ov5648_p5v23c.so
26 | vendor/lib/libmmcamera_skuf_ov12830_p12v01c.so
27 | vendor/lib/libmmcamera_sp1628.so
28 | vendor/lib/libmmcamera_sunny_p5v23c_eeprom.so
29 | vendor/lib/libmmcamera_sunny_p12v01m_eeprom.so
30 | vendor/lib/libmmcamera_sunny_q8v18a_eeprom.so
31 | vendor/lib/libmmcamera_tintless_algo.so
32 | vendor/lib/libmmcamera_tintless_bg_pca_algo.so
33 | vendor/lib/libmmcamera_tuning.so
34 | vendor/lib/libmmcamera_wavelet_lib.so
35 | vendor/lib/libmmcamera2_c2d_module.so
36 | vendor/lib/libmmcamera2_cpp_module.so
37 | vendor/lib/libmmcamera2_iface_modules.so
38 | vendor/lib/libmmcamera2_imglib_modules.so
39 | vendor/lib/libmmcamera2_isp_modules.so
40 | vendor/lib/libmmcamera2_pproc_modules.so
41 | vendor/lib/libmmcamera2_sensor_modules.so
42 | vendor/lib/libmmcamera2_stats_algorithm.so
43 | vendor/lib/libmmcamera2_stats_modules.so
44 | vendor/lib/libmmcamera2_vpe_module.so
45 | vendor/lib/liboemcamera.so
46 |
47 | # Sensors
48 | bin/sensors.qcom:vendor/bin/sensors.qcom
49 | lib/libsnsutils.so
50 |
51 | #firmware
52 | etc/firmware/venus.b00:vendor/firmware/venus.b00
53 | etc/firmware/venus.b01:vendor/firmware/venus.b01
54 | etc/firmware/venus.b02:vendor/firmware/venus.b02
55 | etc/firmware/venus.b03:vendor/firmware/venus.b03
56 | etc/firmware/venus.b04:vendor/firmware/venus.b04
57 | etc/firmware/venus.mbn:vendor/firmware/venus.mbn
58 | etc/firmware/venus.mdt:vendor/firmware/venus.mdt
59 |
60 |
--------------------------------------------------------------------------------
/light/Light.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The LineageOS 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 |
17 | #ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
18 | #define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
19 |
20 | #include
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | namespace android {
28 | namespace hardware {
29 | namespace light {
30 | namespace V2_0 {
31 | namespace implementation {
32 |
33 | struct Light : public ILight {
34 | Light(std::ofstream&& lcd_backlight, std::pair&& button_led,
35 | std::ofstream&& red_led, std::ofstream&& green_led, std::ofstream&& blue_led);
36 |
37 | // Methods from ::android::hardware::light::V2_0::ILight follow.
38 | Return setLight(Type type, const LightState& state) override;
39 | Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
40 |
41 | private:
42 | void setAttentionLight(const LightState& state);
43 | void setBatteryLight(const LightState& state);
44 | void setButtonLight(const LightState& state);
45 | void setLcdBacklight(const LightState& state);
46 | void setNotificationLight(const LightState& state);
47 | void setSpeakerBatteryLightLocked();
48 | void setSpeakerLightLocked(const LightState& state);
49 |
50 | std::ofstream mLcdBacklight;
51 | std::pair mButtonLed;
52 | std::ofstream mRedLed;
53 | std::ofstream mGreenLed;
54 | std::ofstream mBlueLed;
55 |
56 | LightState mAttentionState;
57 | LightState mBatteryState;
58 | LightState mNotificationState;
59 |
60 | std::unordered_map> mLights;
61 | std::mutex mLock;
62 | };
63 |
64 | } // namespace implementation
65 | } // namespace V2_0
66 | } // namespace light
67 | } // namespace hardware
68 | } // namespace android
69 |
70 | #endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
71 |
--------------------------------------------------------------------------------
/overlay/lineage-sdk/lineage/res/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
22 | true
23 | 100
24 | true
25 |
26 |
27 | 12000
28 |
29 |
42 | 107
43 |
44 |
56 | 71
57 |
58 |
70 | 65
71 |
72 |
74 | true
75 |
76 |
77 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_fctrl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #ifndef __WFC_UTIL_FCTRL_H__
18 | #define __WFC_UTIL_FCTRL_H__
19 |
20 | /*
21 | * wfc_util_fset_buffer
22 | *
23 | * return : void
24 | */
25 | void wfc_util_fset_buffer(char *pFileName, int positionStart, unsigned char *pNewValue, int newValueLength);
26 |
27 | /*
28 | * wfc_util_fget_buffer
29 | *
30 | * return : it will return the length of the stored buffer value if procedure is success
31 | * or will return 0 if not.
32 | */
33 | extern int wfc_util_fget_buffer(char *pFileName, int positionStart, int lengthToRead, unsigned char *pValueBuff, int buffLength);
34 |
35 | /*
36 | * wfc_util_fset_string
37 | *
38 | * The following format string will be added or updated to the file pFileName.
39 | * [pSTagString][pNewValueString][pETagString]
40 | *
41 | * pFileName : file name and path
42 | * pEndOfCfg : tag string to notify the end of configuration file
43 | * pSTagString : tag string to notify purpose of the value
44 | * pETagString : tag string to notify the end of the value
45 | * pNewValueString : string to set for pSTagString
46 | *
47 | * return : void
48 | */
49 | extern void wfc_util_fset_string(char *pFileName, char *pEndOfCfg, char *pSTagString, char *pETagString, char *pNewValueString);
50 |
51 | /*
52 | * wfc_util_fget_string
53 | *
54 | * Read value from the following format string in the file pFileName.
55 | * [pSTagString][string value to read][pETagString]
56 | *
57 | * pFileName : file name and path
58 | * pEndOfCfg : tag string to notify the end of configuration file
59 | * pSTagString : tag string to notify purpose of the value
60 | * pETagString : tag string to notify the end of the value
61 | * pValueStringBuff : string buffer to get string value
62 | * stringBuffLength : the length of pValueStringBuff
63 | *
64 | * return : it will return the length of the stored string value if procedure is success
65 | * or will return 0 if not.
66 | */
67 | extern int wfc_util_fget_string(char *pFileName, char *pEndOfCfg, char *pSTagString, char *pETagString, char *pValueStringBuff, int stringBuffLength);
68 |
69 | /*
70 | * wfc_util_ffile_check
71 | *
72 | * check whether pDestFName file exist or not
73 | *
74 | * pFileName : file name and path
75 | * access_mode : R_OK | W_OK | X_OK | F_OK
76 | *
77 | * return : it will return 0 if the file exist
78 | * or will return -1 if not.
79 | */
80 | extern int wfc_util_ffile_check(char *pDestFName, int access_mode);
81 |
82 | /*
83 | * wfc_util_ffile_check_copy
84 | *
85 | * check whether pDestFName file exist if not it will copy from pSourceFName file
86 | *
87 | * return : it will return 0 if procedure is success
88 | * or will return -1 if not.
89 | */
90 | extern int wfc_util_ffile_check_copy(char *pDestFName, char *pSourceFName, mode_t mode, uid_t uID, gid_t gID);
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/init/libinit_ef63.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016, The LineageOS Project
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above
9 | copyright notice, this list of conditions and the following
10 | disclaimer in the documentation and/or other materials provided
11 | with the distribution.
12 | * Neither the name of The Linux Foundation nor the names of its
13 | contributors may be used to endorse or promote products derived
14 | from this software without specific prior written permission.
15 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
19 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
33 | #include
34 | #include
35 | #include
36 |
37 | #include "vendor_init.h"
38 | #include "property_service.h"
39 |
40 | using android::base::GetProperty;
41 |
42 | #define ISMATCH(a,b) (!strncmp(a,b,PROP_VALUE_MAX))
43 |
44 | void property_override(char const prop[], char const value[])
45 | {
46 | prop_info *pi;
47 |
48 | pi = (prop_info*) __system_property_find(prop);
49 | if (pi)
50 | __system_property_update(pi, value, strlen(value));
51 | else
52 | __system_property_add(prop, strlen(prop), value, strlen(value));
53 | }
54 |
55 | void vendor_load_properties()
56 | {
57 | int n = 0;
58 | char device_buf[PROP_VALUE_MAX];
59 | FILE *fp = NULL;
60 |
61 | fp = fopen("/dev/block/platform/msm_sdcc.1/by-name/phoneinfo", "r");
62 | if ( fp == NULL )
63 | {
64 | return;
65 | }
66 | else
67 | {
68 | fseek(fp,0x24,SEEK_SET);
69 | n = fread(device_buf, 8, 1, fp);
70 | device_buf[8] = '\0';
71 | fclose(fp);
72 | }
73 |
74 | property_override("ro.product.model", device_buf);
75 |
76 | if (strstr(device_buf, "IM-A910S"))
77 | {
78 | property_override("ro.product.device", "ef63s");
79 | }
80 | else if (strstr(device_buf, "IM-A910K"))
81 | {
82 | property_override("ro.product.device", "ef63k");
83 | }
84 | else if (strstr(device_buf, "IM-A910L"))
85 | {
86 | property_override("ro.product.device", "ef63l");
87 | }
88 |
89 | // Init a dummy BT MAC address, will be overwritten later
90 | property_override("ro.boot.btmacaddr", "00:00:00:00:00:00");
91 | }
92 |
--------------------------------------------------------------------------------
/overlay/frameworks/base/core/res/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
22 | true
23 | 100
24 | true
25 |
26 |
27 | 12000
28 |
29 |
42 | 107
43 |
44 |
56 | 71
57 |
58 |
59 | true
60 |
61 |
73 | 65
74 |
75 |
77 | true
78 |
79 |
80 |
--------------------------------------------------------------------------------
/light/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The LineageOS 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 | #define LOG_TAG "android.hardware.light@2.0-service.ef65"
17 | #include
18 | #include
19 | #ifdef ARCH_ARM_32
20 | #include
21 | #endif
22 | #include
23 | #include "Light.h"
24 |
25 | // libhwbinder:
26 | using android::hardware::configureRpcThreadpool;
27 | using android::hardware::joinRpcThreadpool;
28 |
29 | // Generated HIDL files
30 | using android::hardware::light::V2_0::ILight;
31 | using android::hardware::light::V2_0::implementation::Light;
32 |
33 | const static std::string kLcdBacklightPath = "/sys/class/leds/lcd-backlight/brightness";
34 | const static std::string kButtonLedPath = "/sys/class/leds/pan_tm_led/brightness";
35 | const static std::string kRedLedPath = "/sys/class/leds/led:rgb_red/brightness";
36 | const static std::string kGreenLedPath = "/sys/class/leds/led:rgb_green/brightness";
37 | const static std::string kBlueLedPath = "/sys/class/leds/led:rgb_blue/brightness";
38 |
39 | int main() {
40 | #ifdef ARCH_ARM_32
41 | android::hardware::ProcessState::initWithMmapSize((size_t)(32768));
42 | #endif
43 | std::ofstream lcdBacklight(kLcdBacklightPath);
44 | if (!lcdBacklight) {
45 | LOG(ERROR) << "Failed to open " << kLcdBacklightPath << ", error=" << errno
46 | << " (" << strerror(errno) << ")";
47 | return -errno;
48 | }
49 | std::ofstream buttonLed(kButtonLedPath);
50 | if (!buttonLed) {
51 | LOG(ERROR) << "Failed to open " << kButtonLedPath << ", error=" << errno
52 | << " (" << strerror(errno) << ")";
53 | return -errno;
54 | }
55 | std::ofstream redLed(kRedLedPath);
56 | if (!redLed) {
57 | LOG(ERROR) << "Failed to open " << kRedLedPath << ", error=" << errno
58 | << " (" << strerror(errno) << ")";
59 | return -errno;
60 | }
61 | std::ofstream greenLed(kGreenLedPath);
62 | if (!greenLed) {
63 | LOG(ERROR) << "Failed to open " << kGreenLedPath << ", error=" << errno
64 | << " (" << strerror(errno) << ")";
65 | return -errno;
66 | }
67 | std::ofstream blueLed(kBlueLedPath);
68 | if (!blueLed) {
69 | LOG(ERROR) << "Failed to open " << kBlueLedPath << ", error=" << errno
70 | << " (" << strerror(errno) << ")";
71 | return -errno;
72 | }
73 | android::sp service = new Light(
74 | std::move(lcdBacklight),
75 | { std::move(buttonLed), std::move(buttonLed) },
76 | std::move(redLed), std::move(greenLed), std::move(blueLed));
77 | configureRpcThreadpool(1, true);
78 | android::status_t status = service->registerAsService();
79 | if (status != android::OK) {
80 | LOG(ERROR) << "Cannot register Light HAL service";
81 | return 1;
82 | }
83 | LOG(INFO) << "Light HAL Ready.";
84 | joinRpcThreadpool();
85 | // Under normal cases, execution will not reach this line.
86 | LOG(ERROR) << "Light HAL failed to join thread pool.";
87 | return 1;
88 | }
89 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_common.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | #include "wfc_util_log.h"
23 |
24 | #define WFC_UTIL_RANDOM_MAC_HEADER "001122"
25 |
26 | void wfc_util_htoa(unsigned char *pHexaBuff, int szHexaBuff, char *pAsciiStringBuff, int szAsciiStringBuff)
27 | {
28 | int i, j;
29 | char hex_table[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
30 | 'A', 'B', 'C', 'D', 'E', 'F'};
31 |
32 | if ((szHexaBuff*2) > szAsciiStringBuff) {
33 | wfc_util_log_error("wfc_util_htoa : not enough buffer size(%d)", szAsciiStringBuff);
34 | return;
35 | }
36 |
37 | memset(pAsciiStringBuff, 0, szAsciiStringBuff);
38 |
39 | /* for (i = szHexaBuff-1, j = 0; i >= 0; i--, j += 2) { */
40 | for (i = 0, j = 0; i < szHexaBuff; i++, j += 2) {
41 | /*pAsciiStringBuff[j] = hex_table[(pHexaBuff[i] >> 4) & 0x0F];
42 | */
43 | pAsciiStringBuff[j] = hex_table[pHexaBuff[i] >> 4];
44 | pAsciiStringBuff[j + 1] = hex_table[pHexaBuff[i] & 0x0F];
45 | }
46 |
47 | return;
48 | }
49 |
50 | void wfc_util_atoh(char *pAsciiString, int szAsciiString, unsigned char *pHexaBuff, int szHexaBuff)
51 | {
52 | int i, pos;
53 | char temp;
54 |
55 | if ( 0!=(szAsciiString%2) || (szHexaBuff*2) < szAsciiString) {
56 | wfc_util_log_error("wfc_util_atoh : not enough buffer size(%d)", szHexaBuff);
57 | return;
58 | }
59 |
60 | memset(pHexaBuff, 0, szHexaBuff);
61 |
62 | for (i=0 ; i= '0' && temp <= '9') {
69 | temp = temp - '0';
70 | } else if ( temp >= 'a' && temp <= 'f' ) {
71 | temp = temp - 'a' + 10;
72 | } else if ( temp >= 'A' && temp <= 'F' ) {
73 | temp = temp - 'A' + 10;
74 | } else {
75 | temp = 0;
76 | }
77 |
78 | if (0==i%2) {
79 | pHexaBuff[pos] = temp<<4;
80 | } else {
81 | pHexaBuff[pos] |= temp;
82 | }
83 | }
84 |
85 | return;
86 | }
87 |
88 | /*
89 | * wfc_util_is_random_mac
90 | *
91 | * return : it will return 1 if [mac_add] is same with WFC_UTIL_RANDOM_MAC_HEADER
92 | * or will return 0 if not.
93 | */
94 | int wfc_util_is_random_mac(char *mac_add)
95 | {
96 | if(0 == strncmp(mac_add, WFC_UTIL_RANDOM_MAC_HEADER, 6)) {
97 | return 1;
98 | }
99 |
100 | return 0;
101 | }
102 |
103 | /*
104 | * wfc_util_random_mac
105 | *
106 | * Create random MAC address
107 | *
108 | * return : void
109 | */
110 | void wfc_util_random_mac(unsigned char* mac_addr)
111 | {
112 | unsigned long int rand_mac;
113 |
114 | if(NULL == mac_addr) {
115 | wfc_util_log_error("wfc_util_random_mac : buffer is NULL");
116 | return;
117 | }
118 |
119 | /* Create random MAC address: offset 3, 4 and 5 */
120 | srandom(time(NULL));
121 | rand_mac=random();
122 |
123 | #ifndef WFC_UTIL_RANDOM_MAC_HEADER
124 | mac_addr[0] = (unsigned char)0xd0;
125 | mac_addr[1] = (unsigned char)0x11;
126 | mac_addr[2] = (unsigned char)0x22;
127 | #else /* WFC_UTIL_RANDOM_MAC_HEADER */
128 | wfc_util_atoh(WFC_UTIL_RANDOM_MAC_HEADER, 6, mac_addr, 3);
129 | #endif /* WFC_UTIL_RANDOM_MAC_HEADER */
130 | mac_addr[3] = (unsigned char)rand_mac;
131 | mac_addr[4] = (unsigned char)(rand_mac >> 8);
132 | mac_addr[5] = (unsigned char)(rand_mac >> 16);
133 |
134 | return;
135 | }
136 |
--------------------------------------------------------------------------------
/configs/nfc-nci.conf:
--------------------------------------------------------------------------------
1 | ## this file is used by NFC Hardware Abstraction Layer at external/libnfc-nci/halimpl/
2 |
3 | ###############################################################################
4 | #chip hardware version
5 | #supported features
6 | NFC_BUILD_ID = V2.1.S.01.01.01.01.1105000707.1112132050
7 | # Application logging mask
8 | APPL_TRACE_LEVEL=0x00
9 | PROTOCOL_TRACE_LEVEL=0x00000000
10 |
11 | #####################################################################################
12 | # File used for NFA storage
13 | NFA_STORAGE="/data/nfc"
14 |
15 | NFC_WAKE_DELAY=20
16 |
17 | #default
18 | NFA_DM_START_UP_CFG={17:80:01:00:08:01:01:11:01:01:AF:02:00:07:AF:02:01:07:C0:01:01:BF:01:02}
19 | #####################################################################################
20 | # listen to the following technology(s).
21 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
22 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B.
23 |
24 | UICC_LISTEN_TECH_MASK=0x07
25 | # Protocol mask for NFC-A technology protocols(T1T,T2T and 4A).
26 | # The bits (for NFC A protocol mask)are defined in nfa_api.h.
27 | # Default is T4AT
28 | # 0x01- T1T, 0x02- T2T, 0x04- T4AT
29 | NFCA_PROTOCOL_MASK=0x04
30 | ###############################################################################
31 | # Force tag polling for the following technology(s).
32 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
33 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B |
34 | # NFA_TECHNOLOGY_MASK_F | NFA_TECHNOLOGY_MASK_ISO15693 |
35 | # NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_A_ACTIVE |
36 | # NFA_TECHNOLOGY_MASK_F_ACTIVE.
37 | #
38 | # 0x01- A, 0x02- B, 0x04- F, 0x20- Kovio
39 | POLLING_TECH_MASK=0x27
40 |
41 | # Force P2P to only listen for the following technology(s).
42 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
43 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_F |
44 | # NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE
45 | # 0x01- NFC DEP A , 0x04:- NFC DEP F
46 | P2P_LISTEN_TECH_MASK=0x05
47 |
48 | ###############################################################################
49 | # Firmware patch file
50 | # If the value is not set then patch download is disabled.
51 | #FW_PATCH="/system/etc/firmware/Signedrompatch.bin"
52 | #FW_PATCH_20="/system/etc/firmware/Signedrompatch_v20.bin"
53 | #FW_PATCH_21="/system/etc/firmware/Signedrompatch_v21.bin"
54 | FW_PATCH_24="/system/etc/firmware/Signedrompatch_v24.bin"
55 | #FW_PATCH_30="/system/etc/firmware/Signedrompatch_v30.bin"
56 | ###############################################################################
57 | # Firmware patch file
58 | #FW_PRE_PATCH="/system/etc/firmware/Signedromprepatch.bin"
59 | NVM_FILE_PATH="/system/etc/firmware/nfc_test.bin"
60 | FUSED_NVM_FILE_PATH="/system/etc/firmware/fused_nvm.bin"
61 | ###############################################################################
62 |
63 | #
64 | TRANSPORT_DRIVER="/dev/nfc-nci"
65 |
66 | ###############################################################################
67 | # power control driver
68 |
69 | POWER_CONTROL_DRIVER="/dev/nfc-nci"
70 |
71 | ###############################################################################
72 | # Maximum Number of Credits to be allowed by the NFCC
73 | MAX_RF_DATA_CREDITS=1
74 | ###############################################################################
75 | #Patch and nvm update flags
76 | # These flags needs to be set to enable the patch update and nvm update mechanism
77 | # of middleware
78 | ###############################################################################
79 | PATCH_UPDATE_ENABLE_FLAG=0x01
80 | NVM_UPDATE_ENABLE_FLAG=0x00
81 | FUSED_NVM_UPDATE_ENABLE_FLAG=0x00
82 | PM_ENABLE_FLAG=0x01
83 | SCREEN_OFF_POWER_STATE=0x01
84 | #0x01=enable region2 code in MW
85 | #0x00= disable region2 code in MW
86 | REGION2_ENABLE=0x01
87 | REGION2_DEBUG_ENABLE_FLAG=0x00
88 | #NFC_SCREEN_OFF_POLL_ON=1
89 | ###############################################################################
90 | # Time out value for closing the connection opened for patch download
91 | ###############################################################################
92 | PATCH_DNLD_NFC_HAL_CMD_TOUT=10000
93 | PATCH_VERSION=21
94 | ###############################################################################
95 | #Default listen mode routing table
96 | # This is the default listen mode routing configuration for NFCC.
97 | # Default is for ISO DEP and NFC DEP
98 | DEFAULT_LISTEN_MODE_ROUTING={00:02:0A:01:03:01:01:04:01:03:00:01:05}
99 | ###############################################################################
100 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_main.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include "wfc_util_fctrl.h"
22 | #include "wfc_util_common.h"
23 |
24 | #ifdef WLAN_CHIP_VERSION_WCNSS
25 | #ifndef WFC_UTIL_CFG_FILE_NAME
26 | #define WFC_UTIL_CFG_FILE_NAME "./WCNSS_qcom_cfg.ini"
27 | #endif
28 | #ifndef WFC_UTIL_NV_BIN_FILE_NAME
29 | #define WFC_UTIL_NV_BIN_FILE_NAME "/system/vendor/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin"
30 | #endif
31 | #else /* WLAN_CHIP_VERSION_WCN1314 */
32 | #ifndef WFC_UTIL_CFG_FILE_NAME
33 | #define WFC_UTIL_CFG_FILE_NAME "./WCN1314_qcom_cfg.ini"
34 | #endif
35 | #ifndef WFC_UTIL_NV_BIN_FILE_NAME
36 | #define WFC_UTIL_NV_BIN_FILE_NAME "./WCN1314_qcom_wlan_nv.bin"
37 | #endif
38 | #endif /* WLAN_CHIP_VERSION_XXXX */
39 | #define WFC_UTIL_CFG_TAG_END_OF_CFG "END"
40 | #define WFC_UTIL_CFG_TAG_MAC_ADDRESS "NetworkAddress="
41 | #define WFC_UTIL_CFG_TAG_AP_MAC_ADDRESS "gAPMacAddr="
42 | #define WFC_UTIL_CFG_TAG_END_OF_LINE "\n"
43 | #define WFC_UTIL_CFG_LENGHT_MAC (6)
44 | #define WFC_UTIL_CFG_LENGHT_MAC_STRING (WFC_UTIL_CFG_LENGHT_MAC*2)
45 |
46 | /*
47 | * persist/WCNSS_qcom_wlan_nv.bin
48 | *
49 | * typedef PACKED_PRE struct PACKED_POST
50 | * {
51 | * //always ensure fields are aligned to 32-bit boundaries
52 | * tANI_U16 productId;
53 | * tANI_U8 productBands;
54 | * tANI_U8 wlanNvRevId;
55 | *
56 | * tANI_U8 numOfTxChains;
57 | * tANI_U8 numOfRxChains;
58 | * tANI_U8 macAddr[NV_FIELD_MAC_ADDR_SIZE];
59 | * tANI_U8 mfgSN[NV_FIELD_MFG_SN_SIZE];
60 | * } sNvFields;
61 | */
62 | #define WFC_UTIL_NV_BIN_HEADER_LENGTH (4)
63 | #define WFC_UTIL_NV_BIN_POS_PRODUCT_ID (WFC_UTIL_NV_BIN_HEADER_LENGTH + 0)
64 | #define WFC_UTIL_NV_BIN_POS_PRODUCT_BAND (WFC_UTIL_NV_BIN_HEADER_LENGTH + 2)
65 | #define WFC_UTIL_NV_BIN_POS_MAC_ADDR (WFC_UTIL_NV_BIN_HEADER_LENGTH + 6)
66 |
67 | int main(int argc, char **argv)
68 | {
69 | int ret = 0;
70 | char mac_add_buff[WFC_UTIL_CFG_LENGHT_MAC_STRING+1];
71 | unsigned char mac_add_buff_2[WFC_UTIL_CFG_LENGHT_MAC] = {0x88, 0xcd, 0xba, 0x0c, 0x90, 0x00};
72 | unsigned char mac_add_buff_3[WFC_UTIL_CFG_LENGHT_MAC] = {0x00, 0x90, 0x0c, 0xba, 0xcd, 0x88};
73 |
74 | printf("wfc_util_main is started\n");
75 |
76 | if(0 < wfc_util_fget_string(WFC_UTIL_CFG_FILE_NAME,
77 | WFC_UTIL_CFG_TAG_END_OF_CFG,
78 | WFC_UTIL_CFG_TAG_MAC_ADDRESS,
79 | WFC_UTIL_CFG_TAG_END_OF_LINE,
80 | mac_add_buff,
81 | WFC_UTIL_CFG_LENGHT_MAC_STRING+1)) {
82 | printf("wfc_util_main : %s%s\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS, mac_add_buff);
83 | } else {
84 | printf("wfc_util_main : %s is not found\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS);
85 | }
86 |
87 | wfc_util_fset_string(WFC_UTIL_CFG_FILE_NAME,
88 | WFC_UTIL_CFG_TAG_END_OF_CFG,
89 | WFC_UTIL_CFG_TAG_AP_MAC_ADDRESS,
90 | WFC_UTIL_CFG_TAG_END_OF_LINE,
91 | "00900cbacd88");
92 |
93 | wfc_util_fset_string(WFC_UTIL_CFG_FILE_NAME,
94 | WFC_UTIL_CFG_TAG_END_OF_CFG,
95 | WFC_UTIL_CFG_TAG_MAC_ADDRESS,
96 | WFC_UTIL_CFG_TAG_END_OF_LINE,
97 | "00900cbacd88");
98 |
99 | if(0 < wfc_util_fget_string(WFC_UTIL_CFG_FILE_NAME,
100 | WFC_UTIL_CFG_TAG_END_OF_CFG,
101 | WFC_UTIL_CFG_TAG_MAC_ADDRESS,
102 | WFC_UTIL_CFG_TAG_END_OF_LINE,
103 | mac_add_buff,
104 | WFC_UTIL_CFG_LENGHT_MAC_STRING+1)) {
105 | printf("wfc_util_main : %s%s\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS, mac_add_buff);
106 |
107 | wfc_util_atoh(mac_add_buff, strlen(mac_add_buff), mac_add_buff_2, WFC_UTIL_CFG_LENGHT_MAC);
108 | printf("wfc_util_main : %s%02x:%02x:%02x:%02x:%02x:%02x\n",
109 | WFC_UTIL_CFG_TAG_MAC_ADDRESS,
110 | mac_add_buff_2[0], mac_add_buff_2[1], mac_add_buff_2[2],
111 | mac_add_buff_2[3], mac_add_buff_2[4], mac_add_buff_2[5]);
112 |
113 | wfc_util_htoa(mac_add_buff_2, WFC_UTIL_CFG_LENGHT_MAC, mac_add_buff, WFC_UTIL_CFG_LENGHT_MAC_STRING);
114 | printf("wfc_util_main : %s%s\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS, mac_add_buff);
115 |
116 | } else {
117 | printf("wfc_util_main : %s is not found\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS);
118 | }
119 |
120 | wfc_util_fset_buffer(WFC_UTIL_NV_BIN_FILE_NAME,
121 | WFC_UTIL_NV_BIN_POS_MAC_ADDR,
122 | mac_add_buff_3,
123 | WFC_UTIL_CFG_LENGHT_MAC);
124 |
125 | if(0 < wfc_util_fget_buffer(WFC_UTIL_NV_BIN_FILE_NAME,
126 | WFC_UTIL_NV_BIN_POS_MAC_ADDR,
127 | 6,
128 | mac_add_buff_2,
129 | WFC_UTIL_CFG_LENGHT_MAC)) {
130 | printf("wfc_util_main : wfc_util_fget_buffer[%02x:%02x:%02x:%02x:%02x:%02x]\n",
131 | mac_add_buff_2[0], mac_add_buff_2[1], mac_add_buff_2[2],
132 | mac_add_buff_2[3], mac_add_buff_2[4], mac_add_buff_2[5]);
133 | } else {
134 | printf("wfc_util_main : %s is not found\n", WFC_UTIL_CFG_TAG_MAC_ADDRESS);
135 | }
136 |
137 | return ret;
138 | }
139 |
140 |
--------------------------------------------------------------------------------
/light/Light.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The LineageOS 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 |
17 | #define LOG_TAG "LightService"
18 |
19 | #include "Light.h"
20 |
21 | #include
22 |
23 | namespace {
24 | using android::hardware::light::V2_0::LightState;
25 |
26 | static uint32_t rgbToBrightness(const LightState& state) {
27 | uint32_t color = state.color & 0x00ffffff;
28 | return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
29 | (29 * (color & 0xff))) >> 8;
30 | }
31 |
32 | static bool isLit(const LightState& state) {
33 | return (state.color & 0x00ffffff);
34 | }
35 | } // anonymous namespace
36 |
37 | namespace android {
38 | namespace hardware {
39 | namespace light {
40 | namespace V2_0 {
41 | namespace implementation {
42 |
43 | Light::Light(std::ofstream&& lcd_backlight, std::pair&& button_led,
44 | std::ofstream&& red_led, std::ofstream&& green_led, std::ofstream&& blue_led)
45 | : mLcdBacklight(std::move(lcd_backlight)),
46 | mButtonLed(std::move(button_led)),
47 | mRedLed(std::move(red_led)),
48 | mGreenLed(std::move(green_led)),
49 | mBlueLed(std::move(blue_led)) {
50 | auto attnFn(std::bind(&Light::setAttentionLight, this, std::placeholders::_1));
51 | auto backlightFn(std::bind(&Light::setLcdBacklight, this, std::placeholders::_1));
52 | auto buttonFn(std::bind(&Light::setButtonLight, this, std::placeholders::_1));
53 | auto batteryFn(std::bind(&Light::setBatteryLight, this, std::placeholders::_1));
54 | auto notifFn(std::bind(&Light::setNotificationLight, this, std::placeholders::_1));
55 | mLights.emplace(std::make_pair(Type::ATTENTION, attnFn));
56 | mLights.emplace(std::make_pair(Type::BACKLIGHT, backlightFn));
57 | mLights.emplace(std::make_pair(Type::BUTTONS, buttonFn));
58 | mLights.emplace(std::make_pair(Type::BATTERY, batteryFn));
59 | mLights.emplace(std::make_pair(Type::NOTIFICATIONS, notifFn));
60 | }
61 |
62 | // Methods from ::android::hardware::light::V2_0::ILight follow.
63 | Return Light::setLight(Type type, const LightState& state) {
64 | auto it = mLights.find(type);
65 |
66 | if (it == mLights.end()) {
67 | return Status::LIGHT_NOT_SUPPORTED;
68 | }
69 |
70 | it->second(state);
71 |
72 | return Status::SUCCESS;
73 | }
74 |
75 | Return Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) {
76 | std::vector types;
77 |
78 | for (auto const& light : mLights) {
79 | types.push_back(light.first);
80 | }
81 |
82 | _hidl_cb(types);
83 |
84 | return Void();
85 | }
86 |
87 | void Light::setAttentionLight(const LightState& state) {
88 | std::lock_guard lock(mLock);
89 | mAttentionState = state;
90 | setSpeakerBatteryLightLocked();
91 | }
92 |
93 | void Light::setLcdBacklight(const LightState& state) {
94 | std::lock_guard lock(mLock);
95 |
96 | uint32_t brightness = rgbToBrightness(state);
97 |
98 | mLcdBacklight << brightness << std::endl;
99 | }
100 |
101 | void Light::setButtonLight(const LightState& state) {
102 | std::lock_guard lock(mLock);
103 |
104 | uint32_t brightness = rgbToBrightness(state);
105 |
106 | mButtonLed.first << brightness << std::endl;
107 | mButtonLed.second << brightness << std::endl;
108 | }
109 |
110 | void Light::setBatteryLight(const LightState& state) {
111 | std::lock_guard lock(mLock);
112 | mBatteryState = state;
113 | setSpeakerBatteryLightLocked();
114 | }
115 |
116 | void Light::setNotificationLight(const LightState& state) {
117 | std::lock_guard lock(mLock);
118 | mNotificationState = state;
119 | setSpeakerBatteryLightLocked();
120 | }
121 |
122 | void Light::setSpeakerBatteryLightLocked() {
123 | if (isLit(mNotificationState)) {
124 | setSpeakerLightLocked(mNotificationState);
125 | } else if (isLit(mAttentionState)) {
126 | setSpeakerLightLocked(mAttentionState);
127 | } else if (isLit(mBatteryState)) {
128 | setSpeakerLightLocked(mBatteryState);
129 | } else {
130 | // Lights off
131 | mRedLed << 0 << std::endl;
132 | mGreenLed << 0 << std::endl;
133 | mBlueLed << 0 << std::endl;
134 | }
135 | }
136 |
137 | void Light::setSpeakerLightLocked(const LightState& state) {
138 | int red, green, blue;
139 | uint32_t alpha;
140 |
141 | // Extract brightness from AARRGGBB
142 | alpha = (state.color >> 24) & 0xff;
143 |
144 | // Retrieve each of the RGB colors
145 | red = (state.color >> 16) & 0xff;
146 | green = (state.color >> 8) & 0xff;
147 | blue = state.color & 0xff;
148 |
149 | // Scale RGB colors if a brightness has been applied by the user
150 | if (alpha != 0xff) {
151 | red = (red * alpha) / 0xff;
152 | green = (green * alpha) / 0xff;
153 | blue = (blue * alpha) / 0xff;
154 | }
155 |
156 | switch (state.flashMode) {
157 | case Flash::NONE:
158 | mRedLed << 1 << std::endl;
159 | mGreenLed << 1 << std::endl;
160 | mBlueLed << 1 << std::endl;
161 | break;
162 | default:
163 | mRedLed << 0 << std::endl;
164 | mGreenLed << 0 << std::endl;
165 | mBlueLed << 0 << std::endl;
166 | break;
167 | }
168 | mRedLed << red << std::endl;
169 | mGreenLed << green << std::endl;
170 | mBlueLed << blue << std::endl;
171 | }
172 |
173 | } // namespace implementation
174 | } // namespace V2_0
175 | } // namespace light
176 | } // namespace hardware
177 | } // namespace android
178 |
--------------------------------------------------------------------------------
/conn_init/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2005-2012, 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 |
7 | Unless required by applicable law or agreed to in writing, software
8 | distributed under the License is distributed on an "AS IS" BASIS,
9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | See the License for the specific language governing permissions and
11 | limitations under the License.
12 |
13 |
14 | Apache License
15 | Version 2.0, January 2004
16 | http://www.apache.org/licenses/
17 |
18 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
19 |
20 | 1. Definitions.
21 |
22 | "License" shall mean the terms and conditions for use, reproduction,
23 | and distribution as defined by Sections 1 through 9 of this document.
24 |
25 | "Licensor" shall mean the copyright owner or entity authorized by
26 | the copyright owner that is granting the License.
27 |
28 | "Legal Entity" shall mean the union of the acting entity and all
29 | other entities that control, are controlled by, or are under common
30 | control with that entity. For the purposes of this definition,
31 | "control" means (i) the power, direct or indirect, to cause the
32 | direction or management of such entity, whether by contract or
33 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
34 | outstanding shares, or (iii) beneficial ownership of such entity.
35 |
36 | "You" (or "Your") shall mean an individual or Legal Entity
37 | exercising permissions granted by this License.
38 |
39 | "Source" form shall mean the preferred form for making modifications,
40 | including but not limited to software source code, documentation
41 | source, and configuration files.
42 |
43 | "Object" form shall mean any form resulting from mechanical
44 | transformation or translation of a Source form, including but
45 | not limited to compiled object code, generated documentation,
46 | and conversions to other media types.
47 |
48 | "Work" shall mean the work of authorship, whether in Source or
49 | Object form, made available under the License, as indicated by a
50 | copyright notice that is included in or attached to the work
51 | (an example is provided in the Appendix below).
52 |
53 | "Derivative Works" shall mean any work, whether in Source or Object
54 | form, that is based on (or derived from) the Work and for which the
55 | editorial revisions, annotations, elaborations, or other modifications
56 | represent, as a whole, an original work of authorship. For the purposes
57 | of this License, Derivative Works shall not include works that remain
58 | separable from, or merely link (or bind by name) to the interfaces of,
59 | the Work and Derivative Works thereof.
60 |
61 | "Contribution" shall mean any work of authorship, including
62 | the original version of the Work and any modifications or additions
63 | to that Work or Derivative Works thereof, that is intentionally
64 | submitted to Licensor for inclusion in the Work by the copyright owner
65 | or by an individual or Legal Entity authorized to submit on behalf of
66 | the copyright owner. For the purposes of this definition, "submitted"
67 | means any form of electronic, verbal, or written communication sent
68 | to the Licensor or its representatives, including but not limited to
69 | communication on electronic mailing lists, source code control systems,
70 | and issue tracking systems that are managed by, or on behalf of, the
71 | Licensor for the purpose of discussing and improving the Work, but
72 | excluding communication that is conspicuously marked or otherwise
73 | designated in writing by the copyright owner as "Not a Contribution."
74 |
75 | "Contributor" shall mean Licensor and any individual or Legal Entity
76 | on behalf of whom a Contribution has been received by Licensor and
77 | subsequently incorporated within the Work.
78 |
79 | 2. Grant of Copyright License. Subject to the terms and conditions of
80 | this License, each Contributor hereby grants to You a perpetual,
81 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82 | copyright license to reproduce, prepare Derivative Works of,
83 | publicly display, publicly perform, sublicense, and distribute the
84 | Work and such Derivative Works in Source or Object form.
85 |
86 | 3. Grant of Patent License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | (except as stated in this section) patent license to make, have made,
90 | use, offer to sell, sell, import, and otherwise transfer the Work,
91 | where such license applies only to those patent claims licensable
92 | by such Contributor that are necessarily infringed by their
93 | Contribution(s) alone or by combination of their Contribution(s)
94 | with the Work to which such Contribution(s) was submitted. If You
95 | institute patent litigation against any entity (including a
96 | cross-claim or counterclaim in a lawsuit) alleging that the Work
97 | or a Contribution incorporated within the Work constitutes direct
98 | or contributory patent infringement, then any patent licenses
99 | granted to You under this License for that Work shall terminate
100 | as of the date such litigation is filed.
101 |
102 | 4. Redistribution. You may reproduce and distribute copies of the
103 | Work or Derivative Works thereof in any medium, with or without
104 | modifications, and in Source or Object form, provided that You
105 | meet the following conditions:
106 |
107 | (a) You must give any other recipients of the Work or
108 | Derivative Works a copy of this License; and
109 |
110 | (b) You must cause any modified files to carry prominent notices
111 | stating that You changed the files; and
112 |
113 | (c) You must retain, in the Source form of any Derivative Works
114 | that You distribute, all copyright, patent, trademark, and
115 | attribution notices from the Source form of the Work,
116 | excluding those notices that do not pertain to any part of
117 | the Derivative Works; and
118 |
119 | (d) If the Work includes a "NOTICE" text file as part of its
120 | distribution, then any Derivative Works that You distribute must
121 | include a readable copy of the attribution notices contained
122 | within such NOTICE file, excluding those notices that do not
123 | pertain to any part of the Derivative Works, in at least one
124 | of the following places: within a NOTICE text file distributed
125 | as part of the Derivative Works; within the Source form or
126 | documentation, if provided along with the Derivative Works; or,
127 | within a display generated by the Derivative Works, if and
128 | wherever such third-party notices normally appear. The contents
129 | of the NOTICE file are for informational purposes only and
130 | do not modify the License. You may add Your own attribution
131 | notices within Derivative Works that You distribute, alongside
132 | or as an addendum to the NOTICE text from the Work, provided
133 | that such additional attribution notices cannot be construed
134 | as modifying the License.
135 |
136 | You may add Your own copyright statement to Your modifications and
137 | may provide additional or different license terms and conditions
138 | for use, reproduction, or distribution of Your modifications, or
139 | for any such Derivative Works as a whole, provided Your use,
140 | reproduction, and distribution of the Work otherwise complies with
141 | the conditions stated in this License.
142 |
143 | 5. Submission of Contributions. Unless You explicitly state otherwise,
144 | any Contribution intentionally submitted for inclusion in the Work
145 | by You to the Licensor shall be under the terms and conditions of
146 | this License, without any additional terms or conditions.
147 | Notwithstanding the above, nothing herein shall supersede or modify
148 | the terms of any separate license agreement you may have executed
149 | with Licensor regarding such Contributions.
150 |
151 | 6. Trademarks. This License does not grant permission to use the trade
152 | names, trademarks, service marks, or product names of the Licensor,
153 | except as required for reasonable and customary use in describing the
154 | origin of the Work and reproducing the content of the NOTICE file.
155 |
156 | 7. Disclaimer of Warranty. Unless required by applicable law or
157 | agreed to in writing, Licensor provides the Work (and each
158 | Contributor provides its Contributions) on an "AS IS" BASIS,
159 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
160 | implied, including, without limitation, any warranties or conditions
161 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
162 | PARTICULAR PURPOSE. You are solely responsible for determining the
163 | appropriateness of using or redistributing the Work and assume any
164 | risks associated with Your exercise of permissions under this License.
165 |
166 | 8. Limitation of Liability. In no event and under no legal theory,
167 | whether in tort (including negligence), contract, or otherwise,
168 | unless required by applicable law (such as deliberate and grossly
169 | negligent acts) or agreed to in writing, shall any Contributor be
170 | liable to You for damages, including any direct, indirect, special,
171 | incidental, or consequential damages of any character arising as a
172 | result of this License or out of the use or inability to use the
173 | Work (including but not limited to damages for loss of goodwill,
174 | work stoppage, computer failure or malfunction, or any and all
175 | other commercial damages or losses), even if such Contributor
176 | has been advised of the possibility of such damages.
177 |
178 | 9. Accepting Warranty or Additional Liability. While redistributing
179 | the Work or Derivative Works thereof, You may choose to offer,
180 | and charge a fee for, acceptance of support, warranty, indemnity,
181 | or other liability obligations and/or rights consistent with this
182 | License. However, in accepting such obligations, You may act only
183 | on Your own behalf and on Your sole responsibility, not on behalf
184 | of any other Contributor, and only if You agree to indemnify,
185 | defend, and hold each Contributor harmless for any liability
186 | incurred by, or claims asserted against, such Contributor by reason
187 | of your accepting any such warranty or additional liability.
188 |
189 | END OF TERMS AND CONDITIONS
190 |
191 |
--------------------------------------------------------------------------------
/configs/libnfc-nxp.conf:
--------------------------------------------------------------------------------
1 | ## This file is used by NFC NXP NCI HAL(external/libnfc-nci/halimpl/pn547)
2 | ## and NFC Service Java Native Interface Extensions (packages/apps/Nfc/nci/jni/extns/pn547)
3 |
4 | ###############################################################################
5 | # Application options
6 | # Logging Levels
7 | # NXPLOG_DEFAULT_LOGLEVEL 0x01
8 | # ANDROID_LOG_DEBUG 0x03
9 | # ANDROID_LOG_WARN 0x02
10 | # ANDROID_LOG_ERROR 0x01
11 | # ANDROID_LOG_SILENT 0x00
12 | #
13 | NXPLOG_EXTNS_LOGLEVEL=0x03
14 | NXPLOG_NCIHAL_LOGLEVEL=0x03
15 | NXPLOG_NCIX_LOGLEVEL=0x03
16 | NXPLOG_NCIR_LOGLEVEL=0x03
17 | NXPLOG_FWDNLD_LOGLEVEL=0x03
18 | NXPLOG_TML_LOGLEVEL=0x03
19 |
20 | ###############################################################################
21 | # Nfc Device Node name
22 | NXP_NFC_DEV_NODE="/dev/pn547"
23 |
24 | ###############################################################################
25 | # Extension for Mifare reader enable
26 | # 0x00 - Disabled
27 | # 0x01 - Enabled
28 | MIFARE_READER_ENABLE=0x01
29 |
30 | ###############################################################################
31 | # File name for Firmware
32 | NXP_FW_NAME="libpn547_fw.so"
33 |
34 | ###############################################################################
35 | # System clock source selection configuration
36 | # CLK_SRC_XTAL - 0x01
37 | # CLK_SRC_PLL - 0x02
38 | NXP_SYS_CLK_SRC_SEL=0x02
39 |
40 | ###############################################################################
41 | # System clock frequency selection configuration for PLL
42 | # CLK_FREQ_13MHZ - 0x01
43 | # CLK_FREQ_19_2MHZ - 0x02
44 | # CLK_FREQ_24MHZ - 0x03
45 | # CLK_FREQ_26MHZ - 0x04
46 | # CLK_FREQ_38_4MHZ - 0x05
47 | # CLK_FREQ_52MHZ - 0x06
48 | NXP_SYS_CLK_FREQ_SEL=0x02
49 |
50 | ###############################################################################
51 | # The timeout value to be used for clock request acknowledgment
52 | # min value = 0x01 to max = 0x0A
53 | NXP_SYS_CLOCK_TO_CFG=0x02
54 |
55 | ###############################################################################
56 | # NXP proprietary settings
57 | NXP_ACT_PROP_EXTN={2F, 02, 00}
58 |
59 | ###############################################################################
60 | # NFC forum profile settings
61 | NXP_NFC_PROFILE_EXTN={20, 02, 05, 01, A0, 44, 01, 00}
62 |
63 | ###############################################################################
64 | # Standby enable settings
65 | # 0x00 - Disabled
66 | # 0x01 - Enabled
67 | NXP_CORE_STANDBY={2F, 00, 01, 01}
68 |
69 | ###############################################################################
70 | # NXP RF configuration settings for ALM/PLM settings
71 | NXP_RF_CONF_BLK_1={
72 | 20, 02, F7, 21,
73 | A0, 0E, 01, 01,
74 | A0, 0D, 03, 00, 40, 04,
75 | A0, 0D, 03, 04, 43, 20,
76 | A0, 0D, 03, 04, FF, 05,
77 | A0, 0D, 06, 06, 44, A3, 90, 03, 00,
78 | A0, 0D, 06, 06, 30, CF, 00, 08, 00,
79 | A0, 0D, 06, 06, 2F, 8F, 05, 80, 0C,
80 | A0, 0D, 04, 06, 03, 00, 71,
81 | A0, 0D, 03, 06, 48, 1A,
82 | A0, 0D, 03, 06, 43, A0,
83 | A0, 0D, 06, 06, 42, 00, 00, F3, F3,
84 | A0, 0D, 06, 06, 41, 80, 00, 00, 00,
85 | A0, 0D, 03, 06, 37, 18,
86 | A0, 0D, 03, 06, 16, 00,
87 | A0, 0D, 03, 06, 15, 00,
88 | A0, 0D, 06, 06, FF, 05, 00, 00, 00,
89 | A0, 0D, 06, 08, 44, 00, 00, 00, 00,
90 | A0, 0D, 06, 20, 4A, 00, 00, 00, 00,
91 | A0, 0D, 06, 20, 42, 88, 10, FF, FF,
92 | A0, 0D, 03, 20, 16, 00,
93 | A0, 0D, 03, 20, 15, 00,
94 | A0, 0D, 06, 22, 44, 22, 00, 02, 00,
95 | A0, 0D, 06, 22, 2D, 50, 44, 0C, 00,
96 | A0, 0D, 04, 32, 03, 40, 3D,
97 | A0, 0D, 06, 32, 42, 00, 00, FF, FF,
98 | A0, 0D, 03, 32, 16, 00,
99 | A0, 0D, 03, 32, 15, 01,
100 | A0, 0D, 03, 32, 0D, 22,
101 | A0, 0D, 03, 32, 14, 22,
102 | A0, 0D, 06, 32, 4A, 30, 0F, 01, 1F,
103 | A0, 0D, 06, 34, 2D, 24, 77, 0C, 00,
104 | A0, 0D, 06, 34, 44, 21, 00, 02, 00,
105 | A0, 0D, 06, 35, 44, 21, 00, 02, 00
106 | }
107 |
108 | NXP_RF_CONF_BLK_2={
109 | 20, 02, F4, 1F,
110 | A0, 0D, 06, 38, 4A, 53, 07, 01, 1B,
111 | A0, 0D, 06, 38, 42, 68, 10, FF, FF,
112 | A0, 0D, 03, 38, 16, 00,
113 | A0, 0D, 03, 38, 15, 00,
114 | A0, 0D, 06, 3A, 2D, 15, 47, 0D, 00,
115 | A0, 0D, 06, 3C, 4A, 52, 07, 01, 1B,
116 | A0, 0D, 06, 3C, 42, 68, 10, FF, FF,
117 | A0, 0D, 03, 3C, 16, 00,
118 | A0, 0D, 03, 3C, 15, 00,
119 | A0, 0D, 06, 3E, 2D, 15, 47, 0D, 00,
120 | A0, 0D, 06, 40, 42, F0, 10, FF, FF,
121 | A0, 0D, 03, 40, 0D, 02,
122 | A0, 0D, 03, 40, 14, 02,
123 | A0, 0D, 06, 40, 4A, 12, 07, 00, 00,
124 | A0, 0D, 03, 40, 16, 00,
125 | A0, 0D, 03, 40, 15, 00,
126 | A0, 0D, 06, 42, 2D, 15, 47, 0D, 00,
127 | A0, 0D, 06, 46, 44, 21, 00, 02, 00,
128 | A0, 0D, 06, 46, 2D, 05, 47, 0E, 00,
129 | A0, 0D, 06, 44, 4A, 33, 07, 01, 07,
130 | A0, 0D, 06, 44, 42, 88, 10, FF, FF,
131 | A0, 0D, 03, 44, 16, 00,
132 | A0, 0D, 03, 44, 15, 00,
133 | A0, 0D, 06, 4A, 44, 22, 00, 02, 00,
134 | A0, 0D, 06, 4A, 2D, 05, 37, 0C, 00,
135 | A0, 0D, 06, 48, 4A, 33, 07, 01, 07,
136 | A0, 0D, 06, 48, 42, 88, 10, FF, FF,
137 | A0, 0D, 03, 48, 16, 00,
138 | A0, 0D, 03, 48, 15, 00,
139 | A0, 0D, 06, 4E, 44, 22, 00, 02, 00,
140 | A0, 0D, 06, 4E, 2D, 05, 37, 0C, 00
141 | }
142 | NXP_RF_CONF_BLK_3={
143 | 20, 02, F7, 1E,
144 | A0, 0D, 06, 4C, 4A, 33, 07, 01, 07,
145 | A0, 0D, 06, 4C, 42, 88, 10, FF, FF,
146 | A0, 0D, 03, 4C, 16, 00,
147 | A0, 0D, 03, 4C, 15, 00,
148 | A0, 0D, 06, 52, 44, 22, 00, 02, 00,
149 | A0, 0D, 06, 52, 2D, 05, 25, 0C, 00,
150 | A0, 0D, 06, 50, 42, 90, 10, FF, FF,
151 | A0, 0D, 06, 50, 4A, 11, 0F, 01, 07,
152 | A0, 0D, 03, 50, 16, 00,
153 | A0, 0D, 03, 50, 15, 00,
154 | A0, 0D, 06, 56, 2D, 05, 9E, 0C, 00,
155 | A0, 0D, 06, 56, 44, 22, 00, 02, 00,
156 | A0, 0D, 06, 5C, 2D, 05, 69, 0C, 00,
157 | A0, 0D, 06, 5C, 44, 21, 00, 02, 00,
158 | A0, 0D, 06, 54, 42, 88, 10, FF, FF,
159 | A0, 0D, 06, 54, 4A, 33, 07, 01, 07,
160 | A0, 0D, 03, 54, 16, 00,
161 | A0, 0D, 03, 54, 15, 00,
162 | A0, 0D, 06, 5A, 42, 90, 10, FF, FF,
163 | A0, 0D, 06, 5A, 4A, 31, 07, 01, 07,
164 | A0, 0D, 03, 5A, 16, 00,
165 | A0, 0D, 03, 5A, 15, 00,
166 | A0, 0D, 06, 98, 2F, AF, 05, 80, 0F,
167 | A0, 0D, 06, 9A, 42, 00, 00, FF, FF,
168 | A0, 0D, 06, 30, 44, A3, 90, 03, 00,
169 | A0, 0D, 06, 6C, 44, A3, 90, 03, 00,
170 | A0, 0D, 06, 6C, 30, CF, 00, 08, 00,
171 | A0, 0D, 06, 6C, 2F, 8F, 05, 80, 0C,
172 | A0, 0D, 06, 70, 2F, 8F, 05, 80, 12,
173 | A0, 0D, 06, 70, 30, CF, 00, 08, 00
174 | }
175 | NXP_RF_CONF_BLK_4={
176 | 20, 02, F7, 1E,
177 | A0, 0D, 06, 74, 2F, 8F, 05, 80, 12,
178 | A0, 0D, 06, 74, 30, DF, 00, 07, 00,
179 | A0, 0D, 06, 78, 2F, 1F, 06, 80, 01,
180 | A0, 0D, 06, 78, 30, 3F, 00, 04, 00,
181 | A0, 0D, 06, 78, 44, A2, 90, 03, 00,
182 | A0, 0D, 03, 78, 47, 00,
183 | A0, 0D, 06, 7C, 2F, AF, 05, 80, 0F,
184 | A0, 0D, 06, 7C, 30, CF, 00, 07, 00,
185 | A0, 0D, 06, 7C, 44, A3, 90, 03, 00,
186 | A0, 0D, 06, 7D, 30, CF, 00, 08, 00,
187 | A0, 0D, 06, 80, 2F, AF, 05, 80, 90,
188 | A0, 0D, 06, 80, 44, A3, 90, 03, 00,
189 | A0, 0D, 06, 84, 2F, AF, 05, 80, 92,
190 | A0, 0D, 06, 84, 44, A3, 90, 03, 00,
191 | A0, 0D, 06, 88, 2F, 7F, 04, 80, 10,
192 | A0, 0D, 06, 88, 30, 5F, 00, 16, 00,
193 | A0, 0D, 03, 88, 47, 00,
194 | A0, 0D, 06, 88, 44, A1, 90, 03, 00,
195 | A0, 0D, 03, 0C, 48, 1A,
196 | A0, 0D, 03, 10, 43, 20,
197 | A0, 0D, 06, 6A, 42, F8, 10, FF, FF,
198 | A0, 0D, 03, 6A, 16, 00,
199 | A0, 0D, 03, 6A, 15, 01,
200 | A0, 0D, 06, 6A, 4A, 30, 0F, 01, 1F,
201 | A0, 0D, 06, 8C, 42, 88, 10, FF, FF,
202 | A0, 0D, 06, 8C, 4A, 33, 07, 01, 07,
203 | A0, 0D, 03, 8C, 16, 00,
204 | A0, 0D, 03, 8C, 15, 00,
205 | A0, 0D, 06, 92, 42, 90, 10, FF, FF,
206 | A0, 0D, 06, 92, 4A, 31, 07, 01, 07
207 | }
208 |
209 | ###############################################################################
210 | # Core configuration extensions
211 | # It includes
212 | # A002 - Clock Request
213 | # 0x00 - Disabled
214 | # 0x01 - Enabled
215 | # A003 - Clock Selection
216 | # Please refer to User Manual
217 | # A004 - Clock Time Out
218 | # Defined in ms
219 | # A00E - Load Modulation Mode
220 | # 0x00 - PLM
221 | # 0x01 - ALM
222 | # A012 - SWP interface 2 configuration
223 | # 0x00 - SWP
224 | # 0x02 - DWP
225 | # Please refer to User Manual
226 | # A040-A043 - Ultra Low Power Tag Detector
227 | # Please refer to Application Note of ULPTD
228 | # A05E - Jewel Reader
229 | # Please refer to User Manual
230 | # A0CD - SWP S1 line behavior
231 | # Defined S1 High time out during Activation sequence
232 | # A0EC - SWP1 interface
233 | # 0x00 - Disabled
234 | # 0x01 - Enabled
235 | # A0ED - SWP2 interface
236 | # 0x00 - Disabled
237 | # 0x01 - Enabled
238 | NXP_CORE_CONF_EXTN_PM={20, 02, 30, 0B,
239 | A0, 02, 01, 01,
240 | A0, 03, 01, 11,
241 | A0, 04, 01, 02,
242 | A0, 06, 01, 01,
243 | A0, 11, 04, 01, 22, 67, CD,
244 | A0, 5E, 01, 01,
245 | A0, CD, 01, 0F,
246 | A0, EC, 01, 01,
247 | A0, ED, 01, 00,
248 | A0, CB, 01, 78,
249 | A0, CE, 01, 7F
250 | }
251 |
252 | NXP_CORE_CONF_EXTN_XTAL={20, 02, 30, 0B,
253 | A0, 02, 01, 01,
254 | A0, 03, 01, 08,
255 | A0, 04, 01, 02,
256 | A0, 06, 01, 01,
257 | A0, 11, 04, 14, 0B, B8, 14,
258 | A0, 5E, 01, 01,
259 | A0, CD, 01, 0F,
260 | A0, EC, 01, 01,
261 | A0, ED, 01, 00,
262 | A0, CB, 01, 78,
263 | A0, CE, 01, 7F
264 | }
265 |
266 | NXP_CORE_CONF_EXTN={20, 02, 2C, 0A,
267 | A0, 02, 01, 01,
268 | A0, 03, 01, 11,
269 | A0, 04, 01, 02,
270 | A0, 11, 04, 01, 22, 67, CD,
271 | A0, 5E, 01, 01,
272 | A0, CD, 01, 0F,
273 | A0, EC, 01, 01,
274 | A0, ED, 01, 00,
275 | A0, CB, 01, 78,
276 | A0, CE, 01, 7F
277 | }
278 |
279 | ###############################################################################
280 | # apply Low Power Polling(LPM) Algorithm, detecting RF field using short-term single carrier
281 | # NORMAL Polling : {20, 02, 11, 04, A0, 40, 01, 00, A0, 41, 01, 04, A0, 42, 01, 19, A0, 43, 01, 50}
282 | # LPM Polling : {20, 02, 11, 04, A0, 40, 01, 01, A0, 41, 01, 04, A0, 42, 01, 19, A0, 43, 01, 00}
283 | # HYBRID Polling : {20, 02, 11, 04, A0, 40, 01, 01, A0, 41, 01, 04, A0, 42, 01, 19, A0, 43, 01, 04}
284 |
285 | NXP_POLLING_MODE={20, 02, 11, 04,
286 | A0, 40, 01, 01,
287 | A0, 41, 01, 04,
288 | A0, 42, 01, 19,
289 | A0, 43, 01, 04
290 | }
291 |
292 | ###############################################################################
293 | # Core configuration settings
294 | NXP_CORE_CONF={ 20, 02, 2B, 0D,
295 | 18, 01, 01,
296 | 21, 01, 00,
297 | 28, 01, 00,
298 | 30, 01, 08,
299 | 31, 01, 03,
300 | 33, 04, 01, 02, 03, 04,
301 | 50, 01, 02,
302 | 54, 01, 06,
303 | 5B, 01, 00,
304 | 60, 01, 0E,
305 | 80, 01, 01,
306 | 81, 01, 01,
307 | 82, 01, 0E
308 | }
309 |
310 | ###############################################################################
311 | # Mifare Classic Key settings
312 | #NXP_CORE_MFCKEY_SETTING={20, 02, 25,04, A0, 51, 06, A0, A1, A2, A3, A4, A5,
313 | # A0, 52, 06, D3, F7, D3, F7, D3, F7,
314 | # A0, 53, 06, FF, FF, FF, FF, FF, FF,
315 | # A0, 54, 06, 00, 00, 00, 00, 00, 00}
316 |
317 | ###############################################################################
318 | # Default SE Options
319 | # No secure element 0x00
320 | # eSE 0x01
321 | # UICC 0x02
322 |
323 | NXP_DEFAULT_SE=0x02
324 |
325 | ###############################################################################
326 | NXP_DEFAULT_NFCEE_TIMEOUT=0x06
327 |
328 | ###############################################################################
329 | #Enable SWP full power mode when phone is power off
330 | NXP_SWP_FULL_PWR_ON=0x00
331 |
332 | ###############################################################################
333 | #Chip type
334 | #PN547C2 0x01
335 | #PN65T 0x02
336 |
337 | NXP_NFC_CHIP=0x01
338 |
339 | ###############################################################################
340 | #SWP Reader feature
341 | #Timeout in seconds
342 | NXP_SWP_RD_START_TIMEOUT=0x0A
343 | #Timeout in seconds
344 | NXP_SWP_RD_TAG_OP_TIMEOUT=0x01
345 |
--------------------------------------------------------------------------------
/configs/libnfc-nci.conf:
--------------------------------------------------------------------------------
1 | ###################### Start of libnfc-brcm.conf #######################
2 |
3 | ###############################################################################
4 | # Application options
5 | APPL_TRACE_LEVEL=0xFF
6 | PROTOCOL_TRACE_LEVEL=0xFFFFFFFF
7 |
8 | ###############################################################################
9 | # performance measurement
10 | # Change this setting to control how often USERIAL log the performance (throughput)
11 | # data on read/write/poll
12 | # defailt is to log performance dara for every 100 read or write
13 | #REPORT_PERFORMANCE_MEASURE=100
14 |
15 | ###############################################################################
16 | # File used for NFA storage
17 | NFA_STORAGE="/data/nfc"
18 |
19 | ###############################################################################
20 | # Snooze Mode Settings
21 | #
22 | # By default snooze mode is enabled. Set SNOOZE_MODE_CFG byte[0] to 0
23 | # to disable.
24 | #
25 | # If SNOOZE_MODE_CFG is not provided, the default settings are used:
26 | # They are as follows:
27 | # 8 Sleep Mode (0=Disabled 1=UART 8=SPI/I2C)
28 | # 0 Idle Threshold Host
29 | # 0 Idle Threshold HC
30 | # 0 NFC Wake active mode (0=ActiveLow 1=ActiveHigh)
31 | # 1 Host Wake active mode (0=ActiveLow 1=ActiveHigh)
32 | #
33 | #SNOOZE_MODE_CFG={08:00:00:00:01}
34 |
35 | ###############################################################################
36 | # Insert a delay in milliseconds after NFC_WAKE and before write to NFCC
37 | #NFC_WAKE_DELAY=20
38 |
39 | ###############################################################################
40 | # Various Delay settings (in ms) used in USERIAL
41 | # POWER_ON_DELAY
42 | # Delay after turning on chip, before writing to transport (default 300)
43 | # PRE_POWER_OFF_DELAY
44 | # Delay after deasserting NFC-Wake before turn off chip (default 0)
45 | # POST_POWER_OFF_DELAY
46 | # Delay after turning off chip, before USERIAL_close returns (default 0)
47 | #
48 | #POWER_ON_DELAY=300
49 | #PRE_POWER_OFF_DELAY=0
50 | #POST_POWER_OFF_DELAY=0
51 |
52 | ###############################################################################
53 | # Maximum time (ms) to wait for RESET NTF after setting REG_PU to high
54 | # The default is 1000.
55 | #NFCC_ENABLE_TIMEOUT=0
56 |
57 | ###############################################################################
58 | # LPTD mode configuration
59 | # byte[0] is the length of the remaining bytes in this value
60 | # if set to 0, LPTD params will NOT be sent to NFCC (i.e. disabled).
61 | # byte[1] is the param id it should be set to B9.
62 | # byte[2] is the length of the LPTD parameters
63 | # byte[3] indicates if LPTD is enabled
64 | # if set to 0, LPTD will be disabled (parameters will still be sent).
65 | # byte[4-n] are the LPTD parameters.
66 | # By default, LPTD is enabled and default settings are used.
67 | # See nfc_hal_dm_cfg.c for defaults
68 | #LPTD_CFG={23:B9:21:01:02:FF:FF:04:A0:0F:40:00:80:02:02:10:00:00:00:31:0C:30:00:00:00:00:00:00:00:00:00:00:00:00:00:00}
69 |
70 | ###############################################################################
71 | # Startup Configuration (100 bytes maximum)
72 | #
73 | # For the 0xCA parameter, byte[9] (marked by 'AA') is for UICC0, and byte[10] (marked by BB) is
74 | # for UICC1. The values are defined as:
75 | # 0 : UICCx only supports ISO_DEP in low power mode.
76 | # 2 : UICCx only supports Mifare in low power mode.
77 | # 3 : UICCx supports both ISO_DEP and Mifare in low power mode.
78 | #
79 | # AA BB
80 | #NFA_DM_START_UP_CFG={1F:CB:01:01:A5:01:01:CA:14:00:00:00:00:06:E8:03:00:00:00:00:00:00:00:00:00:00:00:00:00:80:01:01}
81 |
82 | ###############################################################################
83 | # Startup Vendor Specific Configuration (100 bytes maximum);
84 | # byte[0] TLV total len = 0x5
85 | # byte[1] NCI_MTS_CMD|NCI_GID_PROP = 0x2f
86 | # byte[2] NCI_MSG_FRAME_LOG = 0x9
87 | # byte[3] 2
88 | # byte[4] 0=turn off RF frame logging; 1=turn on
89 | # byte[5] 0=turn off SWP frame logging; 1=turn on
90 | # NFA_DM_START_UP_VSC_CFG={05:2F:09:02:01:01}
91 |
92 | ###############################################################################
93 | # Antenna Configuration - This data is used when setting 0xC8 config item
94 | # at startup (before discovery is started). If not used, no value is sent.
95 | #
96 | # The settings for this value are documented here:
97 | # http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
98 | # Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx
99 | # This document is maintained by Paul Forshaw.
100 | #
101 | # The values marked as ?? should be tweaked per antenna or customer/app:
102 | # {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04}
103 | # array[0] = 0x20 is length of the payload from array[1] to the end
104 | # array[1] = 0xC8 is PREINIT_DSP_CFG
105 | #PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04}
106 |
107 | ###############################################################################
108 | # Configure crystal frequency when internal LPO can't detect the frequency.
109 | #XTAL_FREQUENCY=0
110 | ###############################################################################
111 | # Configure the default Destination Gate used by HCI (the default is 4, which
112 | # is the ETSI loopback gate.
113 | NFA_HCI_DEFAULT_DEST_GATE=0xF0
114 |
115 | ###############################################################################
116 | # Configure the single default SE to use. The default is to use the first
117 | # SE that is detected by the stack. This value might be used when the phone
118 | # supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
119 | # one of them (e.g. 0xF4).
120 | #ACTIVE_SE=0xF3
121 |
122 | ###############################################################################
123 | # Configure the default NfcA/IsoDep techology and protocol route. Can be
124 | # either a secure element (e.g. 0xF4) or the host (0x00)
125 | #DEFAULT_ISODEP_ROUTE=0x00
126 |
127 | ###############################################################################
128 | # Configure the NFC Extras to open and use a static pipe. If the value is
129 | # not set or set to 0, then the default is use a dynamic pipe based on a
130 | # destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value
131 | # for each UICC (where F3="UICC0" and F4="UICC1")
132 | #NFA_HCI_STATIC_PIPE_ID_F3=0x70
133 | #NFA_HCI_STATIC_PIPE_ID_01=0x19
134 | NFA_HCI_STATIC_PIPE_ID_C0=0x19
135 | ###############################################################################
136 | # When disconnecting from Oberthur secure element, perform a warm-reset of
137 | # the secure element to deselect the applet.
138 | # The default hex value of the command is 0x3. If this variable is undefined,
139 | # then this feature is not used.
140 | #OBERTHUR_WARM_RESET_COMMAND=0x03
141 |
142 | ###############################################################################
143 | # Force UICC to only listen to the following technology(s).
144 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
145 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F
146 | UICC_LISTEN_TECH_MASK=0x07
147 |
148 | ###############################################################################
149 | # Force HOST listen feature enable or disable.
150 | # 0: Disable
151 | # 1: Enable
152 | HOST_LISTEN_ENABLE=0x01
153 |
154 | ###############################################################################
155 | # Enabling/Disabling Forward functionality
156 | # Disable 0x00
157 | # Enable 0x01
158 | NXP_FWD_FUNCTIONALITY_ENABLE=0x00
159 |
160 | ###############################################################################
161 | # Allow UICC to be powered off if there is no traffic.
162 | # Timeout is in ms. If set to 0, then UICC will not be powered off.
163 | #UICC_IDLE_TIMEOUT=30000
164 | UICC_IDLE_TIMEOUT=0
165 |
166 | ###############################################################################
167 | # AID for Empty Select command
168 | # If specified, this AID will be substituted when an Empty SELECT command is
169 | # detected. The first byte is the length of the AID. Maximum length is 16.
170 | AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00}
171 |
172 | ###############################################################################
173 | # This setting allows you to disable registering the T4t Virtual SE that causes
174 | # the NFCC to send PPSE requests to the DH.
175 | # The default setting is enabled (i.e. T4t Virtual SE is registered).
176 | #REGISTER_VIRTUAL_SE=1
177 |
178 | ###############################################################################
179 | # When screen is turned off, specify the desired power state of the controller.
180 | # 0: power-off-sleep state; DEFAULT
181 | # 1: full-power state
182 | # 2: screen-off card-emulation (CE4/CE3/CE1 modes are used)
183 | SCREEN_OFF_POWER_STATE=1
184 |
185 | ###############################################################################
186 | # Firmware patch file
187 | # If the value is not set then patch download is disabled.
188 | #FW_PATCH="/vendor/firmware/bcm2079x_firmware.ncd"
189 |
190 | ###############################################################################
191 | # Firmware pre-patch file (sent before the above patch file)
192 | # If the value is not set then pre-patch is not used.
193 | #FW_PRE_PATCH="/vendor/firmware/bcm2079x_pre_firmware.ncd"
194 |
195 | ###############################################################################
196 | # Firmware patch format
197 | # 1 = HCD
198 | # 2 = NCD (default)
199 | #NFA_CONFIG_FORMAT=2
200 |
201 | ###############################################################################
202 | # SPD Debug mode
203 | # If set to 1, any failure of downloading a patch will trigger a hard-stop
204 | #SPD_DEBUG=0
205 |
206 | ###############################################################################
207 | # SPD Max Retry Count
208 | # The number of attempts to download a patch before giving up (defualt is 3).
209 | # Note, this resets after a power-cycle.
210 | #SPD_MAX_RETRY_COUNT=3
211 |
212 | ###############################################################################
213 | # transport driver
214 | #
215 | # TRANSPORT_DRIVER=
216 | #
217 | # where can be, for example:
218 | # "/dev/ttyS" (UART)
219 | # "/dev/bcmi2cnfc" (I2C)
220 | # "hwtun" (HW Tunnel)
221 | # "/dev/bcmspinfc" (SPI)
222 | # "/dev/btusb0" (BT USB)
223 | #TRANSPORT_DRIVER="/dev/bcm2079x-i2c"
224 |
225 | ###############################################################################
226 | # power control driver
227 | # Specify a kernel driver that support ioctl commands to control NFC_EN and
228 | # NFC_WAKE gpio signals.
229 | #
230 | # POWER_CONTRL_DRIVER=
231 | # where can be, for example:
232 | # "/dev/nfcpower"
233 | # "/dev/bcmi2cnfc" (I2C)
234 | # "/dev/bcmspinfc" (SPI)
235 | # i2c and spi driver may be used to control NFC_EN and NFC_WAKE signal
236 | #POWER_CONTROL_DRIVER="/dev/bcm2079x-i2c"
237 |
238 | ###############################################################################
239 | # I2C transport driver options
240 | # Mako does not support 10-bit I2C addresses
241 | # Revert to 7-bit address
242 | #BCMI2CNFC_ADDRESS=0x77
243 |
244 | ###############################################################################
245 | # I2C transport driver try to read multiple packets in read() if data is available
246 | # remove the comment below to enable this feature
247 | #READ_MULTIPLE_PACKETS=1
248 |
249 | ###############################################################################
250 | # SPI transport driver options
251 | #SPI_NEGOTIATION={0A:F0:00:01:00:00:00:FF:FF:00:00}
252 |
253 | ###############################################################################
254 | # UART transport driver options
255 | #
256 | # PORT=1,2,3,...
257 | # BAUD=115200, 19200, 9600, 4800,
258 | # DATABITS=8, 7, 6, 5
259 | # PARITY="even" | "odd" | "none"
260 | # STOPBITS="0" | "1" | "1.5" | "2"
261 |
262 | #UART_PORT=2
263 | #UART_BAUD=115200
264 | #UART_DATABITS=8
265 | #UART_PARITY="none"
266 | #UART_STOPBITS="1"
267 |
268 | ###############################################################################
269 | # Insert a delay in microseconds per byte after a write to NFCC.
270 | # after writing a block of data to the NFCC, delay this an amopunt of time before
271 | # writing next block of data. the delay is calculated as below
272 | # NFC_WRITE_DELAY * (number of byte written) / 1000 milliseconds
273 | # e.g. after 259 bytes is written, delay (259 * 20 / 1000) 5 ms before next write
274 | #NFC_WRITE_DELAY=20
275 |
276 | ###############################################################################
277 | # Maximum Number of Credits to be allowed by the NFCC
278 | # This value overrides what the NFCC specifices allowing the host to have
279 | # the control to work-around transport limitations. If this value does
280 | # not exist or is set to 0, the NFCC will provide the number of credits.
281 | MAX_RF_DATA_CREDITS=1
282 |
283 | ###############################################################################
284 | # Default poll duration (in ms)
285 | # The default is 500ms if not set (see nfc_target.h)
286 | #NFA_DM_DISC_DURATION_POLL=333
287 | ###############################################################################
288 | # Antenna Configuration - This data is used when setting 0xC8 config item
289 | # at startup (before discovery is started). If not used, no value is sent.
290 | #
291 | # The settings for this value are documented here:
292 | # http://wcgbu.broadcom.com/wpan/PM/Project%20Document%20Library/bcm20791B0/
293 | # Design/Doc/PHY%20register%20settings/BCM20791-B2-1027-02_PHY_Recommended_Reg_Settings.xlsx
294 | # This document is maintained by Paul Forshaw.
295 | #
296 | # The values marked as ?? should be tweaked per antenna or customer/app:
297 | # {20:C8:1E:06:??:00:??:??:??:00:??:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:??:01:00:00:40:04}
298 | # array[0] = 0x20 is length of the payload from array[1] to the end
299 | # array[1] = 0xC8 is PREINIT_DSP_CFG
300 | #PREINIT_DSP_CFG={20:C8:1E:06:1F:00:0F:03:3C:00:04:24:00:1C:00:75:00:77:00:76:00:1C:00:03:00:0A:00:48:01:00:00:40:04}
301 |
302 | ###############################################################################
303 | # Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
304 | # 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
305 | # 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
306 | # 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
307 | # 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
308 | # 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
309 | #PRESENCE_CHECK_ALGORITHM=0
310 |
311 | ###############################################################################
312 | # Force tag polling for the following technology(s).
313 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
314 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B |
315 | # NFA_TECHNOLOGY_MASK_F | NFA_TECHNOLOGY_MASK_ISO15693 |
316 | # NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_KOVIO |
317 | # NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE.
318 | #
319 | # Notable bits:
320 | # NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
321 | # NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
322 | # NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
323 | # NFA_TECHNOLOGY_MASK_ISO15693 0x08 /* Proprietary Technology */
324 | # NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
325 | # NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
326 | # NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
327 | POLLING_TECH_MASK=0xEF
328 |
329 | ###############################################################################
330 | # Force P2P to only listen for the following technology(s).
331 | # The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
332 | # Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_F |
333 | # NFA_TECHNOLOGY_MASK_A_ACTIVE | NFA_TECHNOLOGY_MASK_F_ACTIVE
334 | #
335 | # Notable bits:
336 | # NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
337 | # NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
338 | # NFA_TECHNOLOGY_MASK_A_ACTIVE 0x40 /* NFC Technology A active mode */
339 | # NFA_TECHNOLOGY_MASK_F_ACTIVE 0x80 /* NFC Technology F active mode */
340 | P2P_LISTEN_TECH_MASK=0xC4
341 |
342 | PRESERVE_STORAGE=0x01
343 |
344 | ###############################################################################
345 | # Override the stack default for NFA_EE_MAX_EE_SUPPORTED set in nfc_target.h.
346 | # The value is set to 3 by default as it assumes we will discover 0xF2,
347 | # 0xF3, and 0xF4. If a platform will exclude and SE, this value can be reduced
348 | # so that the stack will not wait any longer than necessary.
349 |
350 | # Maximum EE supported number
351 | # NXP PN547C2 0x02
352 | # NXP PN65T 0x03
353 | # NXP PN548C2 0x02
354 | # NXP PN66T 0x03
355 | NFA_MAX_EE_SUPPORTED=0x02
356 |
357 | ###############################################################################
358 | # NCI Hal Module name
359 | NCI_HAL_MODULE="nfc_nci"
360 |
361 | ##############################################################################
362 | # Deactivate notification wait time out in seconds used in ETSI Reader mode
363 | # 0 - Infinite wait
364 | NFA_DM_DISC_NTF_TIMEOUT=100
365 |
366 | ###############################################################################
367 | # AID_MATCHING constants
368 | # AID_MATCHING_EXACT_ONLY 0x00
369 | # AID_MATCHING_EXACT_OR_PREFIX 0x01
370 | # AID_MATCHING_PREFIX_ONLY 0x02
371 | AID_MATCHING_MODE=0x01
372 |
373 | ###############################################################################
374 | # Default Secure Element route id
375 | DEFAULT_OFFHOST_ROUTE=0x02
376 |
377 | ###############################################################################
378 | # Vendor Specific Proprietary Protocol & Discovery Configuration
379 | # Set to 0xFF if unsupported
380 | # byte[0] NCI_PROTOCOL_18092_ACTIVE
381 | # byte[1] NCI_PROTOCOL_B_PRIME
382 | # byte[2] NCI_PROTOCOL_DUAL
383 | # byte[3] NCI_PROTOCOL_15693
384 | # byte[4] NCI_PROTOCOL_KOVIO
385 | # byte[5] NCI_PROTOCOL_MIFARE
386 | # byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
387 | # byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
388 | # byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
389 | NFA_PROPRIETARY_CFG={05:FF:FF:06:81:80:77:FF:FF}
390 |
391 | ###############################################################################
392 | # Bail out mode
393 | # If set to 1, NFCC is using bail out mode for either Type A or Type B poll.
394 | NFA_POLL_BAIL_OUT_MODE=0x01
395 |
396 | ###############################################################################
397 | # Enable/Disable NFC-F HCE
398 | # Disable 0x00
399 | # Enable non-zero value
400 | ENABLE_NFCF_HCE=0x00
401 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_fctrl.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include "wfc_util_log.h"
27 |
28 | /*
29 | static void wfc_util_printf(char *pSPointer, int length)
30 | {
31 | char *pPrintBuff = NULL;
32 |
33 | if( NULL == pSPointer || 0 >= length ) {
34 | wfc_util_log_error("wfc_util_printf : unvalid parameters");
35 | return;
36 | }
37 |
38 | wfc_util_log_error("wfc_util_printf : lenght is (%d)", length);
39 | pPrintBuff = malloc(length+1);
40 |
41 | if( NULL != pPrintBuff ) {
42 | memset( pPrintBuff, 0, (length+1) );
43 | memcpy(pPrintBuff, pSPointer, length);
44 |
45 | wfc_util_log_error("wfc_util_printf : %s", pPrintBuff);
46 |
47 | free(pPrintBuff);
48 | } else {
49 | wfc_util_log_error("wfc_util_printf : can not malloc(%d)", (length+1));
50 | }
51 | return;
52 | }
53 | */
54 |
55 | static void wfc_util_finsert_new_string(int fd, char **ppReadedBuff, char *pNewStringValue, char *pEndOfCfg)
56 | {
57 | off_t sz_file;
58 | int sz_backupBuff = 0;
59 | char *pReadBuff = NULL, *pBackupBuff = NULL;
60 | char *pSPointer = NULL, *pETagPointer = NULL;
61 |
62 | if( 0 == fd || NULL == pNewStringValue || 0 == strlen(pNewStringValue) ) {
63 | wfc_util_log_error("wfc_util_finsert_new_string : unvalid parameters");
64 | return;
65 | }
66 |
67 | if( NULL == ppReadedBuff) {
68 | // TODO:
69 | return;
70 | } else {
71 | pReadBuff = *ppReadedBuff;
72 | }
73 |
74 | /*
75 | * find END TAG string
76 | */
77 | pETagPointer = strstr(pReadBuff, pEndOfCfg);
78 | pSPointer = pETagPointer - 1;
79 |
80 | /*
81 | * calcurate file size and size of the tail of file
82 | */
83 | sz_file = lseek( fd, 0, SEEK_END );
84 | sz_backupBuff = (int)sz_file - (pETagPointer - pReadBuff);
85 |
86 | /*
87 | * prefare the buffer to store the tail of file
88 | */
89 | pBackupBuff = malloc(sz_backupBuff);
90 |
91 | if( NULL != pBackupBuff ) {
92 | /*
93 | * copy the tail of file.
94 | */
95 | memset( pBackupBuff, 0, sz_backupBuff );
96 | memcpy( pBackupBuff, pETagPointer, sz_backupBuff );
97 |
98 | /*
99 | * write new string.
100 | */
101 | lseek( fd, (int)(pSPointer-pReadBuff), SEEK_SET );
102 | write( fd, pNewStringValue, strlen(pNewStringValue));
103 |
104 | /*
105 | * update pETagPointer.
106 | */
107 | pETagPointer = pSPointer + strlen(pNewStringValue);
108 |
109 | /*
110 | * write the tail of file.
111 | */
112 | lseek( fd, (int)(pETagPointer-pReadBuff), SEEK_SET );
113 | write( fd, pBackupBuff, sz_backupBuff );
114 |
115 | ftruncate(fd, sz_file + strlen(pNewStringValue) - 1); /* we use "-1" becasue of "pSPointer = pETagPointer - 1"*/
116 |
117 | free(pBackupBuff);
118 |
119 | /*
120 | * make new *ppReadedBuff
121 | */
122 | if( NULL != ppReadedBuff) {
123 | // TODO:
124 | }
125 | } else {
126 | wfc_util_log_error("wfc_util_finsert_new_string : can not malloc(%d)", sz_backupBuff);
127 | }
128 |
129 | return;
130 | }
131 |
132 | static void wfc_util_fupdate_string(int fd, char **ppReadedBuff,
133 | char *pETagPointer, char *pSValuePointer, char *pNewValueString)
134 | {
135 | off_t sz_file;
136 | int sz_newReadBuff = 0;
137 | char *pReadBuff = NULL, *pNewReadBuff = NULL, *pCurReadBuff = NULL;
138 |
139 | if( 0 == fd ) {
140 | wfc_util_log_error("wfc_util_fupdate_string : unvalid parameters");
141 | return;
142 | }
143 |
144 | if( NULL == ppReadedBuff) {
145 | // TODO:
146 | return;
147 | } else {
148 | pReadBuff = *ppReadedBuff;
149 | }
150 |
151 | /*
152 | * calcurate file size and new file size
153 | */
154 | sz_file = lseek( fd, 0, SEEK_END );
155 | sz_newReadBuff = (int)sz_file - (int)(pETagPointer - pSValuePointer) + strlen(pNewValueString);
156 |
157 | /*
158 | * prefare the buffer to read file
159 | */
160 | pNewReadBuff = malloc(sz_newReadBuff);
161 |
162 | if( NULL != pNewReadBuff ) {
163 | /*
164 | * copy buffer
165 | */
166 | memset( pNewReadBuff, 0, sz_file );
167 | pCurReadBuff = pNewReadBuff;
168 | memcpy( pNewReadBuff, pReadBuff, (int)(pSValuePointer-pReadBuff) );
169 | pCurReadBuff += (int)(pSValuePointer-pReadBuff);
170 |
171 | /*
172 | * copy new value string
173 | */
174 | memcpy( pCurReadBuff, pNewValueString, strlen(pNewValueString));
175 | pCurReadBuff += strlen(pNewValueString);
176 |
177 | /*
178 | * copy the remained buffer
179 | */
180 | memcpy( pCurReadBuff, pETagPointer, ((int)(sz_file) - (int)(pETagPointer - pReadBuff) + 1));
181 |
182 | /*
183 | * write file and update the file size
184 | */
185 | lseek( fd, 0, SEEK_SET );
186 | write( fd, pNewReadBuff, sz_newReadBuff);
187 | ftruncate(fd, sz_newReadBuff);
188 |
189 | free(pNewReadBuff);
190 | } else {
191 | wfc_util_log_error("wfc_util_fupdate_string : can not malloc(%d)", (int)sz_newReadBuff);
192 | }
193 |
194 | return;
195 | }
196 |
197 | /*
198 | * wfc_util_fset_buffer
199 | *
200 | * return : void
201 | */
202 | void wfc_util_fset_buffer(char *pFileName, int positionStart, unsigned char *pNewValue, int newValueLength)
203 | {
204 | int fd;
205 | off_t sz_file;
206 | char *pReadBuff = NULL;
207 |
208 | fd = open( pFileName, O_RDWR );
209 |
210 | if( fd >= 0 ) {
211 | /*
212 | * calcurate file size
213 | */
214 | sz_file = lseek( fd, 0, SEEK_END );
215 |
216 | /*
217 | * prefare the buffer to read file
218 | */
219 | pReadBuff = malloc(sz_file + 1); // null terminated
220 |
221 | if( NULL != pReadBuff ) {
222 | /*
223 | * read file
224 | */
225 | memset( pReadBuff, 0, sz_file + 1);
226 | lseek( fd, 0, SEEK_SET );
227 | read( fd, pReadBuff, sz_file );
228 |
229 | if(sz_file >= (positionStart+newValueLength)) {
230 | lseek( fd, positionStart, SEEK_SET );
231 | write( fd, pNewValue, newValueLength );
232 | } else {
233 | /*
234 | * insert with new length value buffer
235 | */
236 | wfc_util_log_error("wfc_util_fset_buffer : file size(%d) is less than to write position(%d)", (int)sz_file, (positionStart+newValueLength));
237 | // TODO:
238 | }
239 |
240 | free(pReadBuff);
241 | } else {
242 | wfc_util_log_error("wfc_util_fset_buffer : can not malloc(%d)", (int)sz_file);
243 | }
244 |
245 | if ( -1 == fsync( fd ) ) {
246 | wfc_util_log_error("wfc_util_fset_buffer : fail to fsync()");
247 | }
248 |
249 | close( fd );
250 | } else {
251 | wfc_util_log_error("wfc_util_fset_buffer : can not open file");
252 | }
253 |
254 | return;
255 | }
256 |
257 | /*
258 | * wfc_util_fget_buffer
259 | *
260 | * return : it will return the length of the stored buffer value if procedure is success
261 | * or will return 0 if not.
262 | */
263 | int wfc_util_fget_buffer(char *pFileName, int positionStart, int lengthToRead, unsigned char *pValueBuff, int buffLength)
264 | {
265 | int result = 0;
266 | int fd;
267 | off_t sz_file;
268 | char *pReadBuff = NULL;
269 | char *pSValuePointer = NULL, *pETagPointer = NULL;
270 |
271 | fd = open( pFileName, O_RDONLY );
272 |
273 | if( fd >= 0 ) {
274 | /*
275 | * calcurate file size
276 | */
277 | sz_file = lseek( fd, 0, SEEK_END );
278 |
279 | if(sz_file >= (positionStart+lengthToRead)) {
280 | /*
281 | * prefare the buffer to read file
282 | */
283 | pReadBuff = malloc(sz_file + 1); // null terminated
284 |
285 | if( NULL != pReadBuff ) {
286 | /*
287 | * read file
288 | */
289 | memset( pReadBuff, 0, sz_file + 1 );
290 | lseek( fd, 0, SEEK_SET );
291 | read( fd, pReadBuff, sz_file );
292 |
293 | /*
294 | * calculate the start buffer pointer
295 | */
296 | pSValuePointer = pReadBuff + positionStart;
297 |
298 | /*
299 | * calculate the end buffer pointer
300 | */
301 | pETagPointer = pSValuePointer + lengthToRead;
302 |
303 | /*
304 | * read the string value
305 | */
306 | if( buffLength >= (int)(pETagPointer-pSValuePointer) ) {
307 | memset( pValueBuff, 0, buffLength );
308 | memcpy( pValueBuff, pSValuePointer, (int)(pETagPointer-pSValuePointer) );
309 | result = (int)(pETagPointer-pSValuePointer);
310 | } else {
311 | wfc_util_log_error("wfc_util_fget_buffer : not enough string value buffer(%d)", (int)(pETagPointer-pSValuePointer));
312 | }
313 |
314 | free(pReadBuff);
315 | } else {
316 | wfc_util_log_error("wfc_util_fget_buffer : can not malloc(%d)", (int)sz_file);
317 | }
318 | } else {
319 | wfc_util_log_error("wfc_util_fget_buffer : file size(%d) is less than to read position(%d)", (int)sz_file, (positionStart+lengthToRead));
320 | }
321 | close( fd );
322 | } else {
323 | wfc_util_log_error("wfc_util_fget_buffer : can not open file");
324 | }
325 |
326 | return result;
327 | }
328 |
329 | /*
330 | * wfc_util_fset_string
331 | *
332 | * The following format string will be added or updated to the file pFileName.
333 | * [pSTagString][pNewValueString][pETagString]
334 | *
335 | * pFileName : file name and path
336 | * pEndOfCfg : tag string to notify the end of configuration file
337 | * pSTagString : tag string to notify purpose of the value
338 | * pETagString : tag string to notify the end of the value
339 | * pNewValueString : string to set for pSTagString
340 | *
341 | * return : void
342 | */
343 | void wfc_util_fset_string(char *pFileName, char *pEndOfCfg, char *pSTagString, char *pETagString, char *pNewValueString)
344 | {
345 | int fd;
346 | off_t sz_file;
347 | int sz_NewValueBuff = 0;
348 | char *pReadBuff = NULL, *pNewValueBuff = NULL;
349 | char *pSPointer = NULL, *pETagPointer = NULL, *pSValuePointer = NULL;
350 |
351 | fd = open( pFileName, O_RDWR );
352 |
353 | if( fd >= 0 ) {
354 | /*
355 | * calcurate file size
356 | */
357 | sz_file = lseek( fd, 0, SEEK_END );
358 |
359 | /*
360 | * prefare the buffer to read file
361 | */
362 | if (sz_file > 0)
363 | pReadBuff = malloc(sz_file + 1); // null terminated
364 |
365 | if( NULL != pReadBuff ) {
366 | /*
367 | * read file
368 | */
369 | memset( pReadBuff, 0x00, sz_file + 1);
370 | if(lseek(fd, 0, SEEK_SET) != 0) {
371 | wfc_util_log_error("lseek failure");
372 | }
373 | read( fd, pReadBuff, sz_file );
374 |
375 | /* WBT fix, make sure it is terminated with \0 */
376 | pReadBuff[sz_file] = '\0';
377 |
378 | /*
379 | * find TAG string
380 | */
381 | pSPointer = strstr(pReadBuff, pSTagString);
382 |
383 | if(NULL != pSPointer) {
384 | /*
385 | * find END OF LINE string
386 | */
387 | pETagPointer = strstr(pSPointer, pETagString);
388 |
389 | if(NULL != pETagPointer) {
390 | /*
391 | * write the new string value
392 | */
393 | pSValuePointer = pSPointer+strlen(pSTagString);
394 | if(strlen(pNewValueString) == (unsigned int)(pETagPointer-pSValuePointer)) {
395 | lseek( fd, (int)(pSValuePointer-pReadBuff), SEEK_SET );
396 | write( fd, pNewValueString, strlen(pNewValueString));
397 | } else {
398 | /*
399 | * insert with new length value string
400 | */
401 | wfc_util_fupdate_string(fd, &pReadBuff, pETagPointer, pSValuePointer, pNewValueString);
402 | }
403 | } else {
404 | wfc_util_log_error("wfc_util_fset_string : can not find End TAG");
405 | }
406 | } else {
407 | /*
408 | * "\n""[Start TAG][String Value][End TAG]""\n"
409 | */
410 | sz_NewValueBuff = strlen(pSTagString) +
411 | strlen(pNewValueString) +
412 | strlen(pETagString) +
413 | 2 + 1;
414 | pNewValueBuff = malloc( sz_NewValueBuff);
415 |
416 | if( NULL != pNewValueBuff ) {
417 | /*
418 | * prefare the new string to insert
419 | */
420 | memset( pNewValueBuff, 0, sz_NewValueBuff );
421 | sprintf( pNewValueBuff, "%c%s%s%s%c", '\n', pSTagString, pNewValueString, pETagString,'\n' );
422 |
423 | /*
424 | * insert new string to the file
425 | */
426 | wfc_util_finsert_new_string(fd, &pReadBuff, pNewValueBuff, pEndOfCfg);
427 |
428 | free( pNewValueBuff );
429 | } else {
430 | wfc_util_log_error("wfc_util_fset_string : can not malloc(%d)", (int)sz_file);
431 | }
432 | }
433 |
434 | free(pReadBuff);
435 | } else {
436 | wfc_util_log_error("wfc_util_fset_string : can not malloc(%d)", (int)sz_file);
437 | }
438 |
439 | if ( -1 == fsync( fd ) ) {
440 | wfc_util_log_error("wfc_util_fset_string : fail to fsync()");
441 | }
442 |
443 | close( fd );
444 | } else {
445 | wfc_util_log_error("wfc_util_fset_string : can not open file");
446 | }
447 |
448 | return;
449 | }
450 |
451 | /*
452 | * wfc_util_fget_string
453 | *
454 | * Read value from the following format string in the file pFileName.
455 | * [pSTagString][string value to read][pETagString]
456 | *
457 | * pFileName : file name and path
458 | * pSTagString : tag string to notify purpose of the value
459 | * pETagString : tag string to notify the end of the value
460 | * pValueStringBuff : string buffer to get string value
461 | * stringBuffLength : the length of pValueStringBuff
462 | *
463 | * return : it will return the length of the stored string value if procedure is success
464 | * or will return 0 if not.
465 | */
466 | int wfc_util_fget_string(char *pFileName, char *pSTagString, char *pETagString, char *pValueStringBuff, int stringBuffLength)
467 | {
468 | int result = 0;
469 | int fd;
470 | off_t sz_file;
471 | char *pReadBuff = NULL;
472 | char *pSPointer = NULL, *pETagPointer = NULL, *pSValuePointer = NULL;
473 |
474 | fd = open( pFileName, O_RDONLY );
475 |
476 | if( fd >= 0 ) {
477 | /*
478 | * calcurate file size
479 | */
480 | sz_file = lseek( fd, 0, SEEK_END );
481 |
482 | /*
483 | * prefare the buffer to read file
484 | */
485 | if (sz_file > 0) // skip when value is 0
486 | pReadBuff = malloc(sz_file + 1);
487 |
488 | if( NULL != pReadBuff ) {
489 | /*
490 | * read file
491 | */
492 | memset( pReadBuff, 0, sz_file + 1);
493 | if(lseek(fd, 0, SEEK_SET) != 0) {
494 | wfc_util_log_error("lseek failure");
495 | }
496 | read( fd, pReadBuff, sz_file );
497 |
498 | /* WBT fix, make sure it is terminated with \0 */
499 | pReadBuff[sz_file] = '\0';
500 |
501 | /*
502 | * find TAG string
503 | */
504 | pSPointer = strstr( pReadBuff, pSTagString );
505 |
506 | if( NULL != pSPointer ) {
507 | /*
508 | * find END OF LINE string
509 | */
510 | pETagPointer = strstr(pSPointer, pETagString);
511 |
512 | if( NULL != pETagPointer ) {
513 | /*
514 | * read the string value
515 | */
516 | pSValuePointer = pSPointer+strlen(pSTagString);
517 | if( stringBuffLength >= (int)(pETagPointer-pSValuePointer) ) {
518 | memset( pValueStringBuff, 0, stringBuffLength );
519 | memcpy( pValueStringBuff, pSValuePointer, (int)(pETagPointer-pSValuePointer) );
520 | result = (int)(pETagPointer-pSValuePointer);
521 | } else {
522 | wfc_util_log_error("wfc_util_fget_string : not enough string value buffer(%d)", (int)(pETagPointer-pSValuePointer));
523 | }
524 | } else {
525 | wfc_util_log_error("wfc_util_fget_string : can not find End TAG");
526 | }
527 | } else {
528 | wfc_util_log_error("wfc_util_fget_string : can not find Start TAG");
529 | }
530 | free(pReadBuff);
531 | } else {
532 | wfc_util_log_error("wfc_util_fget_string : can not malloc(%d)", (int)sz_file);
533 | }
534 | close( fd );
535 | } else {
536 | wfc_util_log_error("wfc_util_fget_string : can not open file");
537 | }
538 |
539 | return result;
540 | }
541 |
542 | /*
543 | * wfc_util_ffile_check
544 | *
545 | * check whether pDestFName file exist or not
546 | *
547 | * pFileName : file name and path
548 | * access_mode : R_OK | W_OK | X_OK | F_OK
549 | *
550 | * return : it will return 0 if the file exist
551 | * or will return -1 if not.
552 | */
553 | int wfc_util_ffile_check(char *pDestFName, int access_mode)
554 | {
555 | struct stat st;
556 |
557 | if (access(pDestFName, access_mode) == 0) {
558 | if( stat( pDestFName, &st ) < 0 ) {
559 | wfc_util_log_error("Cannot stat the file \"%s\": %s", pDestFName, strerror(errno));
560 | return -1;
561 | }
562 | //check if config file has some data or is it empty due to previous errors
563 | if( st.st_size ) {
564 | return 0;
565 | }
566 | } else {
567 | wfc_util_log_error("Cannot access \"%s\": %s", pDestFName, strerror(errno));
568 | }
569 |
570 | return -1;
571 | }
572 |
573 | /*
574 | * wfc_util_ffile_check_copy
575 | *
576 | * check whether pDestFName file exist if not it will copy from pSourceFName file
577 | *
578 | * return : it will return 0 if procedure is success
579 | * or will return -1 if not.
580 | */
581 | int wfc_util_ffile_check_copy(char *pDestFName, char *pSourceFName, mode_t mode, uid_t uID, gid_t gID)
582 | {
583 | #define WFC_BUFFER_SIZE 2048
584 | char buf[WFC_BUFFER_SIZE] = {0}; // Null terminated
585 | int srcfd, destfd;
586 | int nread;
587 | struct stat st;
588 |
589 | if (access(pDestFName, R_OK|W_OK) == 0) {
590 | if( stat( pDestFName, &st ) < 0 ) {
591 | wfc_util_log_error("Cannot stat the file \"%s\": %s", pDestFName, strerror(errno));
592 | return -1;
593 | }
594 | //check if config file has some data or is it empty due to previous errors
595 | if( st.st_size ) {
596 | return 0;
597 | }
598 | //else continue to write the config from default template.
599 | } else if (errno != ENOENT) {
600 | wfc_util_log_error("Cannot access \"%s\": %s", pDestFName, strerror(errno));
601 | return -1;
602 | }
603 |
604 | srcfd = open(pSourceFName, O_RDONLY);
605 | if (srcfd < 0) {
606 | wfc_util_log_error("Cannot open \"%s\": %s", pSourceFName, strerror(errno));
607 | return -1;
608 | }
609 |
610 | destfd = open(pDestFName, O_CREAT|O_WRONLY, mode);
611 | if (destfd < 0) {
612 | close(srcfd);
613 | wfc_util_log_error("Cannot create \"%s\": %s", pDestFName, strerror(errno));
614 | return -1;
615 | }
616 |
617 | while ((nread = read(srcfd, buf, WFC_BUFFER_SIZE-1)) != 0) {
618 | if (nread < 0) {
619 | wfc_util_log_error("Error reading \"%s\": %s", pSourceFName, strerror(errno));
620 | close(srcfd);
621 | close(destfd);
622 | unlink(pDestFName);
623 | return -1;
624 | }
625 | // WBT fix, according to manual, the number of bytes read can't be bigger than read_size. I don't know why WBT complains for this.
626 | if (nread < WFC_BUFFER_SIZE)
627 | buf[nread] = '\0';
628 | else {
629 | buf[WFC_BUFFER_SIZE-1] = '\0';
630 | nread = WFC_BUFFER_SIZE-1;
631 | }
632 | write(destfd, buf, nread);
633 | }
634 |
635 | close(destfd);
636 | close(srcfd);
637 |
638 | /* remove this code because of permission problem when it is accessed from "atd" having system permission. */
639 | {
640 | #ifndef CONFIG_SKY_WLAN_WIFI_PATCH
641 | uid_t uid = getuid();
642 | gid_t gid = getgid();
643 | wfc_util_log_error("Error changing group ownership (%d) of %s to %d: %s", gid, pDestFName, gID, strerror(errno));
644 | if (0 == uid) {
645 | #endif /* CONFIG_SKY_WLAN_WIFI_PATCH */
646 | if (chown(pDestFName, uID, gID) < 0) {
647 | wfc_util_log_error("Error changing group ownership of %s to %d: %s", pDestFName, gID, strerror(errno));
648 | unlink(pDestFName);
649 | return -1;
650 | }
651 | #ifndef CONFIG_SKY_WLAN_WIFI_PATCH
652 | } else {
653 | wfc_util_log_error("wfc_util_ffile_check_copy : we can not excute chown[uid = %d, gid = %d]", uid, getgid());
654 | }
655 | #endif /* CONFIG_SKY_WLAN_WIFI_PATCH */
656 | }
657 |
658 | return 0;
659 | }
660 |
661 |
--------------------------------------------------------------------------------
/conn_init/wfc_util_qcom.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 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 |
17 | #ifdef CONFIG_SKY_WLAN_QCOM_PATCH
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include "wfc_util_log.h"
24 | #include "wfc_util_fctrl.h"
25 | #include "wfc_util_common.h"
26 |
27 | #include "private/android_filesystem_config.h"
28 |
29 | #define WFC_UTIL_FEAUTRE_COPY_NV_BIN
30 |
31 | #ifdef WLAN_CHIP_VERSION_WCNSS
32 | #ifndef WFC_UTIL_CFG_FILE_NAME
33 | #define WFC_UTIL_CFG_FILE_NAME "/data/misc/wifi/WCNSS_qcom_cfg.ini"
34 | #endif
35 | #ifndef WFC_UTIL_CFG_TEMPFILE_NAME
36 | #define WFC_UTIL_CFG_TEMPFILE_NAME "/system/vendor/etc/wifi/WCNSS_qcom_cfg.ini"
37 | #endif
38 | #else /* WLAN_CHIP_VERSION_WCN1314 */
39 | #ifndef WFC_UTIL_CFG_FILE_NAME
40 | #define WFC_UTIL_CFG_FILE_NAME "/data/misc/wifi/WCN1314_qcom_cfg.ini"
41 | #endif
42 | #ifndef WFC_UTIL_CFG_TEMPFILE_NAME
43 | #define WFC_UTIL_CFG_TEMPFILE_NAME "/system/etc/wifi/WCN1314_qcom_cfg.ini"
44 | #endif
45 | #endif /* WLAN_CHIP_VERSION_XXXX */
46 |
47 | #ifdef WFC_UTIL_FEAUTRE_COPY_NV_BIN
48 | #ifdef WLAN_CHIP_VERSION_WCNSS
49 | #ifndef WFC_UTIL_NV_BIN_TEMPFILE_NAME
50 | #define WFC_UTIL_NV_BIN_TEMPFILE_NAME "/system/vendor/etc/wifi/WCNSS_qcom_wlan_nv.bin"
51 | #endif
52 | #ifndef WFC_UTIL_NV_BIN_FILE_NAME
53 | #define WFC_UTIL_NV_BIN_FILE_NAME "/data/misc/wifi/WCNSS_qcom_wlan_nv.bin"
54 | #endif
55 | #else /* WLAN_CHIP_VERSION_WCN1314 */
56 | #ifndef WFC_UTIL_NV_BIN_TEMPFILE_NAME
57 | #define WFC_UTIL_NV_BIN_TEMPFILE_NAME "/persist/WCN1314_qcom_wlan_nv.bin"
58 | #endif
59 | #ifndef WFC_UTIL_NV_BIN_FILE_NAME
60 | #define WFC_UTIL_NV_BIN_FILE_NAME "/data/misc/wifi/WCN1314_qcom_wlan_nv.bin"
61 | #endif
62 | #endif /* WLAN_CHIP_VERSION_XXXX */
63 | #else /* WFC_UTIL_FEAUTRE_COPY_NV_BIN */
64 | #ifndef WFC_UTIL_NV_BIN_FILE_NAME
65 | #ifdef WLAN_CHIP_VERSION_WCNSS
66 | #define WFC_UTIL_NV_BIN_FILE_NAME "/persist/WCNSS_qcom_wlan_nv.bin"
67 | #else /* WLAN_CHIP_VERSION_WCN1314 */
68 | #define WFC_UTIL_NV_BIN_FILE_NAME "/persist/WCN1314_qcom_wlan_nv.bin"
69 | #endif /* WLAN_CHIP_VERSION_XXXX */
70 | #endif
71 | #endif /* WFC_UTIL_FEAUTRE_COPY_NV_BIN */
72 |
73 | #define WFC_UTIL_CFG_TAG_END_OF_CFG "END"
74 | /*
75 | * Station Mode MAC Address
76 | */
77 | #ifdef WLAN_CHIP_VERSION_WCNSS
78 | #define WFC_UTIL_CFG_TAG_MAC_ADDRESS "Intf0MacAddress="
79 | #else /* WLAN_CHIP_VERSION_WCN1314 */
80 | #define WFC_UTIL_CFG_TAG_MAC_ADDRESS "NetworkAddress="
81 | #endif /* WLAN_CHIP_VERSION_XXXX */
82 | /*
83 | * AP Mode MAC Address
84 | */
85 | #define WFC_UTIL_CFG_TAG_AP_MAC_ADDRESS "gAPMacAddr="
86 |
87 | /*
88 | * Idle Mode Power Save enable/disable for OTA test
89 | */
90 | #define WFC_UTIL_CFG_TAG_IDLE_MODE_POWER_SAVE "gEnableImps="
91 |
92 | /*
93 | * Beacon Mode Power Save enable/disable for OTA test
94 | */
95 | #define WFC_UTIL_CFG_TAG_POWER_SAVE "gEnableBmps="
96 |
97 | /*
98 | * L2 roaming on/off for OTA test
99 | */
100 | #define WFC_UTIL_CFG_TAG_L2Roaming "gEnableHandoff="
101 |
102 | /*
103 | * Heartbeat24 changing for OtA test
104 | */
105 | #define WFC_UTIL_CFG_TAG_HEARTBEAT24 "gHeartbeat24="
106 |
107 | /*
108 | * TAG for end of line
109 | */
110 | #define WFC_UTIL_CFG_TAG_END_OF_LINE "\n"
111 |
112 | #define WFC_UTIL_CFG_LENGHT_MAC (6)
113 | #define WFC_UTIL_CFG_LENGHT_MAC_STRING (WFC_UTIL_CFG_LENGHT_MAC*2)
114 |
115 | /*
116 | * persist/WCNSS_qcom_wlan_nv.bin
117 | *
118 | * NV validity bitmap (4 bytes)
119 | * {
120 | * Bit 0 - Regulatory domain tables
121 | * Bit 1 - Fields(including product ID, product bands, number of Tx/Rx chains, MAC address, manufacturing board number)
122 | * Bit 2 - Optimal power per rate table
123 | * Bit 3 - Default regulatory domain and country code
124 | * Bit 4:31 - Reserved; always 0
125 | * }
126 | *
127 | * typedef PACKED_PRE struct PACKED_POST
128 | * {
129 | * //always ensure fields are aligned to 32-bit boundaries
130 | * tANI_U16 productId;
131 | * tANI_U8 productBands; //0: 0.4 GHz, 1: 2.4+5.0 GHz, 2: 5.0 GHz
132 | * tANI_U8 wlanNvRevId; //0: WCN1312, 1: WCN1314, 2: PRIMA
133 | *
134 | * tANI_U8 numOfTxChains;
135 | * tANI_U8 numOfRxChains;
136 | * tANI_U8 macAddr[NV_FIELD_MAC_ADDR_SIZE];
137 | * tANI_U8 mfgSN[NV_FIELD_MFG_SN_SIZE];
138 | * } sNvFields;
139 | */
140 | #define WFC_UTIL_NV_BIN_HEADER_LENGTH (4)
141 | #define WFC_UTIL_NV_BIN_POS_PRODUCT_ID (WFC_UTIL_NV_BIN_HEADER_LENGTH + 0)
142 | #define WFC_UTIL_NV_BIN_POS_MAC_ADDR (WFC_UTIL_NV_BIN_HEADER_LENGTH + 6)
143 |
144 | #ifdef WLAN_CHIP_VERSION_WCNSS
145 | /* refer to prima/CORE/WDA/src/wlan_nv.c */
146 | static unsigned char nvFilelds_default[6] = {0, 0, /* productId */
147 | 1, /* productBands */
148 | 2, /* wlanNvRevId */
149 | 1, /* numOfTxChains */
150 | 2}; /* numOfRxChains */
151 | #else /* WLAN_CHIP_VERSION_WCN1314 */
152 | static unsigned char nvFilelds_default[6] = {1, 0, /* productId */
153 | 1, /* productBands */
154 | 1, /* wlanNvRevId */
155 | 1, /* numOfTxChains */
156 | 1}; /* numOfRxChains */
157 | #endif /* WLAN_CHIP_VERSION_XXXX */
158 |
159 | /*
160 | * wfc_util_qcom_is_default_mac
161 | *
162 | *
163 | *
164 | * return : it will return 1 if mac_add is default mac address,
165 | * 2 if mac_add is RFT mac address
166 | * or 0 if not.
167 | */
168 | static int wfc_util_qcom_is_default_mac(char *mac_add)
169 | {
170 | #define WFC_UTIL_CFG_DEFAULT_MAC_RFT "00900CBACD88"
171 | #define WFC_UTIL_CFG_DEFAULT_MAC_00 "000000000000"
172 | #define WFC_UTIL_CFG_DEFAULT_MAC_FF "FFFFFFFFFFFF"
173 | #define WFC_UTIL_CFG_DEFAULT_MAC_QCOM_I0 "000AF58989FF"
174 | #define WFC_UTIL_CFG_DEFAULT_MAC_QCOM_I1 "000AF58989FE"
175 | #define WFC_UTIL_CFG_DEFAULT_MAC_QCOM_I2 "000AF58989FD"
176 | #define WFC_UTIL_CFG_DEFAULT_MAC_QCOM_I3 "000AF58989FC"
177 | #define WFC_UTIL_CFG_DEFAULT_MAC_QCOM_AP "000AF58989EF"
178 |
179 | int i, sZarray=0;
180 | /*
181 | * default mac address array
182 | */
183 | char mac_add_buff[][WFC_UTIL_CFG_LENGHT_MAC_STRING+1] = {
184 | {WFC_UTIL_CFG_DEFAULT_MAC_00},
185 | {WFC_UTIL_CFG_DEFAULT_MAC_FF},
186 | {WFC_UTIL_CFG_DEFAULT_MAC_QCOM_I0}
187 | };
188 |
189 | sZarray = sizeof(mac_add_buff) / sizeof(mac_add_buff[0]);
190 |
191 | for(i=0; i wfc_util_ffile_check_copy(WFC_UTIL_CFG_FILE_NAME,
539 | WFC_UTIL_CFG_TEMPFILE_NAME,
540 | 0660,
541 | AID_SYSTEM,
542 | /* we use "radio" for gid to access from "rild" for AT cmd. */
543 | AID_WIFI/*AID_WIFI*/)) {
544 | wfc_util_log_error("Fail to Access [%s]", WFC_UTIL_CFG_FILE_NAME);
545 | return -1;
546 | }
547 |
548 | #ifdef WFC_UTIL_FEAUTRE_COPY_NV_BIN
549 | if(0 > wfc_util_ffile_check_copy(WFC_UTIL_NV_BIN_FILE_NAME,
550 | WFC_UTIL_NV_BIN_TEMPFILE_NAME,
551 | 0660,
552 | AID_SYSTEM,
553 | /* we use "radio" for gid to access from "rild" for AT cmd. */
554 | AID_WIFI/*AID_WIFI*/)) {
555 | wfc_util_log_error("Fail to Access [%s]", WFC_UTIL_NV_BIN_FILE_NAME);
556 | return -1;
557 | }
558 | #endif /* WFC_UTIL_FEAUTRE_COPY_NV_BIN */
559 |
560 | /*
561 | * Read MAC address from config file
562 | */
563 | if(0 < wfc_util_fget_string(WFC_UTIL_CFG_FILE_NAME,
564 | WFC_UTIL_CFG_TAG_END_OF_CFG,
565 | WFC_UTIL_CFG_TAG_MAC_ADDRESS,
566 | WFC_UTIL_CFG_TAG_END_OF_LINE,
567 | mac_add_buff,
568 | WFC_UTIL_CFG_LENGHT_MAC_STRING+1)) {
569 | wfc_util_log_info("%s%s", WFC_UTIL_CFG_TAG_MAC_ADDRESS, mac_add_buff);
570 |
571 | /*
572 | * Write nv mac address
573 | */
574 | if (1 != wfc_util_qcom_write_mac_process(nv_mac_addr, mac_add_buff)) {
575 | /*
576 | * Check whether this is default mac address or not
577 | */
578 | if (wfc_util_qcom_is_default_mac(mac_add_buff)) {
579 | /*
580 | * Create random MAC address
581 | */
582 | wfc_util_qcom_create_random_mac();
583 | }
584 | }
585 | } else {
586 | wfc_util_log_error("%s does not have mac address", WFC_UTIL_CFG_FILE_NAME);
587 |
588 | memset( mac_add_buff, 0, WFC_UTIL_CFG_LENGHT_MAC_STRING+1 );
589 |
590 | /*
591 | * Write nv mac address
592 | */
593 | if (1 != wfc_util_qcom_write_mac_process(nv_mac_addr, mac_add_buff)) {
594 | /*
595 | * Create random MAC address
596 | */
597 | wfc_util_qcom_create_random_mac();
598 | }
599 | }
600 |
601 | return 0;
602 | }
603 |
604 | /*
605 | * wfc_util_qcom_reset_mac
606 | *
607 | * reset the mac address of config file
608 | *
609 | * return : void
610 | */
611 | void wfc_util_qcom_reset_mac(void)
612 | {
613 | wfc_util_qcom_write_mac("000000000000");
614 |
615 | wfc_util_qcom_reset_mac_to_bin();
616 |
617 | return;
618 | }
619 |
620 | /*
621 | * wfc_util_qcom_ota_enable
622 | *
623 | * enable ota mode by reconfiguring BMPS and L2Roaming
624 | *
625 | * return : int (boolean)
626 | */
627 | int wfc_util_qcom_ota_enable(void)
628 | {
629 | wfc_util_qcom_write_ota_enable();
630 | return 1;
631 | }
632 |
633 | /*
634 | * wfc_util_qcom_ota_disable
635 | *
636 | * disable ota mode by reconfiguring BMPS and L2Roaming
637 | *
638 | * return : int (boolean)
639 | */
640 | int wfc_util_qcom_ota_disable(void)
641 | {
642 | wfc_util_qcom_write_ota_disable();
643 | return 1;
644 | }
645 |
646 | /*
647 | * wfc_util_qcom_checkt_roaming_off
648 | *
649 | * Check L2Roaming configuration
650 | *
651 | * return : int (boolean)
652 | */
653 | int wfc_util_qcom_checkt_roaming_off(void)
654 | {
655 | char string_buff[5];
656 | /*
657 | * check whether OTA test is enabled or not.
658 | */
659 | if(0 < wfc_util_fget_string(WFC_UTIL_CFG_FILE_NAME,
660 | WFC_UTIL_CFG_TAG_END_OF_CFG,
661 | //WFC_UTIL_CFG_TAG_L2Roaming,
662 | WFC_UTIL_CFG_TAG_POWER_SAVE,
663 | WFC_UTIL_CFG_TAG_END_OF_LINE,
664 | string_buff,
665 | 5)) {
666 | //wfc_util_log_info("%s%s", WFC_UTIL_CFG_TAG_L2Roaming, string_buff);
667 | wfc_util_log_info("%s%s", WFC_UTIL_CFG_TAG_POWER_SAVE, string_buff);
668 | if(0 == strncmp(string_buff, "0", 1)) {
669 | return 1;
670 | }
671 | }
672 | return 0;
673 | }
674 |
675 | #endif /* CONFIG_SKY_WLAN_QCOM_PATCH */
676 |
677 |
--------------------------------------------------------------------------------