hal: Branch 'master' - 2 commits

David Zeuthen david at kemper.freedesktop.org
Tue Jul 3 16:04:05 PDT 2007


 doc/spec/hal-spec-properties.xml |   20 ++++++++++++++++++++
 hald/linux/osspec.c              |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

New commits:
diff-tree ac8cd419764f9131f7972e064ab1f84112e06817 (from f0552218bb71daa863a62d9ad578810e9f3e24e7)
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Jul 3 19:04:04 2007 -0400

    add docs for new system.hardware.primary_video.* properties

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 377fa56..9e183d3 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -2879,6 +2879,26 @@ org.freedesktop.Hal.Device.Volume.method
             </row>
             <row>
               <entry>
+                <literal>system.hardware.primary_video.vendor</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>
+                The PCI vendor ID of the primary graphics card in the system.
+              </entry>
+            </row>
+            <row>
+              <entry>
+                <literal>system.hardware.primary_video.product</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>
+                The PCI device ID of the primary graphics card in the system.
+              </entry>
+            </row>
+            <row>
+              <entry>
                 <literal>system.firmware.vendor</literal> (string)
               </entry>
               <entry></entry>
diff-tree f0552218bb71daa863a62d9ad578810e9f3e24e7 (from 356ccdfa3bbf64648c48da8b756eaccef13d0dd9)
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Jul 3 19:03:45 2007 -0400

    set system.hardware.primary_video.[vendor,product] keys
    
    This is to be used for more fine-grained quirk matching; unfortunately
    matching on DMI data is not sufficient since some vendors reuse the
    same DMI data for laptops with graphics cards from different vendors.
    
    From Phil Knirsch at Red Hat:
    > I've just checked again: We have 2 Dell D620 machines here, one with an
    > Intel, the other with a Nvidia card and both have the identical product
    > and vendor. :(
    
    Even worse is this
    
    http://www.amazon.com/Sony-VGN-SZ450N-Notebook-Processor-Business/dp/B000M5ZHM4
    
    > Hybrid Graphics System lets toggle between NVidia GeForce Go 7400 (up
    > to 335 MB shared) and Intel Graphics Media Accelerator 950 (224 MB
    > shared)

diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index 9fc2ce3..6227e34 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -677,6 +677,38 @@ computer_probing_pm_is_supported_helper_
         decode_dmi (d);
 }
 
+static void
+get_primary_videocard (HalDevice *d)
+{
+        GDir *dir;
+        const char *name;
+
+        dir = g_dir_open ("/sys/bus/pci/devices", 0, NULL);
+        if (dir == NULL)
+                goto out;
+        while ((name = g_dir_read_name (dir)) != NULL) {
+                int class;
+                char *path;
+                path = g_strdup_printf ("/sys/bus/pci/devices/%s", name);
+                if (hal_util_get_int_from_file (path, "class", &class, 0) && (class&0xffff00) == 0x030000 ) {
+                        int vendor, device;
+                        if (hal_util_get_int_from_file (path, "vendor", &vendor, 0) &&
+                            hal_util_get_int_from_file (path, "device", &device, 0)) {
+                                HAL_INFO (("got %x:%x as primary videocard", vendor, device));
+                                hal_device_property_set_int (d, "system.hardware.primary_video.vendor", vendor);
+                                hal_device_property_set_int (d, "system.hardware.primary_video.product", device);
+                                g_free (path);
+                                g_dir_close (dir);
+                                goto out;
+                        }
+                }
+                g_free (path);
+        }
+        g_dir_close (dir);
+out:
+        ;
+}
+
 void 
 osspec_probe (void)
 {
@@ -708,6 +740,9 @@ osspec_probe (void)
 	 */
 	set_suspend_hibernate_keys (root);
 
+        /* set the vendor/product of primary video card */
+        get_primary_videocard (root);
+
         /* Try and set the suspend/hibernate keys using pm-is-supported
          */
         if (g_file_test ("/usr/bin/pm-is-supported", G_FILE_TEST_IS_EXECUTABLE)) {


More information about the hal-commit mailing list