Archive:Fix TBS6981 Sleep Issue

From Official Kodi Wiki
Revision as of 21:52, 28 August 2020 by Karellen (talk | contribs) (Karellen moved page HOW-TO:Fix TBS6981 Sleep Issue to Archive:Fix TBS6981 Sleep Issue without leaving a redirect: Outdated)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There is currently an issue with the TBS6981 where it does not currently support S3 sleep [REF] , meaning that if the system that the card is installed in is put into a hibernate of sleeping state the card will not resume when the system wakes up. To work around this issue a sleep/wake script will need to be run which unloads the card before hibernate and wakes it when the system resumes.

To check to see if your card is experiencing this issue run the dmesg command and you should see lines like this appearing in the logfile

[  232.785420] cx23885[0]: failed to set up deferred work for AV Core/IR interrupt. Interrupt is disabled and won't be re-enabled
[  233.840125] cx23885[0]: failed to set up deferred work for AV Core/IR interrupt. Interrupt is disabled and won't be re-enabled
[  234.773581] cx23885[0]: failed to set up deferred work for AV Core/IR interrupt. Interrupt is disabled and won't be re-enabled
[  235.007368] cx23885[0]: failed to set up deferred work for AV Core/IR interrupt. Interrupt is disabled and won't be re-enabled

Open your favourite text editor and save the below script as 99_dvb ( or what ever you wish to call it )

#!/bin/sh

case "${1}" in
  hibernate|suspend)
    sudo service mythtv-backend stop					#Stop MythTV Backend
    sudo service lirc stop						#Stop LIRC
    sudo modprobe -r cx23885 dvb_core rc_tbs_nec tbsfe tbs6981fe        #Unload TBS6981 drivers
        ;;
  resume|thaw)
    sudo modprobe cx23885						#Reload TBS6981 drivers
    sudo service mythtv-backend start					#Reload MythTv Backend 
    sudo service lirc start						#Reload LIRC
    
    ###################################################################################################################
    # This script will cause the /sys/class/rc/rcX device to increment each time the system wakes,                    #
    # to get around this re-initiate ir-keytable pointing it to the new rcX device.                                   #
    # -c Clears out the old IR-keytable                                                                               #
    # --Protocol sets the protocol to any of the ones that your system supports NEC, RC-5, RC-6, JVC, SONY, LIRC      #
    # --sysdev=$(ls /sys/class/rc) sets ir-keytable to use the latest rcX device                                      #
    # -w loads a custom keymap file from /etc/rc_keytables/tbs_nec                                                    #
    ###################################################################################################################
    sudo ir-keytable -c --protocol=nec --sysdev=$(ls /sys/class/rc/) -w /etc/rc_keymaps/tbs_nec 
        ;;
  *)
    ;;
esac

move the file to the /etc/pm/sleep.d directory set the file permissions to 775, change the ownership to the Root user.

XBMC:/$ sudo mv /99_dvb /etc/pm/sleep.d/
[sudo] password for xbmc:

XBMC:/$ sudo chmod 755 /etc/pm/sleep.d/99_dvb 
XBMC:/$ sudo chown root:root /etc/pm/sleep.d/99_dvb 
matt@XBMC:/$ ls -l /etc/pm/sleep.d/
total 20
-rwxr-xr-x 1 root root  210 Oct 14 18:37 10_grub-common
-rwxr-xr-x 1 root root  581 Oct  5 15:21 10_unattended-upgrades-hibernate
-rwxr-xr-x 1 root root  428 Dec 27 17:45 99_dvb
-rwxr-xr-x 1 root root 1354 Dec 13 08:29 99lirc-resume
-rwxr-xr-x 1 root root 1260 May 23  2012 novatel_3g_suspend
matt@XBMC:/$