################################################################################
#      This file is part of OpenELEC - http://www.openelec.tv
#      Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
#
#  OpenELEC is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 2 of the License, or
#  (at your option) any later version.
#
#  OpenELEC is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with OpenELEC.  If not, see <http://www.gnu.org/licenses/>.
################################################################################

ACTION!="add|change", GOTO="end_video"

# xorg_start only does something for subsystem "pci" and "video" class.
SUBSYSTEM=="pci", ATTR{class}=="0x030000", GOTO="subsystem_pci"
SUBSYSTEM=="drivers", GOTO="subsystem_drivers"
GOTO="end_video"

# check for drivers dont use the pci substem
LABEL="subsystem_drivers"
KERNEL=="nvidia", ENV{xorg_driver}="nvidia", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@nvidia.service"
GOTO="end_video"

# check for drivers using the pci substem
LABEL="subsystem_pci"
DRIVER=="i915", ENV{xorg_driver}="i915", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@i915.service"
DRIVER=="radeon", ENV{xorg_driver}="radeon", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xorg-configure@radeon.service"
GOTO="end_video"

LABEL="end_video"
