1

I want to "fake" a remote control to do some home automation and turn my tv STB on. This is not about "receiving" but "transmitting" to a receiver.

I figured out the code for the relevant remote control and it kind of works. However, my tv set top box seems to detect the end of a button press (and multiple repeating button presses) by sending the pre data again and then stopping the transmission, without the actual code for the key.

To illustrate this, with mode2 I receive the following series of pulses and spaces, when I press power for two times in a row (but releasing the button in between):

277 682 597 703 256 362 277 362 597 703 256 362 597 362 256 703 597 362 277 682 597 362 277 682 619 16275
256 703 597 703 256 362 277 362 597 682 277 362 597 362 256 703 597 362 256 703 597 362 277 682 597 16275
277 682 597 703 277 362 256 362 619 682 256 362 597 16957
256 703 597 703 256 362 256 362 597 703 256 362 619 362 256 703 597 362 256 703 597 362 256 703 597 16275
256 703 597 703 256 362 256 362 597 703 277 362 597 362 256 703 597 362 256 703 597 362 256 703 597 16275
277 703 597 682 277 362 256 362 597 703 256 362 597 362 277 682 619 362 256 703 597 362 256 703 597 16275
256 703 597 703 256 362 277 362 597 682 277 362 597 16957

Each line is a repetition of the code, with an oscilloscope, I measured the gap to be much larger (around 120ms)

The curious thing about this is: there seems to be no toggle bit, but the transmission seems to end at the 7th pulse, not at the end of the whole word. This is the same for all keys.

As I mentioned, this seems to be relevant, as I cannot turn the TV box on (Press Power twice in a row) or change e.g. to channel 11 or 22.

How can I implement this? Any ideas?

My lirc file looks like this:

begin remote

    name leunet
    bits    10
    flags SHIFT_ENC|CONST_LENGTH
    eps 30
    aeps 100

    header 343 343
    one 343 343
    zero    343 343
    gap 118000
#   min_repeat  2
    pre_data_bits   8
    pre_data    0xbb

        begin codes
            power   0x092
            key_1   0x091
......
        end codes
end remote

I tried to experiment with defining "post data" the same way as the pre-data, but this is not working correctly because of the long gap and the "post data" should not be part of any repeats.

I would hate to modify lirc and recompile, as this will always be a fuss with updates, system changes etc., and to be honest, I would like to avoid getting into it so deeply.

Can this be done with scripting without introducing too much latency (e.g. defining a "stop code" remote sending the pre_data, only). The box that "pretends to be the remote" is a rather powerful arm processor with Debian (Allwinner A20 processor). Any help is appreciated

2 Answers2

0

Well, I wanted to avoid this because I figured it would cost me last weeks evenings to figure out how the lirc code works and where to add this functionality, but here is the patch: https://github.com/matzrh/lirc/commit/fa7b01e94e7da8b7073865625f7811f284c8a825

It works fine, but I did not test it for short gaps (<10ms) between repeats, but the code is there, in theory. I "abused" remote->suppress_repeat as a flag to show that this repetition of pre data should be made, next. So if this is used for something else (I don't know what it is for) there may be a conflict. Maybe useful for someone else. I needed this for to fake an Ocilion remote control for a TV set top box provided by Stafag/Leunet in Switzerland. I added an additional bit to the pre data, above, making it 0x176. If someone wants the full lircd.conf for the remote, get in touch (it only works after the patch is installed)

0

DISPLAY

started the graphical environment via 'startx'

Install xmode2 (LIRC-X)

apt-get install lirc-x
xmode2

If everything has gone well, we can test the actual receiving hardware. Take a remote control and start the "xmode2" program (if you don’t use X start the character application, "mode2"); press then some buttons on the remote

in my case I use raspberry pi:

xmode2 –d /dev/lirc0 –t 1 # [msec]

To be sure what your IR-receiver is really receiving, to visualise it.

Your lirc file contains the octal code/protocol of the IR commands :

begin remote

name leunet
bits    10
flags SHIFT_ENC|CONST_LENGTH
eps 30
aeps 100

header 343 343
one 343 343
zero    343 343
gap 118000
pre_data_bits   8
pre_data    0xbb

    begin codes
        power   0x092
        key_1   0x091

...

how did you do it?

In my case it is raw, by the command

irrecord -d /dev/lirc0 ./out.conf

and this is my lirc.conf file

  begin raw_codes

      name KEY_VOLUMEUP
         4529    4451     606    1643     600    1651
          594    1645     598     526     601     524
          603     521     597     527     600     525
          602    1650     594    1646     598    1650
          605     519     597     527     599     525
          603     521     613     512     599    1648
          609    1638     602    1643     600     526
          603     521     596     528     598     526
          601     523     604     521     596     527
          599     526     603    1644     600    1651
          593    1648     605    1642     603    1643
          601   46795    4533    4454     594    1647
          597    1648     607    1647     596     522
          605     519     598     527     600     524
          602     522     597    1650     603    1648
          597    1644     597     527     603     521
          606     519     597     527     600     524
          604    1648     594    1648     597    1649
          606     518     598     527     600     524
          604     525     592     528     599     525
          602     523     626     498     597    1650
          605    1638     605    1650     595    1645
          597    1648     607

      name KEY_VOLUMEDOWN
         4537    4455     599    1639     605    1649
          595    1645     598     527     602     522
          603     522     596     528     599     525
          600    1652     593    1648     594    1651
          604     522     606     518     598     525
          602     523     605     526     588    1653
          603    1641     624     501     605    1642
          601     523     611     514     597     526
          601     523     604     521     596     529
          599    1645     598     550     586    1648
          588    1649     605    1641     602    1645
          599   46798    4540    4439     597    1650
          604    1643     600    1652     594     525
          601     523     605     534     603     507
          600     523     603    1643     602    1652
          591    1649     606     519     597     526
          602     524     603     521     595     529
          599    1653     591    1649     606     520
          595    1651     604     520     596     528
          600     525     607     516     605     520
          597     526     600    1647     598     526
          601    1647     596    1655     600    1641
          604    1642     600

      name KEY_OK
          478     250     226     214     230     543
          233     209     225     548     228     713
          228     212     233     209     225     217
          226     217     229     544     232     375
          236     538     226     382     229     379
          230     714     227     209     226

      name KEY_INFO
          473     248     228     214     230     543
          233     209     225     552     234     701
          229     213     232     211     224     217
          228     214     230     544     232     374
          236     540     225     216     229     214
          230     714     228     705     226

      name KEY_MENU
          472     253     234     208     226     547
          229     214     230     546     252     683
          226     216     229     214     230     211
          234     208     226     549     227     379
          231     543     232     376     235     373
          226     401     199     223     232

      name KEY_CHANNELDOWN
          475     251     204     237     207     567
          209     234     200     573     203     735
          205     237     207     236     200     241
          203     239     206     569     207     399
          200     575     201     240     205     569
          206     235     199     410     201

      name KEY_CHANNELUP
          480     246     230     212     232     541
          225     216     229     546     229     710
          231     210     234     208     227     218
          226     214     232     539     236     373
          227     547     228     214     230     544
          232     211     224     216     229

  end raw_codes

Thanks on beforehand.

kris
  • 392
  • 4
  • 16
  • First: Try to verify your data with an oscilloscope attached to your IR receiver, if you can. The first two keys seem to use a completely different protocol than the others. This seem a little strange. Do not expect this to happen automatically, it was manually analyzed. You need to understand and read up on different encoding schemes. The (modified) shift encoding mean a zero is a transition from pulse to space and a one from space to pulse. This means the shorter numbers mean the previous bit is repeated, a longer it is flipped. However, you code seems to be space encoded (first 2 keys) – user3117071 Feb 10 '15 at 19:57
  • 1
    edit: while your Volume keys probably use space encoding, the others could use shift encoding with a 230us pulse width. – user3117071 Feb 10 '15 at 19:59
  • well, it's not true. It is also shift or space encoded, since there is an odd number of short durations between two long ones, the first long pulse probably being part of a header. – user3117071 Feb 10 '15 at 20:12