vibrator: Simplify soc check and drop prop dep
[npjohnson]: adapt to reflect 18.1 upstream merges as well as include now required headers. Change-Id: I8581d22deac451d0c44e4b3135d2729da2865a36
This commit is contained in:
@@ -13,7 +13,6 @@ cc_library_shared {
|
|||||||
"libutils",
|
"libutils",
|
||||||
"liblog",
|
"liblog",
|
||||||
"libqtivibratoreffect",
|
"libqtivibratoreffect",
|
||||||
"libsoc_helper",
|
|
||||||
"libbinder_ndk",
|
"libbinder_ndk",
|
||||||
"android.hardware.vibrator-V1-ndk_platform",
|
"android.hardware.vibrator-V1-ndk_platform",
|
||||||
],
|
],
|
||||||
@@ -56,7 +55,6 @@ cc_library_shared {
|
|||||||
"liblog",
|
"liblog",
|
||||||
"libqtivibratoreffect",
|
"libqtivibratoreffect",
|
||||||
"libqtivibratoreffectoffload",
|
"libqtivibratoreffectoffload",
|
||||||
"libsoc_helper",
|
|
||||||
"libbinder_ndk",
|
"libbinder_ndk",
|
||||||
"android.hardware.vibrator-V1-ndk_platform",
|
"android.hardware.vibrator-V1-ndk_platform",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#define LOG_TAG "vendor.qti.vibrator"
|
#define LOG_TAG "vendor.qti.vibrator"
|
||||||
|
|
||||||
|
#include <cutils/properties.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
@@ -42,9 +43,6 @@
|
|||||||
#include "effect.h"
|
#include "effect.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "libsoc_helper.h"
|
|
||||||
}
|
|
||||||
namespace aidl {
|
namespace aidl {
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
@@ -57,6 +55,13 @@ namespace vibrator {
|
|||||||
#define CUSTOM_DATA_LEN 3
|
#define CUSTOM_DATA_LEN 3
|
||||||
#define NAME_BUF_SIZE 32
|
#define NAME_BUF_SIZE 32
|
||||||
|
|
||||||
|
#define MSM_CPU_LAHAINA 415
|
||||||
|
#define APQ_CPU_LAHAINA 439
|
||||||
|
#define MSM_CPU_SHIMA 450
|
||||||
|
#define MSM_CPU_SM8325 501
|
||||||
|
#define APQ_CPU_SM8325P 502
|
||||||
|
#define MSM_CPU_YUPIK 475
|
||||||
|
|
||||||
#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
|
#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
|
||||||
|
|
||||||
static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
|
static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
|
||||||
@@ -64,13 +69,14 @@ static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
|
|||||||
InputFFDevice::InputFFDevice()
|
InputFFDevice::InputFFDevice()
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
|
FILE *fp = NULL;
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
uint8_t ffBitmask[FF_CNT / 8];
|
uint8_t ffBitmask[FF_CNT / 8];
|
||||||
char devicename[PATH_MAX];
|
char devicename[PATH_MAX];
|
||||||
const char *INPUT_DIR = "/dev/input/";
|
const char *INPUT_DIR = "/dev/input/";
|
||||||
char name[NAME_BUF_SIZE];
|
char name[NAME_BUF_SIZE];
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
soc_info_v0_1_t soc = {MSM_CPU_UNKNOWN};
|
int soc = property_get_int32("ro.vendor.qti.soc_id", -1);
|
||||||
|
|
||||||
mVibraFd = INVALID_VALUE;
|
mVibraFd = INVALID_VALUE;
|
||||||
mSupportGain = false;
|
mSupportGain = false;
|
||||||
@@ -129,9 +135,11 @@ InputFFDevice::InputFFDevice()
|
|||||||
if (test_bit(FF_GAIN, ffBitmask))
|
if (test_bit(FF_GAIN, ffBitmask))
|
||||||
mSupportGain = true;
|
mSupportGain = true;
|
||||||
|
|
||||||
get_soc_info(&soc);
|
if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) {
|
||||||
ALOGD("msm CPU SoC ID: %d\n", soc.msm_cpu);
|
fscanf(fp, "%u", &soc);
|
||||||
switch (soc.msm_cpu) {
|
fclose(fp);
|
||||||
|
}
|
||||||
|
switch (soc) {
|
||||||
case MSM_CPU_LAHAINA:
|
case MSM_CPU_LAHAINA:
|
||||||
case APQ_CPU_LAHAINA:
|
case APQ_CPU_LAHAINA:
|
||||||
case MSM_CPU_SHIMA:
|
case MSM_CPU_SHIMA:
|
||||||
|
|||||||
@@ -45,10 +45,6 @@
|
|||||||
#include "include/Vibrator.h"
|
#include "include/Vibrator.h"
|
||||||
#include "VibratorPatterns.h"
|
#include "VibratorPatterns.h"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "libsoc_helper.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace aidl {
|
namespace aidl {
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
|
|||||||
Reference in New Issue
Block a user