Xbox original remote on Kodi Leia -> problems to create keytable/ no events

  • Dear all,

    can anyone help me to get an original xbox remote working. I use a RPi1 along with a GPIO receiver

    GPIO config and boot output:

    Code
    leia1:~ # cat /flash/config.txt
    ...
    dtoverlay=gpio-ir
    Code
    leia1:~ # dmesg|fgrep lirc
    [   15.798007] lirc_dev: IR Remote Control driver registered, major 245
    [   16.430358] rc rc0: lirc_dev: driver ir-lirc-codec (gpio-rc-recv) registered at minor = 0

    version of Kodi Leia used:

    Code
    LibreELEC (community): devel-20180418020427-#0417-ga934092 (RPi.arm)

    output of ir-keytable:

    Code
    leia1:~ # ir-keytable
    Found /sys/class/rc/rc0/ (/dev/input/event2) with:
    Driver: gpio-rc-recv, table: rc-rc6-mce
    lirc device: /dev/lirc0
    Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
    Enabled protocols: lirc
    Name: gpio_ir_recv
    bus: 25, vendor/product: 0001:0001, version: 0x0100
    Repeat delay = 500 ms, repeat period = 125 ms

    using raw signales with 'mode2'

    So basically the remote is recognized. Here is the lircd.conf copied from an older LE Leia built where it works with the old original USB IR receiver on a RPi2.

    Now, the ir-keytable does not give any event output so I cannot create a proper keytable. I tried every protocol of the supported ones, but no output at all. Does this mean I have to switch to another remote or what can I do? Out of curiosity, I tried an old WD live remote which worked with the 'nec' protocol ie. it produced events, but I want to understand why the old Xbox does not work and then use it (see above, raw signals do work). Here the trial with the WD live remote:

    Code
    leia1:~ # ir-keytable -p nec -t
    Protocols changed to nec
    Testing events. Please, press CTRL-C to abort.
    4471.469693: event type EV_MSC(0x04): scancode = 0x847908
    4471.469693: event type EV_SYN(0x00).
    4472.559743: event type EV_MSC(0x04): scancode = 0x847904
    4472.559743: event type EV_SYN(0x00).
    4473.289678: event type EV_MSC(0x04): scancode = 0x84790a
    4473.289678: event type EV_SYN(0x00).

    Still there is from the RPi2 built (see above) a lircmap.xml and Lircmap.xml that worked there. Copied them to try out whether kodi will work with it despite ir-keytables shows nothing, but without success. However, manually starting kodi via systemd 'systemctl start kodi' and looking with 'ps aux' lircd was properly started with

    Code
    leia1:~/.kodi/userdata # ps aux
    PID   USER     TIME  COMMAND
    ...
      803 root      0:00 {kodi.sh} /bin/sh /usr/lib/kodi/kodi.sh --standalone -fs
      807 root      7:10 /usr/lib/kodi/kodi.bin --standalone -fs
    ...
      892 root      0:00 lircd --device=/dev/input/event2 /storage/.config/lircd.conf
    ...

    Thanks a lot and best regards.

  • The mode 2 output looks very odd - the space values are oddly large. So I'm not 100% sure if there might be some problem with IR reception - or maybe the batteries of the remote are flat and it's not working properly?

    I'm not familiar with the original xbox remote, but if ir-keytable configuration doesn't work you could try the lircd.conf files from here: lirc-remotes / Code / [395780] /remotes/microsoft

    This one looks like it could work: xbox.lircd.conf?format=raw

    Download the file and copy it to /storage/.config/lircd.conf, then reboot (LE9.0 preview builds will automatically pick the file up and run lirc, in LE 8.2 you have to enable Lirc in LE settings).

    But before doing that I'd check into the mode2 output, the pulse/space values should usually be about 400-2000.

    so long,

    Hias

  • Hij HiassofT,

    thanks for the infos. Will try that out. First glance seems to be that the original xbox remote does not work that properly with the GPIO driven sensors in contrast to several other IR remotes I tried. I have two of those old xbox remotes and tried both with new batteries, and from time to time the pulse/space values had values >>>2000, but sometimes also below that. - And btw - both remotes work perfectly with a very old Millhouse Leia built on a RPi2 along with the original USB xbox dvddongle before this module was removed from the kernel (what a pity... I mean it is not a monolithical kernel issue, it is just a module and worked perfectly for many years now).

    Would it be possible to "tweak" the "driver options" so that the pulse/ spaces are interpreted differently (I ask because this unknown territory for me, but if there is a trial&error way it can be investigated)?

    But will try out the xbox.lircd.conf's.

    best wishes,

    lcg

  • Which IR receiver (exact part number) are you using?

    There's nothing you can do in software to influence pulse/space detection, this is performed inside the IR receiver.

    Basically there are 2 key parameters for choosing an IR receiver, one is the carrier frequency of the IR signal (usually 36-40kHz), the other is the remote protocol a receiver has been optimized for and/or how well it can deal with external IR interference (eg sun shining directly on the receiver, nearby CCFL lamps etc).

    Usually using a 38kHz (which is used eg for NEC proto)l receiver will work fine, 36kHz (used eg for rc-5 and rc-6) and 40kHz (eg sony) are near enough to work fine.

    As for protocol optimization have a look at the last page of this document on the Vishay website: dataform.pdf - more detailled info are in the specific datasheets of the receivers.

    AGC1 is the most universal AGC implementation, AGC4 (which is optimized for eg NEC and RC5/6) doesn't work well with a bunch of protocols.

    So, my recommendation would be to try a TSOP34138 (1 is the AGC version, 38 the frequency). TSOP34438 (AGC4) could be problematic.

    Some IR protocols have a rather large pulse/space at the beginning (eg NEC starts with a ~9000 pulse and ~4500 space) and you'll also see a large space (or a timeout) between button repeats. But the other pulse/space values within an IR message are usually in the 400-2000 range.

    I searched a bit and the original Xbox remote indeed seems to use a non-standard protocol. So in-kernel decoding won't work, but you could be able to create a lircd.conf with irrecord (you might have to use irrecord raw mode if normal mode doesn't work) - but first you have to sort out the IR reception (pulse/space) issues.

    As for the old lirc_xbox driver: well, that never made it into the official Linux kernel, OpenELEC/LibreELEC included it as long as possible (it needed a bit of tweaking now and then, but not too dramatic), but it's time had ended and we had to drop it. All IR receiver drivers in the kernel got moved to a new code base (which allows IR decoding in the kernel) and the old code lirc_xbox was built around got dropped.

    so long,

    Hias

  • Thanks Hias for those detailed explanations,

    - IR receiver -> tried different ones which indeed differed in responsiveness. Best was a TSOP38238 VISHAY. One worked only if the IR was directly before. But should not be a problem to buy another TSOP34138 as you pointed out.

    - for some trials I switched back to plain raspbian lite (feel better with an apt-environment) and tried an old WD live remote, configured it with irrecord and it properly gave event keys as output. Strange are only (not always) escape sequences while pushing buttons on the remote with 'irw', like e.g.

    Code
    ^[[B + KEYCODE
    ^@ + KEYCODE
    ^[[D + KEYCODE

    but basically the receiver and lirc seem to work. Will reproduce this next few days with LE, same IR receiver, same remote.

    For the old Xbox remote, the first trial with the 'raw' option was promising - cool, this was unknown to me. First, a file was created (was not possible before) with 'irrecord', and afterwards 'irw' gave an output (although not for every key properly, so I have to repeat the procedure, but that's maybe due to the IR remote being really old).

    So I think with the 'raw' option it should be able to manage the situation also for LE. After it worked with 'mode2', but not with any other of the configure tools (except the 'raw' mode), it was obvious that it probably uses a non-standard protocol.

    Btw - for PC I found a page on the net for a 4.14(?) kernel that offered a slightly adjusted version of the lirc_xbox module (I use kodi also on a PC, so I can continue there for a while, and for the RPi the GPIOs are really easy if the IR receiver is ok).

    Thanks again!

    best,

    lcg

  • Thanks for the status update and fingers crossed things work out with the TSOP34138. Please keep us posted about the progress, I'd be interested in knowing if you can get the old Xbox remote to work.

    Concerning lirc_xbox: it can still work be made to work with kernel 4.14 but in LibreELEC we ship (optional in LE9) newer DVB drivers which also update the code for IR remotes to very bleeding edge kernel level - and lirc_xbox does no longer work with that.

    Therefore we made the decision to drop lirc_xbox completely in LE9. It would have been rather confusing to users to have lirc_xbox support in the base installation but not when you enable one of the optional DVB drivers.

    so long,

    Hias

  • Hi Hias,

    yes, it works :-). I can confirm that the old xbox-remote works if the lircd.conf was created via the 'raw'-mode. A TSOP 38238 vishay was used bought from a German raspishop. I had some problems with keys, but these are more related to the IR remote itself and being really old than LE, lircd, or the IR receiver. The OS is LE latest Millhouse build (2018041802427-#417-ga934092) and the hardware is a RPi1 (version with P5 header). But it should work on every RPi that way.

    The lircd.conf has still to be adjusted a little bit along with the names to match lircmap.xml, but these are rather minor issues.

    thanks again!

    best,

    lcg

  • Thanks a lot for reporting back and glad you got it working! Knowing that it works with a TSOP38238 is really useful info.

    If you got a working lircd.conf file could you upload it here? That could be useful for other people using the same remote.

    so long,

    Hias

  • Sure. Please see below.

    Probably some things have to be tweaked more like repeating button presses, etc. But with that old remote it seems it depends on the actual hardware one uses. I use two identical ones that behave slightly different if it comes to repeated button presses. One has also to check whether the names fit.

    May I ask another question? Using the 'raw' mode and adding this to lircd.conf, this is always sufficient if the key names match the entries in Lircmap.xml/ lircmap.xml?

    best,

    lcg


  • Thanks a lot for sharing your lirc file!

    One problem with manual recording (both raw and standard mode) is that the measured values will never be 100% correct. The remote, IR receiver, SOC and OS all play a role in which values you get.

    If everything were perfect you'd see about 2-5 different lengths, because that's what the remote should be transmitting.

    So there's always some risk that some values are a bit on the edge and thus a lircd.conf file won't work on some other hardware or with another remote.

    That's why lirc now recommends using the profile mode where you manually select the remote's protocol (in-kernel decoding uses basically the same approach). But this won't help with non-standard protocols like the Xbox, the best one could do is to try to find some specs what the lengths should be and then manually clean up the file according to that (eg replace everything between 200 and 300 with 250 if that's what the nominal length would be).

    But then, often it works good enough as is so it's not really necessary.

    As for the KEY_ names: looking at the remote="devinput" section of Kodi's Lircmap.xml is a good approach. If in doubt look at what the Microsoft MCE remote is using (see /usr/lib/udev/rc_keymaps/rc6_mce), these KEY names are pretty much the standard when it comes to Kodi and IR remotes..

    so long,

    Hias

  • The original xbox IR receiver is no longer supported but with another IR receiver (eg the one integrated into NUCs or an MCE USB receiver) and the lircd.conf file posted in this thread it should work.

    so long,

    Hias

  • Any specific recommendations for USB IR receivers that will work painlessly with the Xbox DVD Remote? Anything with equal or at least nearly as good range as the good old one that we will now have to retire?