Forum

Full Version: Trouble getting lircd to work as expected, also is something else handling IR input?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi XBian community, I have been trying to set up my remote to work with kodi on xbian recently but I am facing problem after problem so I hope some of you will be able to help me with that.

So, lets start at the beggining:
I have RPi3B+, running on xbian: ( xbian@xbian ~ $ uname -a
Linux xbian 4.14.102+ #1 SMP PREEMPT Thu Feb 21 19:32:00 CET 2019 armv7l GNU/Linux )
With kodi 18.1 .

My remote is Windows media center remote, same as: https://images.app.goo.gl/MGKu2QPMzXbdv1ADA

I connected IR receiever to the GPIO pins and edited config.txt accordingly.
But then I had problems with irrecord throwing various problems so I fired up latest Raspbian.
Latest Raspbian has kaernel 4.19 and that changed something that makes mode2 output something differently and thus irrecord still doesnt work, so I had to apply a patch from RPi forum and after that patch irrecord worked ok, and irw recognized remote buttons correctly, so I copied recorded confing file from raspibian to Xbian.

But now there are following problems:

1. It seems that my lircd service isnt starting correctly because even if service is running, remote doesnt work, and irw halts with error "cannot connect" (not exact error message)

2. Even when lirc / lircd is stopped and not running kodi still reacts to some buttons on remote accordingly (arrows, key "enter" (not key "OK"), key play as play/pause toggle, and maybe one or two more.

3. when I run "lircd --driver=default --device=/dev/lirc0" Then remote and irw appears to work almost correctly with kodi with some exceptions: irw shows that most keys are recognized as "mceusb" config but I made my own config on raspbian, buttons from my config are recognized by irw but kodi doesnt react to them. Buttons recognized even with lirc NOT running like those arrow keys mentioned above, are with running "lircd --driver=default --device=/dev/lirc0" recognized like 2 presses for one press (like I press arrow down on remote, I get ONE entry in IRW but kodi shifts focus TWO items down.

4. I also have /home/xbian/.xbmc/userdata/Lircmap.xml, but it appears to have no effect. I used this article: http://wiki.xbian.org/doku.php/remotes


I can provide any other configuration files or other info on request, if it helps.

Thank you!
Usually you do not need lirc anymore because kernel should handle mce devices directly and Kodi is reading inputs from kernel input device(s)

That's probably the reason for your point 2)
(30th May, 2020 12:15 AM)Nachteule Wrote: [ -> ]Usually you do not need lirc anymore because kernel should handle mce devices directly and Kodi is reading inputs from kernel input device(s)

That's probably the reason for your point 2)

Oh, okay, I didn't know about that, but now the question is:

How do I get kernel to learn more/all of my remote buttons OR how do I turn off kernel handling ir input, and let only lirc handle it?

Because, as I said, now it's either too few buttons working, or almost all buttons working, but some of them "twice".
(28th May, 2020 08:01 PM)Msprg Wrote: [ -> ]Linux xbian 4.14.102+ #1 SMP PREEMPT Thu Feb 21 19:32:00 CET 2019 armv7l GNU/Linux )
With kodi 18.1 .

Your system seems to be quite a bit outdated. We're running kernel 5.4 now and Kodi has version 18.7

Are you still on Debian Stretch?

Anyway, maybe good idea to install xbian-package-lirc from devel repository. Then you have an option in /etc/default/lirc that allows you to claim input device:

Code:
# If used devices should be claimed immediately after starting lircd
# driver, set this to always or devinput. This may be required in case of
# devinput driver is used, because Kodi (at least since v18 Leia) opens
# devinput devices before lirc will be used.
#
CLAIM_DEVICES="devinput"
(30th May, 2020 04:06 AM)Nachteule Wrote: [ -> ]
(28th May, 2020 08:01 PM)Msprg Wrote: [ -> ]Linux xbian 4.14.102+ #1 SMP PREEMPT Thu Feb 21 19:32:00 CET 2019 armv7l GNU/Linux )
With kodi 18.1 .

Your system seems to be quite a bit outdated. We're running kernel 5.4 now and Kodi has version 18.7

Are you still on Debian Stretch?

Anyway, maybe good idea to install xbian-package-lirc from devel repository. Then you have an option in /etc/default/lirc that allows you to claim input device:

Code:
# If used devices should be claimed immediately after starting lircd
# driver, set this to always or devinput. This may be required in case of
# devinput driver is used, because Kodi (at least since v18 Leia) opens
# devinput devices before lirc will be used.
#
CLAIM_DEVICES="devinput"





Sooooooo, I thought that you are right that I have outdated install, so I ran upgrade throught xbian-config menu, and.... it apparently broke everything Big Grin

In other words, system just doesnt boot, and I get no any video output on HDMI, it just remains on "No signal" even minutes after I power Raspi, so.... eh.. Well I backed up /home at least... so I am gonna do reinstall perhaps, but I want to ask you, the newest xbian SD images I found were with pine bootloader. Those arent official builds are they... Where can I find latest official build without PINE?
What is PINE ??? Or do you mean PINN

... and standard images you can get from here: https://xbian.org/getxbian/
(30th May, 2020 04:59 AM)Nachteule Wrote: [ -> ]What is PINE ??? Or do you mean PINN

... and standard images you can get from here: https://xbian.org/getxbian/


Oh, sorry, yes I meant pinn I recalled the name incorrectly.
K, now Im on the latest XBian release and I think its worth mentioning that I used this opportunity to switch to RasPi 4.

Now, if you say the kernel is now handling IR control, could you please advise me, how to preoceed next on my journey of controlling my Xbian RPi4 box with my Windows media center remote? (Because honestly I have no idea what to do next now...)
(1st Jun, 2020 06:49 AM)Msprg Wrote: [ -> ]K, now Im on the latest XBian release and I think its worth mentioning that I used this opportunity to switch to RasPi 4.

Now, if you say the kernel is now handling IR control, could you please advise me, how to preoceed next on my journey of controlling my Xbian RPi4 box with my Windows media center remote? (Because honestly I have no idea what to do next now...)

It should be enough to disable lirc service (can be done in XBian-Config GUI -> Services) [1]

I tested it with an old HAMA Remote Control and it worked

[1] I disabled and stopped lirc service, plugged in IR dongle and without rebooting system or restarting Kodi I was able to control Kodi with this remote control
Ok, I Got it, just I don't really have a IR USB receiver (I suppose that's what you are calling dongle) on hand now, just IR sensor I can connect to GPIO. But maybe it would be much less work just getting an USB IR receiver. So could you tell me some brand/model that should reliably work plug & play, like your does?

Ideally you would send a link to Amazon or Aliexpress, because I don't feel like buying and waiting for some receiver that will end up not working out of the box...
(1st Jun, 2020 10:30 PM)Msprg Wrote: [ -> ]Ok, I Got it, just I don't really have a IR USB receiver (I suppose that's what you are calling dongle) on hand now, just IR sensor I can connect to GPIO. But maybe it would be much less work just getting an USB IR receiver. So could you tell me some brand/model that should reliably work plug & play, like your does?

Ideally you would send a link to Amazon or Aliexpress, because I don't feel like buying and waiting for some receiver that will end up not working out of the box...

Ouups, I forgot what you wrote in your first post, sorry

So, just enable your GPIO IR and don't start lirc service. AFAIR newer kernel should have support for this configuration directly. Give it a try

I'm using such a combination (lirc from devel package, GPIO IR receiver and this Terratec Remote Control

If it does not work, you have the choice to install and use lirc package from devel repository and try it with that package

I don't believe that you can buy just an IR dongle, your remote control will probably not work with that dongle.
Unfortunately I do not have a lot of experience with MCE remote controls, so I cant tell you which one would be good to buy, but all of them with USB IR receiver should work

Final question: cant' you use CEC for using remote control from your TV?
(1st Jun, 2020 10:49 PM)Nachteule Wrote: [ -> ]So, just enable your GPIO IR and don't start lirc service. AFAIR newer kernel should have support for this configuration directly. Give it a try

K, I will try, just to make sure I am doing it right, all that I should do after connecting receiever to GPIO, is adding “lirc_rpi gpio_in_pin=#” to /etc/modules and move and rename /etc/lirc/hardware/lirc_rpi.conf to /etc/lirc/hardware.conf, right?


(1st Jun, 2020 10:49 PM)Nachteule Wrote: [ -> ]Final question: cant' you use CEC for using remote control from your TV?

No, my TV doesnt support that.


EDIT: I just did the above, + disabled the lirc service, but my remote doesnt work at all now. Did I missed a step??
Yes of course:

lirc-rpi is not longer supported, gpio-ir is your friend, please read /boot/README.overlays

GPIO-IR for Raspberry Pi is now directly supported by kernel, thats why I talked about the possibility that lirc service is not longer required.
Thank you for getting me into the right direction:

1. I didnt know about README.overlays, there is SO much useful information.
2. My previous steps were from official XBian Wiki: http://wiki.xbian.org/doku.php/remotes and so IF you say what I was doing was outdated, that means the Wiki is outdated, at least that particuliar article, just so you know I only did what was written in the official sources. (So it would be about time to get the Wiki updated, but I am definitely not saying its your job, just bringing it up to attention...)


Now, with enabled gpio-ir, Im back to kodi recognizing that few keys on my remote I mentioned in one of my posts in beginning (arrow keys, power button key, and few others). That explains why I got to configuration where kodi receieved some keys 2 times, because gpio-ir as well as lirc were sending events.

So now the question is: How do I (map) get all buttons on the remote to work? Do I need dev lird for that? If so, do I need anything to the apt sources list (devel repo) or is it just package whit differrent name (something along like xbian-lirc-dev)?


Thank you for your time, you are very helpful for me, and I can learn so much things from you!

Edit: Wow, I just accidentaly observed, that my activity lights on my switch to which RPI with running XBian is connected, are rapidly blinking while I am holding ANY key on the remote (and ir-keytable registers it). I am sure the ACT are blinking because it is 100% replicable. Does it use network for something??

Also keytable-ir -t shows that ALL of my remote key presses are registered, but only those few, as descibed above, are causing some visible and meaningful response, IDK what do I do next...?
First, to clearify this and before we can continue, make sure that lircd does not run

Terminal

root@kmxbilr2 ~ # sudo pgrep lircd
root@kmxbilr2 ~ #

pgrep should give no output

Next, enable Kodi debug log (Kodi->Setting->System->Logging) so you can see remote events in kodi's logfile /home/xbian/.kodi/temp/kodi.log

Code:
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.602 T:6496    DEBUG <general>: CLibInputKeyboard::ProcessKey - using delay: 250ms repeat: 33ms
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.602 T:7402    DEBUG <general>: Thread Timer start, auto delete: false
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.602 T:6491    DEBUG <general>: Keyboard: scancode: 0x6a, sym: 0x0113, unicode: 0x0000, modifier: 0x0
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.602 T:6491    DEBUG <general>: HandleKey: right (0xf083) pressed, action is Right
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.746 T:7402    DEBUG <general>: Thread Timer 2361233600 terminating
Jun  4 12:31:25 kmxbilr2 2020-06-04 12:31:25.754 T:6491    DEBUG <general>: Keyboard: scancode: 0x6a, sym: 0x0113, unicode: 0x0000, modifier: 0x0

^^ this is a log after pressing cursor-right key

Code:
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.699 T:6491    DEBUG <general>: Keyboard: scancode: 0x7d, sym: 0x0137, unicode: 0x0000, modifier: 0xc00
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.699 T:6491    DEBUG <general>: HandleKey: meta-leftwindows (0x20f0d6) pressed, action is
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.699 T:6491    DEBUG <general>: Keyboard: scancode: 0x38, sym: 0x0134, unicode: 0x0000, modifier: 0xf00
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.699 T:6491    DEBUG <general>: HandleKey: alt-meta-leftalt (0x24f0d4) pressed, action is
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.707 T:6496    DEBUG <general>: CLibInputKeyboard::ProcessKey - using delay: 250ms repeat: 33ms
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.707 T:7419    DEBUG <general>: Thread Timer start, auto delete: false
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.714 T:6491    DEBUG <general>: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x000d, modifier: 0xf00
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.714 T:6491    DEBUG <general>: HandleKey: alt-meta-return (0x24f00d) pressed, action is
Jun  4 12:32:47 kmxbilr2 2020-06-04 12:32:47.763 T:7419    DEBUG <general>: Thread Timer 2361233600 terminating

^^ This is a log of a key which is not handled by Kodi correctly (nothing follows after action is)

So I suppose, you'll get a lot of recognized events but with no actions.

If my assumption is correct, you must create your own keymap.xml, the default keymaps you can find in /usr/local/share/kodi/system/keymaps/, where you can have a look how they looks like, gut do never modify them at this place, because they will be overwritten by next update of xbian-package-xbmc.
Put your own keymap.xml in /home/xbian/.kodi/userdata/keymaps instead

More information about keymaps can be found here
Pages: 1 2
Reference URL's