Lines Matching refs:hal_ctx

71 int dump_devices(LibHalContext *hal_ctx, char *arg);
72 int remove_udi(LibHalContext *hal_ctx, char *arg);
73 int add_udi(LibHalContext *hal_ctx, char *arg);
74 void process_property(LibHalContext *hal_ctx, char *buf, lh_prop_t **prop);
75 int add_properties(LibHalContext *hal_ctx, new_dev_t *nd, lh_prop_t *prop);
104 LibHalContext *hal_ctx; in main() local
140 if (!(hal_ctx = libhal_ctx_new())) return 3; in main()
141 if (!libhal_ctx_set_dbus_connection(hal_ctx, conn)) return 4; in main()
142 if (!libhal_ctx_init(hal_ctx, &error)) { in main()
154 err = dump_devices(hal_ctx, argv[optind]); in main()
156 err = remove_udi(hal_ctx, opt.udi); in main()
158 err = add_udi(hal_ctx, opt.udi); in main()
162 libhal_ctx_shutdown(hal_ctx, &error); in main()
163 libhal_ctx_free(hal_ctx); in main()
188 int dump_devices(LibHalContext *hal_ctx, char *arg) in dump_devices() argument
213 if (!(device_names = libhal_get_all_devices(hal_ctx, &num_devices, &error))) { in dump_devices()
229 if (!(props = libhal_device_get_all_properties(hal_ctx, device_names[i], &error))) { in dump_devices()
304 int remove_udi(LibHalContext *hal_ctx, char *arg) in remove_udi() argument
326 if (!libhal_remove_device(hal_ctx, udi, &error)) { in remove_udi()
340 int add_udi(LibHalContext *hal_ctx, char *arg) in add_udi() argument
368 dev_exists = libhal_device_exists(hal_ctx, udi, &error); in add_udi()
373 new_dev.real_udi = libhal_new_device(hal_ctx, &error); in add_udi()
389 process_property(hal_ctx, buf, &prop); in add_udi()
392 err = add_properties(hal_ctx, &new_dev, prop); in add_udi()
397 if (!libhal_device_commit_to_gdl(hal_ctx, new_dev.real_udi, new_dev.udi, &error)) { in add_udi()
447 void process_property(LibHalContext *hal_ctx, char *buf, lh_prop_t **prop) in process_property() argument
545 int add_properties(LibHalContext *hal_ctx, new_dev_t *nd, lh_prop_t *prop) in add_properties() argument
560 old_type = libhal_device_get_property_type(hal_ctx, nd->real_udi, p->key, &error); in add_properties()
565 if (!libhal_device_remove_property(hal_ctx, nd->real_udi, p->key, &error)) { in add_properties()
574 if (!libhal_device_set_property_bool(hal_ctx, nd->real_udi, p->key, p->v.bool_value, &error)) { in add_properties()
581 if (!libhal_device_set_property_int(hal_ctx, nd->real_udi, p->key, p->v.int_value, &error)) { in add_properties()
588 …if (!libhal_device_set_property_uint64(hal_ctx, nd->real_udi, p->key, p->v.uint64_value, &error)) { in add_properties()
595 …if (!libhal_device_set_property_double(hal_ctx, nd->real_udi, p->key, p->v.double_value, &error)) { in add_properties()
603 if (!libhal_device_set_property_string(hal_ctx, nd->real_udi, p->key, p->v.str_value, &error)) { in add_properties()
611 if (!libhal_device_property_strlist_append(hal_ctx, nd->real_udi, p->key, *s, &error)) { in add_properties()