Enable IR Remote Control Wake Up On USB Port

# read this tutorial if you cannot wake up (resume) your Barebone PC with your IR remote control after entering standby mode (suspend)
# do the following to enable wake up on USB port where your IR remote control receiver (USB IR Blaster) is connected
# check the usb port used by your receiver

  1. $ lsusb -t
pi@medialounge:~$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
    |__ Port 1: Dev 6, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 1: Dev 6, If 0, Class=Vendor Specific Class, Driver=mceusb, 12M
    |__ Port 3: Dev 3, If 0, Class=Audio, Driver=snd-usb-audio, 480M

# mceusb is on Bus 1 Port 1 (1-1)
# to confirm the USB port, get the Product ID of the receiver

  1. $ lsusb
pi@medialounge:~$  lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 152a:8750 Thesycon Systemsoftware & Consulting GmbH D90 MQA
Bus 001 Device 009: ID 147a:e03e Formosa Industrial Computing, Inc. Infrared Receiver [IR605A/Q]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

# Infrared Receiver Product ID is e03e

# then get the port your receiver is plugged in:

  1. $ grep e03e /sys/bus/usb/devices/*/idProduct
/sys/bus/usb/devices/1-1/idProduct:e03e

# 1-1 confirm the Bus 1 and Port 1
# now check if wake up is enabled for this device

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

# it is disabled, enable wake up on this port

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

# check again

  1. $ cat /sys/bus/usb/devices/1-1/power/wakeup
enabled

# create a systemd entry to make it permanent
# store the script in /usr/local/bin

  1. $ sudo nano /usr/local/bin/ir-remote-wakeup.sh

# add the command to enable wakeup

#!/usr/bin/bash
# enable wake up on IR remote control using USB bus 1 port 1
echo enabled > /sys/bus/usb/devices/1-1/power/wakeup

# CTRL+X and Y to SAVE

  1. $ sudo chmod +x /usr/local/bin/ir-remote-wakeup.sh

#
# now create a systemd service to make it permanent

  1. $ sudo nano /lib/systemd/system/ir-remote-wakeup.service
# enable wake up ir remote conrol on bus 1 port 1
[Unit]
Description=wakeup ir remote on bus 1 port 1 see ir-remote-wakeup.sh from /usr/local/bin/ for more info

[Service]
ExecStart=/usr/local/bin/ir-remote-wakeup.sh

[Install]
WantedBy=multi-user.target

# enable service

  1. $ sudo systemctl daemon-reload
  2. $ sudo systemctl enable ir-remote-wakeup.service
  3. $ sudo systemctl start ir-remote-wakeup.service

#
# on suspend mode your IR remote control can now wake up the barebone PC


# to allow sleep (suspend) but disallow hibernation
# edit

  1. $ sudo nano /etc/systemd/logind.conf
[Sleep]
AllowSuspend=yes
AllowHibernation=no
AllowSuspendThenHibernate=no

# disable ASPM in bios may help if your PCIe hardware cannot on wake up from sleep
# check if the PC wake up normaly if this still not working change the ASPM policy
# check it with:

  1. $ cat /sys/module/pcie_aspm/parameters/policy

# should be set to [performance]

[default] performance powersave powersupersave

# if performance is not set add
# pcie_aspm=force pcie_aspm.policy=performance cmds
# to grub GRUB_CMDLINE_LINUX_DEFAULT

  1. $ sudo nano /etc/default/grub

# add the cmds, save and update grub

  1. $ sudo update-grub
  1. $ sudo reboot

# check again with

  1. $ cat /sys/module/pcie_aspm/parameters/policy
default [performance] powersave powersupersave