aboutsummaryrefslogtreecommitdiffstats
path: root/consumerir
diff options
context:
space:
mode:
authorChristopher R. Palmer <crpalmer@gmail.com>2014-08-25 14:59:34 -0400
committerKetut Putu Kumajaya <ketut.kumajaya@gmail.com>2014-09-29 09:39:19 +0700
commitb2394075be8600974f61141146558707aeb7c58c (patch)
treea58af599c91022b0904734e14d9210a05f1746f8 /consumerir
parent52405aa89e45ccee0b48e882c407893991e891a1 (diff)
downloaddevice_samsung_kona-common-b2394075be8600974f61141146558707aeb7c58c.zip
device_samsung_kona-common-b2394075be8600974f61141146558707aeb7c58c.tar.gz
device_samsung_kona-common-b2394075be8600974f61141146558707aeb7c58c.tar.bz2
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: I3d7c5104011e285324c31acb6333cae514d09ff6
Diffstat (limited to 'consumerir')
-rw-r--r--consumerir/consumerir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/consumerir/consumerir.c b/consumerir/consumerir.c
index 327beb4..d935118 100644
--- a/consumerir/consumerir.c
+++ b/consumerir/consumerir.c
@@ -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;