Announcement

Collapse
No announcement yet.

[Solved] Reload ivtv automatically after sleep?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Reload ivtv automatically after sleep?

    I have a Hauppauge pvr-150 that refuses to work after waking from sleep mode. I either have to reboot or do a sudo rmmod ivtv > sudo modprobe ivtv > sudo depmod -a.

    Is there any way to reload the ivtv driver automatically after waking from sleep? I do see an option in the system settings power management application that says run script, but don't know exactly how to write the script or make it run as root.

    I did an attempt at a very simple script which does work when I run it manually and it looks like this (I have no experience at scripting, so no laughing!)"

    Code:
    #!/bin/bash
    rmmod ivtv
    modprobe ivtv
    depmod -a
    v4l2-ctl -i 2
    echo "Done Resetting ivtv"
    Of course I run it with sudo. Oh, I also threw in the v4l2-ctl part because I'm using the composite output on the card. Thanks in advance for any ideas!

    #2
    Re: Reload ivtv automatically after sleep?

    Found a solution that seems to work so far. Credit goes to http://thesopebocks.com/2009/07/26/r...d-wake-fedora/ which led me to the ArchWiki page on creating your own hooks for hibernate and resume which is at https://wiki.archlinux.org/index.php...your_own_hooks.

    The last example on the ArchWiki is what I used to finally get this working. I wasn't really sure which number I should put in the script name (determines when it gets executed) but I ended up using 97. Here's what my script looks like now:

    Code:
    #!/bin/bash
    case $1 in
      hibernate)
        ;;
      suspend)
        rmmod ivtv
        ;;
      thaw)
        ;;
      resume)
        modprobe ivtv; v4l2-ctl -i 2
        ;;
      *)
        ;;
    esac
    Called it 97reloadivtv, made it executable, and put it in /usr/lib/pm-utils/sleep.d/ . If there's anything you guys see here that I should change feel free to chime in.

    Comment

    Working...
    X