1

I'm a noob when it comes to using systemd. I'm running Ubuntu 15.04 with the Hauppauge 2250 TV tuner. Unfortunately, the driver/module for the 2250, "saa7164", is not compatible with suspend/resume so live TV will not work after resuming. So I'm using the following file to stop/resume tvheadend and saa7164:

sudo gedit /lib/systemd/system-sleep/50_tvheadend

Which contains the following scipt:

#!/bin/sh
case "$1" in
  pre/*)
    echo "Entering sleep..." >  /tmp/sleep.log
    echo "Entering sleep"
    cat /proc/acpi/wakeup >> /tmp/sleep.log
    service tvheadend stop
    sleep 1
    modprobe -r tveeprom
    modprobe -r dvb_core
    modprobe -r v4l2_common
    modprobe -r videodev
    modprobe -r saa7164
    sleep 3
    echo "After modprobe..."  >> /tmp/sleep.log
    cat /proc/acpi/wakeup >> /tmp/sleep.log
    ;;
  post/*)
    echo "Awaking from sleep..." >>  /tmp/sleep.log
    echo "Waking up"
    modprobe saa7164
    modprobe videodev
    modprobe v4l2_common
    modprobe dvb_core
    modprobe tveeprom
    sleep 3
    echo "After modprobe..."  >> /tmp/sleep.log
    service tvheadend start
    sleep 1
        \cat /proc/acpi/wakeup >> /tmp/sleep.log
    ;;
esac

For good measure, I made the file executable by everyone:

sudo chmod 755 /lib/systemd/system-sleep/50_tvheadend

But this didn't work. So I ran the commands to start and stop tvheadend in terminal, which worked. But when I tried to stop the saa7164 driver in terminal using "modprobe -r saa7164", it errored. So I followed these instructions on how to unload a kernel module which is in use, but my script attempted to unload all the modules listed in "lsmod | grep saa7164" and failed. So I attempted to run the commands in terminal, as follows:

htpc@htpc-desktop:~$ sudo modprobe -r saa7164
modprobe: FATAL: Module saa7164 is in use

htpc@htpc-desktop:~$ lsmod | grep saa7164
saa7164               131072  -1
tveeprom               24576  1 saa7164
dvb_core              126976  1 saa7164
v4l2_common            16384  1 saa7164
videodev              159744  2 saa7164,v4l2_common

htpc@htpc-desktop:~$ sudo modprobe -r tveeprom
modprobe: FATAL: Module tveeprom is in use.

htpc@htpc-desktop:~$ lsmod | grep tveeprom
tveeprom               24576  1 saa7164

How do I unload the saa7164 driver/module?

guttermonk
  • 1,024

2 Answers2

0

You can try to unload the driver by stopping the service that is using it, or by disabling the use of the driver in the system settings. To do this, try running the following commands:

sudo rmmod saa7164
sudo rmmod tveeprom

If the above command fails, try using the force option:

sudo rmmod -f saa7164
sudo rmmod -f tveeprom

f the above command also fails, you can try to blacklist the driver from being loaded at boot time. You can do this by adding the following lines to /etc/modprobe.d/blacklist.conf:

blacklist saa7164
blacklist tveeprom

Save and close the file, then restart your system. The driver should not load at boot time, and you should be able to unload it.

0

I think you also need to stop any program that is using the module, before you remove it. You aren't running MythTV by any chance?