msm8974: consumerir: Convert transmit input from ms to pulses

According to:

 https://developer.android.com/reference/android/hardware/ConsumerIrManager.html#transmit%28int,%20int[]%29

the pattern is supposed to be in ms.  Apparently Samsung and HTC
in versions 4.4.2 and earlier of Android were treating this as
the number of pulses instead of ms.  This is what our HAL is
supporting because it mimic'ed what the vendors were doing.

However, we should switch to the correct spec of the pattern (ms)
and eventually this will cause apps to converge on the right
patterns.

Currently, this change will break half the existing apps and cause
the other half of the apps to stop being broken and to start
working.

Change-Id: I87cedcc8e0b85d7b96ed63c7d4f82cc53ecb4ecb
This commit is contained in:
Christopher R. Palmer 2014-08-25 14:59:34 -04:00
parent b676d73281
commit a22ea508a6

View file

@ -47,10 +47,13 @@ static int consumerir_transmit(struct consumerir_device *dev,
/* write the header */
strlen = sprintf(buffer, "%d,", carrier_freq);
/* calculate factor of conversion from microseconds to pulses */
float factor = 1000000 / carrier_freq;
/* write out the timing pattern */
for (i = 0; i < pattern_len; i++)
{
strlen += sprintf(buffer + strlen, "%d,", pattern[i]);
strlen += sprintf(buffer + strlen, "%d,", (int) (pattern[i]/factor));
}
buffer[strlen - 1] = 0;