Skip to content

Commit

Permalink
Enable vibration control
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarx2k committed Aug 18, 2014
1 parent 6a0765c commit 277fcf9
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 The CyanogenMod Project
* Copyright (C) 2014 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,30 +18,33 @@

import org.cyanogenmod.hardware.util.FileUtils;

import java.io.File;

public class VibratorHW {

private static String NFORCE_PATH = "/sys/devices/platform/tspdrv/nforce_timed";
private static String AMP_PATH = "/sys/devices/virtual/timed_output/vibrator/vtg_level";

public static boolean isSupported() {
return true;
File file = new File(AMP_PATH);
return file.exists();
}

public static int getMaxIntensity() {
return 127;
return 31;
}
public static int getMinIntensity() {
return 1;
return 12;
}
public static int getWarningThreshold() {
return 90;
return -1;
}
public static int getCurIntensity() {
return Integer.parseInt(FileUtils.readOneLine(NFORCE_PATH));
return Integer.parseInt(FileUtils.readOneLine(AMP_PATH));
}
public static int getDefaultIntensity() {
return 65;
return 28;
}
public static boolean setIntensity(int intensity) {
return FileUtils.writeLine(NFORCE_PATH, String.valueOf(intensity));
return FileUtils.writeLine(AMP_PATH, String.valueOf(intensity));
}
}

0 comments on commit 277fcf9

Please sign in to comment.