sanders: add shim for wifi_qsap_set_tx_power

Change-Id: I9ef277db6f4e068e7b92710f6039b4f261d72282
This commit is contained in:
Dan Pasanen
2018-02-05 08:35:30 -06:00
committed by therootlord
parent 4501be51f5
commit c6ea6e0279
4 changed files with 88 additions and 1 deletions

View File

@@ -344,6 +344,10 @@ PRODUCT_PACKAGES += \
android.hardware.sensors@1.0-impl \
sensorservice_32
# Shims
PRODUCT_PACKAGES += \
libqsap_shim
# Thermal
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/thermal-engine-sanders.conf:system/vendor/etc/thermal-engine.conf

View File

@@ -42,3 +42,12 @@ LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := libqsap_shim.c
LOCAL_SHARED_LIBRARIES := libqsap_sdk liblog
LOCAL_C_INCLUDES := $(TOP)/system/qcom/softap/sdk
LOCAL_MODULE := libqsap_shim
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_SHARED_LIBRARY)

74
libshims/libqsap_shim.c Normal file
View File

@@ -0,0 +1,74 @@
#include "qsap_api.h"
#include <sys/socket.h>
#include <linux/wireless.h>
#include "cutils/log.h"
// Keep in sync with system/qcom/softap/sdk/qsap_api.c
struct Command qsap_str[eSTR_LAST] = {
{ "wpa", NULL },
{ "accept_mac_file", NULL },
{ "deny_mac_file", NULL },
{ "gAPMacAddr", "00deadbeef04" },/** AP MAC address */
{ "gEnableApProt", "1" },/** protection flag in ini file */
{ "gFixedRate", "0" },/** Fixed rate in ini */
{ "gTxPowerCap", "27" },/** Tx power in ini */
{ "gFragmentationThreshold", "2346" },/** Fragmentation threshold in ini */
{ "RTSThreshold", "2347" },/** RTS threshold in ini */
{ "gAPCntryCode", "USI" },/** Country code in ini */
{ "gDisableIntraBssFwd", "0" },/** Intra-bss forward in ini */
{ "WmmIsEnabled", "0" },/** WMM */
{ "g11dSupportEnabled", "1" },/** 802.11d support */
{ "ieee80211n", NULL },
{ "ctrl_interface", NULL },
{ "interface", NULL },
{ "eap_server", NULL },
{ "gAPAutoShutOff", "0" },
{ "gEnablePhyAgcListenMode", "128" },
};
// system/qcom/softap/sdk/qsap_api.h
#define eERR_SET_TX_POWER (eERR_GET_AUTO_CHAN + 1)
s32 wifi_qsap_set_tx_power(s32 tx_power)
{
#define QCSAP_IOCTL_SET_MAX_TX_POWER (SIOCIWFIRSTPRIV + 22)
s32 sock;
s32 ret = eERR_SET_TX_POWER;
s8 interface[128];
s8 *iface;
s32 len = 128;
struct iwreq wrq;
if(NULL == (iface = qsap_get_config_value(CONFIG_FILE, &qsap_str[STR_INTERFACE], interface, (u32*)&len))) {
ALOGE("%s :interface error \n", __func__);
return ret;
}
/* Issue QCSAP_IOCTL_SET_MAX_TX_POWER ioctl */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
ALOGE("%s :socket error \n", __func__);
return eERR_SET_TX_POWER;
}
strlcpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name));
wrq.u.data.length = sizeof(s32);
wrq.u.data.pointer = &tx_power;
wrq.u.data.flags = 0;
ret = ioctl(sock, QCSAP_IOCTL_SET_MAX_TX_POWER, &wrq);
close(sock);
if (ret) {
ALOGE("%s :IOCTL set tx power failed: %ld\n", __func__, ret);
ret = eERR_SET_TX_POWER;
} else {
ALOGD("%s :IOCTL set tx power issued\n", __func__);
ret = eSUCCESS;
}
return ret;
}

View File

@@ -58,7 +58,7 @@ on fs
on init
# Symbols required for motorola blobs
export LD_SHIM_LIBS /system/vendor/bin/adspd|libshim_adsp.so:/system/lib/lib_motsensorlistener.so|libsensor.so:/system/lib/libjustshoot.so|libshims_camera.so:/system/vendor/lib/libguy.so|libshim_camera_hal.so
export LD_SHIM_LIBS /system/vendor/bin/adspd|libshim_adsp.so:/system/lib/lib_motsensorlistener.so|libsensor.so:/system/lib/libjustshoot.so|libshims_camera.so:/system/vendor/lib/libguy.so|libshim_camera_hal.so:/system/vendor/lib64/libmdmcutback.so|libqsap_shim.so
write /sys/module/qpnp_rtc/parameters/poweron_alarm 1