Help with UDEV Rule for HDMI switching

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read how to get help

Help with UDEV Rule for HDMI switching

Postby xerxes1986 on Wed Dec 12, 2012 6:06 am

Hi,

I wrote a little script to switch the audio over to HDMI and back to speakers, and I would like it to execute when an HDMI cable is plugged in/ unplugged. After HOURS of researching I think I have found out that I need to use a udev rule. I have never done this before, and it isn't working.

First, I did udevadm monitor --env to see if the kernel detects the HDMI cord...this is what I get for both plugging in and unplugging:

KERNEL[19283.520244] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm)
ACTION=change
DEVNAME=dri/card0
DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=3518
SUBSYSTEM=drm
UDEV_LOG=3

UDEV [19283.542654] change /devices/pci0000:00/0000:00:02.0/drm/card0 (drm)
ACTION=change
DEVNAME=/dev/dri/card0
DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=3518
SUBSYSTEM=drm
TAGS=:udev-acl:
UDEV_LOG=3
USEC_INITIALIZED=22622756



Ok, great. So now to create a udev rule:

sudo vim /etc/udev/rules.d/10-local.rules

KERNEL=="card0", ACTION=="change", RUN+="/home/username/Scripts/SwitchHDMIAudio.sh"



Now, from what I have read, this SHOULD work...but it doesn't. I've tried restarting the udev service and reloading the rules to no avail...any help?
xerxes1986
Level 1
Level 1
 
Posts: 3
Joined: Mon Nov 19, 2012 4:10 pm

Linux Mint is funded by ads and donations.
 

Return to Sound, Multimedia & Codecs

Who is online

Users browsing this forum: No registered users and 4 guests