I think I see why Xiaomi headset buttons don't work - they use different resistance values for buttons compared to what the kernel in @M1cha build expects.
I've compared "sound/soc/msm/apq8064.c" in kernel source between @M1cha version and official (at least that's what I found) version from Xiaomi (
https://github.com/MiCode/mi2_kernel), and they differ in the function that I understand as setting button resistances: at
static void *def_tabla_mbhc_cal(void)
somewhere in its code there is this:
Xiaomi M1cha
btn_low[0] = -75; btn_low[0] = -50;
btn_high[0] = 150; btn_high[0] = 10;
btn_low[1] = 151; btn_low[1] = 11;
btn_high[1] = 330; btn_high[1] = 52;
btn_low[2] = 331; btn_low[2] = 53;
btn_high[2] = 655; btn_high[2] = 94;
btn_low[3] = 21; btn_low[3] = 95;
btn_high[3] = 62; btn_high[3] = 133;
btn_low[4] = 154; btn_low[4] = 134;
btn_high[4] = 181; btn_high[4] = 171;
btn_low[5] = 182; btn_low[5] = 172;
btn_high[5] = 218; btn_high[5] = 208;
btn_low[6] = 219; btn_low[6] = 209;
btn_high[6] = 254; btn_high[6] = 244;
btn_low[7] = 63; btn_low[7] = 245;
btn_high[7] = 104; btn_high[7] = 330;
I've fixed (at least on my device) both Xiaomi Pistons (gold, v.2) and MiKey with CM11 m8.
I had to re-compile the kernel (with some changes) and to change keylayout file.
Pull requests are:
https://github.com/M1cha/android_ker...i_aries/pull/2