Lines Matching refs:device
4 * device.c : HalDevice methods
35 #include "device.h"
59 HalDevice *device = HAL_DEVICE (obj);
61 runner_device_finalized (device);
65 printf ("************* in finalize for udi=%s\n", device->udi);
69 g_slist_foreach (device->properties, (GFunc) hal_property_free, NULL);
71 g_slist_free (device->properties);
73 g_free (device->udi);
135 hal_device_init (HalDevice *device)
139 device->udi = g_strdup_printf ("/org/freedesktop/Hal/devices/temp/%d",
141 device->num_addons = 0;
142 device->num_addons_ready = 0;
175 HalDevice *device;
177 device = g_object_new (HAL_TYPE_DEVICE, NULL, NULL);
182 return device;
416 hal_device_get_udi (HalDevice *device)
418 return device->udi;
422 hal_device_set_udi (HalDevice *device, const char *udi)
424 if (device->udi != NULL)
425 g_free (device->udi);
426 device->udi = g_strdup (udi);
430 hal_device_add_capability (HalDevice *device, const char *capability)
432 if (hal_device_property_strlist_add (device, "info.capabilities", capability))
433 g_signal_emit (device, signals[CAPABILITY_ADDED], 0, capability);
437 hal_device_has_capability (HalDevice *device, const char *capability)
443 caps = hal_device_property_get_strlist (device, "info.capabilities");
459 hal_device_has_property (HalDevice *device, const char *key)
461 g_return_val_if_fail (device != NULL, FALSE);
464 return hal_device_property_find (device, key) != NULL;
468 hal_device_num_properties (HalDevice *device)
470 g_return_val_if_fail (device != NULL, -1);
472 return g_slist_length (device->properties);
476 hal_device_property_find (HalDevice *device, const char *key)
480 g_return_val_if_fail (device != NULL, NULL);
483 for (iter = device->properties; iter != NULL; iter = iter->next) {
494 hal_device_property_to_string (HalDevice *device, const char *key)
498 prop = hal_device_property_find (device, key);
506 hal_device_property_foreach (HalDevice *device,
512 g_return_if_fail (device != NULL);
515 for (iter = device->properties; iter != NULL; iter = iter->next) {
519 cont = callback (device, p, user_data);
527 hal_device_property_get_type (HalDevice *device, const char *key)
531 g_return_val_if_fail (device != NULL, HAL_PROPERTY_TYPE_INVALID);
534 prop = hal_device_property_find (device, key);
543 hal_device_property_get_string (HalDevice *device, const char *key)
547 g_return_val_if_fail (device != NULL, NULL);
550 prop = hal_device_property_find (device, key);
559 hal_device_property_get_as_string (HalDevice *device, const char *key, char *buf, size_t bufsize)
563 g_return_val_if_fail (device != NULL, NULL);
567 prop = hal_device_property_find (device, key);
623 hal_device_property_get_int (HalDevice *device, const char *key)
627 g_return_val_if_fail (device != NULL, -1);
630 prop = hal_device_property_find (device, key);
639 hal_device_property_get_uint64 (HalDevice *device, const char *key)
643 g_return_val_if_fail (device != NULL, -1);
646 prop = hal_device_property_find (device, key);
655 hal_device_property_get_bool (HalDevice *device, const char *key)
659 g_return_val_if_fail (device != NULL, FALSE);
662 prop = hal_device_property_find (device, key);
671 hal_device_property_get_double (HalDevice *device, const char *key)
675 g_return_val_if_fail (device != NULL, -1.0);
678 prop = hal_device_property_find (device, key);
687 hal_device_property_set_string (HalDevice *device, const char *key,
693 prop = hal_device_property_find (device, key);
706 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
713 device->properties = g_slist_prepend (device->properties, prop);
715 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
723 hal_device_property_set_int (HalDevice *device, const char *key,
729 prop = hal_device_property_find (device, key);
741 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
747 device->properties = g_slist_prepend (device->properties, prop);
749 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
757 hal_device_property_set_uint64 (HalDevice *device, const char *key,
763 prop = hal_device_property_find (device, key);
775 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
781 device->properties = g_slist_prepend (device->properties, prop);
783 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
791 hal_device_property_set_bool (HalDevice *device, const char *key,
797 prop = hal_device_property_find (device, key);
809 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
815 device->properties = g_slist_prepend (device->properties, prop);
817 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
825 hal_device_property_set_double (HalDevice *device, const char *key,
831 prop = hal_device_property_find (device, key);
843 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
849 device->properties = g_slist_prepend (device->properties, prop);
851 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
894 hal_device_property_remove (HalDevice *device, const char *key)
898 prop = hal_device_property_find (device, key);
903 device->properties = g_slist_remove (device->properties, prop);
907 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
914 hal_device_property_set_attribute (HalDevice *device,
921 prop = hal_device_property_find (device, key);
930 hal_device_print (HalDevice *device)
934 fprintf (stderr, "device udi = %s\n", hal_device_get_udi (device));
936 for (iter = device->properties; iter != NULL; iter = iter->next) {
984 HalDevice *device;
996 g_signal_handler_disconnect (ai->device, ai->prop_signal_id);
998 g_object_unref (ai->device);
1003 prop_changed_cb (HalDevice *device, const char *key,
1016 ai->callback (ai->device, ai->user_data, TRUE);
1028 ai->callback (ai->device, ai->user_data, FALSE);
1036 hal_device_async_wait_property (HalDevice *device,
1046 prop = hal_device_property_find (device, key);
1049 callback (device, user_data, prop != NULL);
1055 ai->device = g_object_ref (device);
1060 ai->prop_signal_id = g_signal_connect (device, "property_changed",
1068 hal_device_callouts_finished (HalDevice *device)
1070 g_signal_emit (device, signals[CALLOUTS_FINISHED], 0);
1073 /** Used when giving up on a device, e.g. if no device file appeared
1076 hal_device_cancel (HalDevice *device)
1078 HAL_INFO (("udi=%s", device->udi));
1079 g_signal_emit (device, signals[CANCELLED], 0);
1086 hal_device_property_get_strlist (HalDevice *device,
1091 g_return_val_if_fail (device != NULL, NULL);
1094 prop = hal_device_property_find (device, key);
1103 hal_device_property_get_strlist_elem (HalDevice *device,
1110 strlist = hal_device_property_get_strlist (device, key);
1122 hal_device_property_strlist_append (HalDevice *device,
1129 prop = hal_device_property_find (device, key);
1137 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1144 device->properties = g_slist_prepend (device->properties, prop);
1146 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1154 hal_device_property_strlist_prepend (HalDevice *device,
1161 prop = hal_device_property_find (device, key);
1169 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1176 device->properties = g_slist_prepend (device->properties, prop);
1178 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1186 hal_device_property_strlist_remove_elem (HalDevice *device,
1193 prop = hal_device_property_find (device, key);
1202 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1211 hal_device_property_strlist_clear (HalDevice *device,
1217 prop = hal_device_property_find (device, key);
1222 device->properties = g_slist_prepend (device->properties, prop);
1224 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1234 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1244 hal_device_property_strlist_add (HalDevice *device,
1254 prop = hal_device_property_find (device, key);
1262 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1270 device->properties = g_slist_prepend (device->properties, prop);
1272 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1283 hal_device_property_strlist_remove (HalDevice *device,
1290 prop = hal_device_property_find (device, key);
1299 g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1307 hal_device_property_strlist_is_empty (HalDevice *device,
1312 if ( hal_device_has_property (device, key)) {
1313 strlist = hal_device_property_get_strlist (device, key);
1326 hal_device_inc_num_addons (HalDevice *device)
1328 device->num_addons++;
1332 hal_device_inc_num_ready_addons (HalDevice *device)
1334 if (hal_device_are_all_addons_ready (device)) {
1336 device->udi));
1340 device->num_addons_ready++;
1345 hal_device_are_all_addons_ready (HalDevice *device)
1347 if (device->num_addons_ready == device->num_addons) {