[Samsung Galaxy S II Plus] KINGbabasula:
[MENTION=3412821]beastaki23[/MENTION] can you post your changes to kernel and app sources? So we can add native support in CyanogenMod sources.

And I made a patch with your vibrator service that can be applied in frameworks/base writing "git apply vib.patch"

commit 17cdeccbfc6606ee7dd14fae59407327d058e501
Author: KINGbabasula <kingbabasula@gmail.com>
Date: Sun Jan 12 04:04:30 2014 -0500

Workaround for vibration

diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java
index e4a9463..b59535b 100644
--- a/services/java/com/android/server/VibratorService.java
+++ b/services/java/com/android/server/VibratorService.java
@@ -16,6 +16,9 @@

package com.android.server;

+import com.immersion.uhl.Device;
+import com.immersion.uhl.ImmVibe;
+import com.immersion.uhl.MagSweepEffectDefinition;
import android.app.AppOpsManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -24,6 +27,7 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.hardware.input.InputManager;
+import android.os.BatteryStats;
import android.os.Handler;
import android.os.IVibratorService;
import android.os.PowerManager;
@@ -44,20 +48,21 @@ import android.view.InputDevice;
import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IBatteryStats;
import com.android.internal.util.cm.QuietHoursUtils;
-
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.ListIterator;

public class VibratorService extends IVibratorService.Stub
implements InputManager.InputDeviceListener {
+ private static final String MY_IMMVIBE_LICENSE_KEY = "DH75NDX26JR75GCZ5CKKTD25M9JP62TG";
private static final String TAG = "VibratorService";
-
private final LinkedList<Vibration> mVibrations;
private Vibration mCurrentVibration;
private final WorkSource mTmpWorkSource = new WorkSource();
private final Handler mH = new Handler();
+ public boolean booted = false;

+ public static Context dContext;
private final Context mContext;
private final PowerManager.WakeLock mWakeLock;
private final IAppOpsService mAppOpsService;
@@ -136,7 +141,7 @@ public class VibratorService extends IVibratorService.Stub
// Reset the hardware to a default state, in case this is a runtime
// restart instead of a fresh boot.
vibratorOff();
-
+	dContext = context;
mContext = context;
PowerManager pm = (PowerManager)context.getSystemService(
Context.POWER_SERVICE);
@@ -144,13 +149,16 @@ public class VibratorService extends IVibratorService.Stub
mWakeLock.setReferenceCounted(true);

mAppOpsService = IAppOpsService.Stub.asInterface(ServiceManager.getService(Context.APP_OPS_SERVICE));
- mBatteryStatsService = IBatteryStats.Stub.asInterface(ServiceManager.getService("batteryinfo"));
+ mBatteryStatsService = IBatteryStats.Stub.asInterface(ServiceManager.getService(
+ BatteryStats.SERVICE_NAME));

mVibrations = new LinkedList<Vibration>();

IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
context.registerReceiver(mIntentReceiver, filter);
+ filter.addAction(Intent.ACTION_BOOT_COMPLETED);
+ context.registerReceiver(mIntentReceiver, filter);
}

public void systemReady() {
@@ -245,13 +253,13 @@ public class VibratorService extends IVibratorService.Stub
// so wakelock calls will succeed
long identity = Binder.clearCallingIdentity();
try {
- if (false) {
+ if (true) {
String s = "";
int N = pattern.length;
for (int i=0; i<N; i++) {
s += " " + pattern[i];
}
- Slog.i(TAG, "vibrating with pattern: " + s);
+ Slog.v(TAG, "vibrating with pattern: " + s);
}

// we're running in the server so we can't fail
@@ -345,7 +353,8 @@ public class VibratorService extends IVibratorService.Stub
// Lock held on mVibrations
private void startVibrationLocked(final Vibration vib) {
try {
- int mode = mAppOpsService.startOperation(AppOpsManager.OP_VIBRATE, vib.mUid, vib.mPackageName);
+ int mode = mAppOpsService.startOperation(AppOpsManager.getToken(mAppOpsService),
+ AppOpsManager.OP_VIBRATE, vib.mUid, vib.mPackageName);
if (mode != AppOpsManager.MODE_ALLOWED) {
if (mode == AppOpsManager.MODE_ERRORED) {
Slog.w(TAG, "Would be an error: vibrate from uid " + vib.mUid);
@@ -369,7 +378,8 @@ public class VibratorService extends IVibratorService.Stub
private void reportFinishVibrationLocked() {
if (mCurrentVibration != null) {
try {
- mAppOpsService.finishOperation(AppOpsManager.OP_VIBRATE, mCurrentVibration.mUid,
+ mAppOpsService.finishOperation(AppOpsManager.getToken(mAppOpsService),
+ AppOpsManager.OP_VIBRATE, mCurrentVibration.mUid,
mCurrentVibration.mPackageName);
} catch (RemoteException e) {
}
@@ -473,8 +483,22 @@ public class VibratorService extends IVibratorService.Stub
//}
return vibratorExists();
}
-
+public static int safeLongToInt(long l) {
+	int i = (int)l;
+	if ((long)i != l) {
+	throw new IllegalArgumentException(l + " cannot be cast to int without changing its value.");
+	}
+	return i;
+	}
private void doVibratorOn(long millis, int uid) {
+ if (booted){
+	String CUSTOM_INTENT = "vibrator.intent.for.broadcast";
+	Intent myI = new Intent();
+	myI.setAction(CUSTOM_INTENT);
+	myI.putExtra("millis", millis);
+	myI.putExtra("uid", uid);
+	mContext.sendBroadcast(myI);
+	}
synchronized (mInputDeviceVibrators) {
try {
mBatteryStatsService.noteVibratorOn(uid, millis);
@@ -549,7 +573,6 @@ public class VibratorService extends IVibratorService.Stub
final int uid = mVibration.mUid;
int index = 0;
long duration = 0;
-
while (!mDone) {
// add off-time duration to any accumulated on-time duration
if (index < len) {
@@ -608,7 +631,9 @@ public class VibratorService extends IVibratorService.Stub

mVibrations.clear();
}
- }
+ }else if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
+	booted = true;
+	}
}
};
}