Posts by HiassofT

    OK, let's try something different. We can remap the OK key with a hwdb file.

    First install the system tools addon (from LibreELEC repository -> Programs) as we'll need the evtest program. Also remove the udev conf file from the previous test.

    Reboot with only the wireless remote connected, then ssh in and stop kodi.

    Code
    systemctl stop kodi

    Now lookup the remote in /proc/bus/input/devices. According to the infos in post 3 there should be 2 entries, one for the keyboard / remote part and one for the mouse - we're interested in the former. Look at the name entries (Name="2.4G Smart Remote") and the handler (Handlers=sysrq kbd eventX) to locate it - ignore the one with the mouse handler.

    We need the event device number (eventX) and sysfs path from that block:


    Now run evtest on the event device (substitute event0 with the event device number from above)

    Code
    evtest /dev/input/event0

    Press the OK button, you should get something like this:

    Code
    Event: time 1510571041.251851, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
    Event: time 1510571041.251851, type 1 (EV_KEY), code 352 (KEY_OK), value 1
    Event: time 1510571041.251851, -------------- SYN_REPORT ------------
    Event: time 1510571041.291835, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
    Event: time 1510571041.291835, type 1 (EV_KEY), code 352 (KEY_OK), value 0
    Event: time 1510571041.291835, -------------- SYN_REPORT ------------

    We are interested in the scancode of the button, that's the value in the EV_MSC line. In the output above that would be 70028. The EV_KEY line tells us which key code the button/key is mapped to - in above example it's KEY_OK (which kodi can't handle), we want to remap that to KEY_ENTER (which kodi supports).

    Now stop evtest with ctrl-c.

    Next thing we need is the modalias of the input device. We can get that with udevadm using the sysfs path from above. Run the following command, replace the long /devices/platform/... path with the one you got from /proc/bus/input/devices

    Code
    udevadm test /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:25A7:5704.0001/input/input0 2>&1 | grep ^MODALIAS

    This should print a line like this:

    Code
    MODALIAS=input:b0003v05A4p9881e0110-e0,1,4,11,14,k77,7D,7E,7F,160,ram4,l0,1,2,sfw

    The important info from that line is the "input:bXXXXvYYYYpZZZZ" part. In your case that would probably be "input:b0003v25A7p5704" (b0003 is USB bus, followed by v and uppercase USB vendor id, followed by p and uppercase USB product id) - we can ignore the stuff after that (eXXXX is the version info from USB).

    Now with this info we can create a /storage/.config/hwdb.d/70-local-keyboard.hwdb file with the following content. Replace the "input:..." and the scancode in KEYBOARD_KEY_XXXXX with your values. Don't forget the "*" at the end of the evdev:input:... line!

    Code
    evdev:input:b0003v05A4p9881*
     KEYBOARD_KEY_70028=enter

    To activate the config run the following commands:

    Code
    udevadm hwdb --update
    udevadm trigger -s input

    Then run evtest again, press the OK button and verify that you now see KEY_ENTER in the EV_KEY lines

    Code
    evtest /dev/input/event0
    ...
    Event: time 1510573065.623580, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
    Event: time 1510573065.623580, type 1 (EV_KEY), code 28 (KEY_ENTER), value 1
    Event: time 1510573065.623580, -------------- SYN_REPORT ------------
    Event: time 1510573065.663566, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70028
    Event: time 1510573065.663566, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
    Event: time 1510573065.663566, -------------- SYN_REPORT ------------

    If it doesn't work please post the evtest output and the contents of your hwdb file.

    so long,

    Hias

    Thanks for the feedback and I'm glad it works now!

    In 8.0 the Lirc option was mistakingly enabled in a lot of cases without actually doing anything, but in 8.2 this can now cause issues.

    So you don't loose anything by disabling it, on the contrary, you restore the state that your remote receiver was meant to be used - handled by the Linux kernel instead of Lirc.

    so long,

    Hias

    Sorry, had a stupid little bug in the rule - missed the "\" at the end of the first line

    Code
    # 2.4G Smart Remote with keyboard and mouse inputs
    ENV{ID_VENDOR_ID}=="25a7",  ENV{ID_MODEL_ID}=="5704", ENV{ID_INPUT_KEYBOARD}=="?*", \
      ENV{eventlircd_enable}="true"

    I fixed the file, could you re-download and try again?

    so long,

    Hias

    Could you try downloading this file 98-eventlircd.rules to /storage/.config/udev.rules.d/98-eventlircd.rules and then reboot

    Code
    wget -O /storage/.config/udev.rules.d/98-eventlircd.rules http://www.horus.com/~hias/tmp/libreelec/24gsmartremote/98-eventlircd.rules

    This'll add the following block to the usb section of eventlircd udev rules file so that eventlircd will pick up input from your remote

    Code
    # 2.4G Smart Remote with keyboard and mouse inputs
    ENV{ID_VENDOR_ID}=="25a7",  ENV{ID_MODEL_ID}=="5704", ENV{ID_INPUT_KEYBOARD}=="?*",
      ENV{eventlircd_enable}="true"

    Please check if the keyboard part of your remote still works, I fear shift, control, caps etc will then be non-functional.

    so long,

    Hias

    I did some more digging but I'm still not sure who's to blame for the wakeup issues. Could be kernel 4.11, could be atvclient - no idea.

    I think the best solution is to build the hid-appleir driver as a module. Other major linux distributions do this as well, people can still use the remote without atvclient and it's also easy to disable the driver via a simple modprobe blacklist entry.

    Could you please do a test with this build: LibreELEC-Generic.x86_64-8.2-devel-20171108132958-r26201-g0285ca7ff1.tar

    This build includes the appleir driver as a module, to disable it create a file /storage/.config/modprobe.d/disable-appleir.conf with the following content:

    Code
    blacklist hid_appleir

    I've also enabled wake-from-suspend per default on the appleir USB device so you should no longer need the "echo enabled > /sys/bus/usb/devices/2-1.8.2/power/wakeup" line in autostart.sh.

    Could you create the modprobe file and remove the wakeup link from your autostart.sh and test if that setup works?

    so long,

    Hias

    USB remote dongles are often not configurable via lirc or ir-keytable, they appear to the system like a USB keyboard. The Gmyle / Ortek VRC-1100 dongle is one such example, Another common example for this class of IR receivers is the FLIRC dongle.

    gpio-ir is one of the most flexible IR receivers as it supports both in-kernel decoding and can also be used with lirc. In this case it's important that only one configuration method (either ir-keytable or lirc) is used, otherwise you have 2 configuration schemes fighting against each other - a classical race condition.

    so long,

    Hias

    Thanks for the info!

    This is very puzzling. Systemctl start atvclient does exactly the same, it runs atvclient -m, and no errors are logged. No idea why one invocation should work but not the other.

    You could try playing around with the Harmony settings. A lot of IR issues stem from the Harmony working quite differently than original remotes. For example, command repeat should be set to 0. Another thing to check is the configured remote profile - there are 2 different apple remotes, see eg here: Apple remote - Official Kodi Wiki . Try both the 6 and 7 button remote profiles.

    If none of this helps, it's worth testing with lircd instead of atvclient. First disable atvclient:

    Code
    systemctl mask atvclient

    then reboot (you can later re-enable atvclient with "systemctl unmask atvclient" plus rebooting).

    Now copy /etc/lirc/lirc_options.conf to /storage/.config/lirc_options.conf and change the driver and device configuration:

    Code
    driver          = macmini
    device          = /dev/usb/hiddev0

    Note: if you have more than one /dev/usb/hiddev* file, test with all of them.

    You'll also need a /storage/.config/lircd.conf file matching your remote. You can either try the one from the kodi wiki page linked above or this one - depending on which remote you have configured - lircd.conf.macmini

    If you use the latter you have to change the KEY_... definitions to KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_OK and KEY_BACK to get normal control.

    Now you can enable Lirc in LibreELEC Settings -> Services and see if it works.

    If none of the lircd.conf files work, you can try to create your own using irrecord. Make sure you disable lirc in LE settings before, otherwise irrecord can't access the IR receiver device.

    Code
    irrecord -H macmini -d /dev/usb/hiddev0

    After running that copy the newly created REMOTENAME.lircd.conf file to /storage/.config/lircd.conf and enable lirc in LE settings again.

    Note: I haven't tested this myself (don't have the hardware), so it could be that I got something wrong. In this case just post here :)

    so long,

    Hias

    This sounds like atvclient might be starting a bit too early.

    Could you test if it works after running the following commands:

    Code
    systemctl stop atvclient
    systemctl start atvclient

    also please post the output of the following commands (after running the commands above)

    Code
    cat /proc/bus/input/devices | paste
    systemctl status atvclient | paste

    so long,

    Hias

    Hi Jeroen,

    interesting that atvclient always worked for you - I'll probably need have a closer look into the differences between your setup and the one where atvclient failed.

    Here's a build without the apple-ir driver: LibreELEC-Generic.x86_64-8.2-devel-20171030102100-r26198-g0239080387.tar

    It would also be great if you could run the following commands on 8.0.2, 8.2.0, 8.2.0 with atvclient disabled, and the build above and post the output - this should hopefully give some hints if other wakeup related settings have changed:

    Code
    cat /proc/acpi/wakeup
    find /sys/devices -name wakeup | xargs grep .

    so long,

    Hias