Search code examples
androidinfrared

ConsumerIrManager.transmit broken in Lollipop?


I upgraded my Samsung Galaxy S4 from latest KitKat to Lollipop (5.0.1) yesterday and my IR remote control app that I have used for months stopped working.

Since I was using a late copy of KitKat ConsumerIrManager, the transmit( ) function was sending the number of pulses using the code below. It worked very nicely.

private void irSend(int freqHz, int[] pulseTrainInMicroS) {
  int [] pulseCounts = new int [pulseTrainInMicroS.length];

  for (int i=0; i<pulseTrainInMicroS.length; i++) {
    long iValue = pulseTrainInMicroS[i] * freqHz / 1000000;
    pulseCounts[i] = (int) iValue;
  } 

  m_IRService.transmit(freqHz, pulseCounts);
}

when it stopped working yesterday, I began looking closely at it.

I noticed that the transmitted waveform is not having any relationship with the requested pulse train. even the code below doesn't work correctly! there is

private void TestSend() {
  int [] pulseCounts = {100, 100, 100};

  m_IRService.transmit(38000, pulseCounts);
}

the resulting waveforms had many problems and so are entirely useless.

  • the waveforms were entirely wrong
  • the frequency was wrong and the pulse spacing was not regular
  • they were not repeatable

looking at the demodulated waveform: if my 100, 100, 100 were correctly rendered, I should have seen two pulses 2.6ms (before 4.4.3(?) 100 us) long. instead I received (see attached) "[demodulated] not repeatable 1.BMP" and "[demodulated] not repeatable 2.BMP". note that the waveform isn't 2 pulses...in fact, it's not even repeatable.

as for the captures below, the signal goes low when the IR is detected.

wrong and not repeatable

wrong and not repeatable

we should have seen two pulses going low for 2.6 ms and 2.6 ms between them (see green line below).

enter image description here

I had also tried shorter pulses using 50, 50, 50 and have observed that the first pulse isn't correct either (see below).

enter image description here

looking at the modulated waveform: the frequency was not correct; instead, it was about 18kHz and irregular.

wrong frequency and irregular

I'm quite experienced with this and have formal education in electronics.

It seems to me there's a bug in ConsumerIrManager.transmit( )...

curiously, the "WatchOn" application that comes with the phone still works.

thank you for any insights you can give.

Test equipment: Tektronix TDS-2014B, 100 MHz, used in peak-detect mode.


Solution

  • As @IvanTellez says, a change was made in Android in respect to this functionality. Strangely, when I had it outputting simple IR signals (for troubleshooting purposes), the function behaves as shown above (erratically, wrong carrier frequency, etc). When I eventually returned to normal types of IR signals, it worked correctly.