Tag Archives: mce

Kodi, MCE Remote and Ubuntu

I have always had problems with wakeup of my media PC’s after a suspend or hibernation using my MCE (Microsoft media center) remote.

The problem was solved by enabling wakeup on the USB bus device. On some of my devices I also had to enable port on the ACPI (Advanced Configuration and Power Interface). The grub bootloader parameters might also need some changes.

The first thing to do is finding out which usb port Infrared reciever is connected.

lsusb will list your attached usb devices:

$ lsusb
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 003 Device 005: ID 046d:c71f Logitech, Inc. diNovo Mini Wireless Keyboard
 Bus 003 Device 004: ID 046d:c71e Logitech, Inc.
 Bus 003 Device 003: ID 046d:0b07 Logitech, Inc.
 Bus 003 Device 002: ID 1784:0008 TopSeed Technology Corp. eHome Infrared Transceiver
 Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 010 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

The bold line of text is my usb ir receiver. Use the device id (0008 in my case) with the following command to find your device in /sys/bus/usb/devices

$ grep 0008 /sys/bus/usb/devices/*/idProduct
 /sys/bus/usb/devices/3-1/idProduct:0008

Now use that location to check if wakeup from the device is enabled with:

$ cat /sys/bus/usb/devices/3-1/power/wakeup
 disabled

The following command will change this setting to enabled:

$ sudo sh -c 'echo "enabled" > /sys/bus/usb/devices/3-1/power/wakeup'

This setting will be reset on boot so to enable it on every boot you have to add the line to your /etc/rc.local file. You must be root to update the rc.local file.

$ sudo nano /etc/rc.local

and add the below below line before exit(0):

echo enabled > /sys/bus/usb/devices/3-1/power/wakeup

Save with <Ctrl>o and exit with <Ctrl x>.

Make sure /etc/rc.local is executable with the command

$ sudo chmod +x /etc/rc.local

The next is the ACPI needs to up updated as well. First inspect the ACPI wakeup configuration:

$ cat /proc/acpi/wakeup 
Device  S-state   Status   Sysfs node
PCI0      S5    *disabled  no-bus:pci0000:00
PEX0      S5    *disabled  pci:0000:00:1c.0
PEX1      S5    *disabled
PEX2      S5    *disabled
PEX3      S5    *disabled  pci:0000:00:1c.3
PEX4      S5    *disabled  pci:0000:00:1c.4
PEX5      S5    *disabled
HUB0      S5    *disabled  pci:0000:00:1e.0
USB0      S3    *disabled   pci:0000:00:1d.0
USB1      S3    *enabled   pci:0000:00:1d.1
USB2      S3    *disabled   pci:0000:00:1d.2
USB3      S3    *enabled   pci:0000:00:1a.0
USB4      S3    *enabled   pci:0000:00:1a.1
USB5      S3    *enabled   pci:0000:00:1a.2
USBE      S3    *enabled   pci:0000:00:1d.7
USE2      S3    *disabled   pci:0000:00:1a.7
AZAL      S5    *disabled

As you can see is USB0,USB2 and USE3 not enabled. For you is might be different.
I added the below lines  as root to rc.local before exit(0):

$ sudo nano /etc/rc.local

The lines add is different to what others recommend. This is because you cat switch enable and disable by executing the echo  “USB0” >   /proc/acpi/wakeup twice.

status=`cat /proc/acpi/wakeup | grep "USB0" | awk {'print $3}'`
if [ "$status" = "disabled" -o "$status" = "*disabled" ]; then
      echo "USB0" > /proc/acpi/wakeup
fi
status=`cat /proc/acpi/wakeup | grep "USB2" | awk {'print $3}'`
if [ "$status" = "disabled" -o "$status" = "*disabled" ]; then
      echo "USB2" > /proc/acpi/wakeup
fi
status=`cat /proc/acpi/wakeup | grep "USE2" | awk {'print $3}'`
if [ "$status" = "disabled" -o "$status" = "*disabled" ]; then
      echo "USE2" > /proc/acpi/wakeup
fi

The last thing was changing the grub startup paramerters.

$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
acpi_enforce_resources=lax"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

You will have to change the GRUB_CMDLINE_LINUX_DEFAULT (marked bold).

$ sudo nano /etc/default/grub

and change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1 acpi_enforce_resources=lax"

At last you will have to update grub:

$ sudo update-grub

Reboot and test.

Enjoy (some of) your suspend problems is over.

 

Sources: