The PCI device will exist whether or not the module was loaded; so you can just iterate over /sys/bus/pci/devices/* (* expands to the PCI bus IDs) and check the attributes in each directory; e. g. you probably want to pick out the ones with class == 0x030000 (graphics card), and perhaps vendor == 10DE (nvidia).
If you want to do that via an udev rule: I'm not entirely sure which kinds of events you get when the nvidia driver gets loaded. You can unload it, run udevadm monitor -e --udev then load it, and see what kind of events you get. For sure you'll see an "add" event for SUBSYSTEM=="module", DEVPATH=="*/nvidia", but either on boot or when loading the module you should also see an "add" or "change" event for the graphics card itself. This is an initial sketch of a rule which selects a PCI card whose driver is nvidia: ACTION=="add|change", SUBSYSTEM=="pci", DRIVER=="nvidia*", RUN+= "touch /run/nvidia-loaded-for-pci-id-$env{PCI_ID}" (using "nvidia*" here in case the modules might be called something like nvidia_123). You can use udev properties like $env{PCI_ID} and also attributes from sysfs like the above, with e. g. $attr{vendor}. See man udev(7) for other macros you can use in RUN clauses. Then you don't need the "remove" rule any more -- if /sys/modules/nvidia does not exist but your stamp in /run does exist, you know that it was once loaded but then removed. -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to ubuntu-drivers-common in Ubuntu. https://bugs.launchpad.net/bugs/1307069 Title: gpu-manager causing long startup delays Status in ubuntu-drivers-common package in Ubuntu: Triaged Bug description: I have installing ubuntu 14.04 beta2 and i have update it to latest. My computer take 40 seconds for start up from displaying grub until displaying LightDM on my SSD. My ubuntu 12.04 only takes up 13 seconds for start up on the same SSD. reported as bug from question: #246899 https://answers.launchpad.net/ubuntu/+question/246899 Computer specification: Ati Mobility Radeon HD 5650 and using Mesa 10.2 from Oibaf's PPA (the start up time is same as default Gallium Mesa 10.1) Processors: Intel Core i5-460M (Arrandale) 8 GB DDR3 RAM 1333 MHz Vendor : Acer Aspire 4745G running dmesg | less showing: intel ips 0000:00:1f.6: ME failed to update for more than 1s, likely hung (many rows) ProblemType: Bug DistroRelease: Ubuntu 14.04 Package: grub2 2.02~beta2-9 ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9 Uname: Linux 3.13.0-24-generic i686 NonfreeKernelModules: wl ApportVersion: 2.14.1-0ubuntu2 Architecture: i386 CurrentDesktop: Unity Date: Sun Apr 13 11:25:46 2014 InstallationDate: Installed on 2014-04-07 (5 days ago) InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Beta i386 (20140326) SourcePackage: grub2 UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/1307069/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp