Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit badfa754 authored by Pig's avatar Pig Committed by Rohit Sekhar
Browse files

FP6: 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
parent c36d94db
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@ cc_library_shared {
        "liblog",
        "libqtivibratoreffect.FP6",
        "libqtivibratoreffectoffload.FP6",
        "libsoc_helper",
        "libbinder_ndk",
        "android.hardware.vibrator-V2-ndk",
    ],
+22 −8
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@

#define LOG_TAG "vendor.qti.vibrator.FP6"

#include <cutils/properties.h>
#include <dirent.h>
#include <inttypes.h>
#include <linux/input.h>
@@ -50,10 +51,6 @@
#include "effect.h"
#endif

extern "C" {
#include "libsoc_helper.h"
}

namespace aidl {
namespace android {
namespace hardware {
@@ -71,6 +68,20 @@ namespace vibrator {
#define VIB_AW   0x02

#define VIB_ALL (VIB_LED|VIB_AW)

#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 MSM_CPU_CAPE            530
#define APQ_CPU_CAPE            531
#define MSM_CPU_TARO            457
#define MSM_CPU_TARO_LTE        552
#define MSM_CPU_KALAMA          519
#define MSM_CPU_PINEAPPLE       557

#define test_bit(bit, array)    ((array)[(bit)/8] & (1<<((bit)%8)))

static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
@@ -87,13 +98,14 @@ enum composeEvent {
InputFFDevice::InputFFDevice()
{
    DIR *dp;
    FILE *fp = NULL;
    struct dirent *dir;
    uint8_t ffBitmask[FF_CNT / 8];
    char devicename[PATH_MAX];
    const char *INPUT_DIR = "/dev/input/";
    char name[NAME_BUF_SIZE];
    int fd, ret;
    soc_info_v0_1_t soc;
    int soc = property_get_int32("ro.vendor.qti.soc_id", -1);

    mVibraFd = INVALID_VALUE;
    mSupportGain = false;
@@ -152,9 +164,11 @@ InputFFDevice::InputFFDevice()
            if (test_bit(FF_GAIN, ffBitmask))
                mSupportGain = true;

            get_soc_info(&soc);
            ALOGD("msm CPU SoC ID: %d\n", soc.msm_cpu);
            switch (soc.msm_cpu) {
            if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) {
                fscanf(fp, "%u", &soc);
                fclose(fp);
            }
            switch (soc) {
            case MSM_CPU_KALAMA:
            case MSM_CPU_PINEAPPLE:
                mSupportExternalControl = true;
+0 −4
Original line number Diff line number Diff line
@@ -49,10 +49,6 @@
#include "include/Vibrator.h"
#include "VibratorPatterns.h"

extern "C" {
#include "libsoc_helper.h"
}

namespace aidl {
namespace android {
namespace hardware {