Lines 45-56
Link Here
|
45 |
#define GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH GDM_DBUS_PATH "/LocalDisplayFactory" |
45 |
#define GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH GDM_DBUS_PATH "/LocalDisplayFactory" |
46 |
#define GDM_MANAGER_DBUS_NAME "org.gnome.DisplayManager.LocalDisplayFactory" |
46 |
#define GDM_MANAGER_DBUS_NAME "org.gnome.DisplayManager.LocalDisplayFactory" |
47 |
|
47 |
|
48 |
#define HAL_DBUS_NAME "org.freedesktop.Hal" |
|
|
49 |
#define HAL_DBUS_MANAGER_PATH "/org/freedesktop/Hal/Manager" |
50 |
#define HAL_DBUS_MANAGER_INTERFACE "org.freedesktop.Hal.Manager" |
51 |
#define HAL_DBUS_DEVICE_INTERFACE "org.freedesktop.Hal.Device" |
52 |
#define SEAT_PCI_DEVICE_CLASS 3 |
53 |
|
54 |
#define MAX_DISPLAY_FAILURES 5 |
48 |
#define MAX_DISPLAY_FAILURES 5 |
55 |
|
49 |
|
56 |
struct GdmLocalDisplayFactoryPrivate |
50 |
struct GdmLocalDisplayFactoryPrivate |
Lines 372-454
create_display (GdmLocalDisplayFactory *factory)
Link Here
|
372 |
return display; |
366 |
return display; |
373 |
} |
367 |
} |
374 |
|
368 |
|
375 |
#if 0 |
|
|
376 |
static void |
377 |
create_display_for_device (GdmLocalDisplayFactory *factory, |
378 |
DBusGProxy *device_proxy) |
379 |
{ |
380 |
create_display (factory); |
381 |
} |
382 |
|
383 |
static void |
384 |
create_displays_for_pci_devices (GdmLocalDisplayFactory *factory) |
385 |
{ |
386 |
char **devices; |
387 |
const char *key; |
388 |
const char *value; |
389 |
GError *error; |
390 |
gboolean res; |
391 |
int i; |
392 |
|
393 |
g_debug ("GdmLocalDisplayFactory: Getting PCI seat devices"); |
394 |
|
395 |
key = "info.bus"; |
396 |
value = "pci"; |
397 |
|
398 |
devices = NULL; |
399 |
error = NULL; |
400 |
res = dbus_g_proxy_call (factory->priv->proxy, |
401 |
"FindDeviceStringMatch", |
402 |
&error, |
403 |
G_TYPE_STRING, key, |
404 |
G_TYPE_STRING, value, |
405 |
G_TYPE_INVALID, |
406 |
G_TYPE_STRV, &devices, |
407 |
G_TYPE_INVALID); |
408 |
if (! res) { |
409 |
g_warning ("Unable to query HAL: %s", error->message); |
410 |
g_error_free (error); |
411 |
} |
412 |
|
413 |
/* now look for pci class 3 */ |
414 |
key = "pci.device_class"; |
415 |
for (i = 0; devices [i] != NULL; i++) { |
416 |
DBusGProxy *device_proxy; |
417 |
int class_val; |
418 |
|
419 |
device_proxy = dbus_g_proxy_new_for_name (factory->priv->connection, |
420 |
HAL_DBUS_NAME, |
421 |
devices [i], |
422 |
HAL_DBUS_DEVICE_INTERFACE); |
423 |
if (device_proxy == NULL) { |
424 |
continue; |
425 |
} |
426 |
|
427 |
error = NULL; |
428 |
res = dbus_g_proxy_call (device_proxy, |
429 |
"GetPropertyInteger", |
430 |
&error, |
431 |
G_TYPE_STRING, key, |
432 |
G_TYPE_INVALID, |
433 |
G_TYPE_INT, &class_val, |
434 |
G_TYPE_INVALID); |
435 |
if (! res) { |
436 |
g_warning ("Unable to query HAL: %s", error->message); |
437 |
g_error_free (error); |
438 |
} |
439 |
|
440 |
if (class_val == SEAT_PCI_DEVICE_CLASS) { |
441 |
g_debug ("GdmLocalDisplayFactory: Found device: %s", devices [i]); |
442 |
create_display_for_device (factory, device_proxy); |
443 |
} |
444 |
|
445 |
g_object_unref (device_proxy); |
446 |
} |
447 |
|
448 |
g_strfreev (devices); |
449 |
} |
450 |
#endif |
451 |
|
452 |
static gboolean |
369 |
static gboolean |
453 |
gdm_local_display_factory_start (GdmDisplayFactory *base_factory) |
370 |
gdm_local_display_factory_start (GdmDisplayFactory *base_factory) |
454 |
{ |
371 |
{ |
Lines 525-553
register_factory (GdmLocalDisplayFactory *factory)
Link Here
|
525 |
return TRUE; |
442 |
return TRUE; |
526 |
} |
443 |
} |
527 |
|
444 |
|
528 |
static gboolean |
|
|
529 |
connect_to_hal (GdmLocalDisplayFactory *factory) |
530 |
{ |
531 |
factory->priv->proxy = dbus_g_proxy_new_for_name (factory->priv->connection, |
532 |
HAL_DBUS_NAME, |
533 |
HAL_DBUS_MANAGER_PATH, |
534 |
HAL_DBUS_MANAGER_INTERFACE); |
535 |
if (factory->priv->proxy == NULL) { |
536 |
g_warning ("Couldn't create proxy for HAL Manager"); |
537 |
return FALSE; |
538 |
} |
539 |
|
540 |
return TRUE; |
541 |
} |
542 |
|
543 |
static void |
544 |
disconnect_from_hal (GdmLocalDisplayFactory *factory) |
545 |
{ |
546 |
if (factory->priv->proxy == NULL) { |
547 |
g_object_unref (factory->priv->proxy); |
548 |
} |
549 |
} |
550 |
|
551 |
static GObject * |
445 |
static GObject * |
552 |
gdm_local_display_factory_constructor (GType type, |
446 |
gdm_local_display_factory_constructor (GType type, |
553 |
guint n_construct_properties, |
447 |
guint n_construct_properties, |
Lines 565-572
gdm_local_display_factory_constructor (GType type,
Link Here
|
565 |
g_warning ("Unable to register local display factory with system bus"); |
459 |
g_warning ("Unable to register local display factory with system bus"); |
566 |
} |
460 |
} |
567 |
|
461 |
|
568 |
connect_to_hal (factory); |
|
|
569 |
|
570 |
return G_OBJECT (factory); |
462 |
return G_OBJECT (factory); |
571 |
} |
463 |
} |
572 |
|
464 |
|
Lines 611-618
gdm_local_display_factory_finalize (GObject *object)
Link Here
|
611 |
|
503 |
|
612 |
g_hash_table_destroy (factory->priv->displays); |
504 |
g_hash_table_destroy (factory->priv->displays); |
613 |
|
505 |
|
614 |
disconnect_from_hal (factory); |
|
|
615 |
|
616 |
G_OBJECT_CLASS (gdm_local_display_factory_parent_class)->finalize (object); |
506 |
G_OBJECT_CLASS (gdm_local_display_factory_parent_class)->finalize (object); |
617 |
} |
507 |
} |
618 |
|
508 |
|