Hey Tim,

Timothée Ravier [2013-08-29 19:37 +0200]:
> +     /* no valid value found; display a warning the first time for each
> +      * device */
> +     if (devices_already_warned == NULL) {
> +             devices_already_warned = g_hash_table_new(g_str_hash, 
> g_str_equal);
> +     }
> +     if (g_hash_table_lookup(devices_already_warned, native_path) == NULL) {
> +             g_hash_table_insert(devices_already_warned, (gpointer) 
> native_path, (gpointer) 1);
> +             g_warning ("no valid voltage value found for device: %s", 
> native_path);
> +             g_warning ("using 10V as approximation for device: %s", 
> native_path);
> +     }
>       /* completely guess, to avoid getting zero values */
> -     g_warning ("no voltage values for device %s, using 10V as 
> approximation", native_path);
>       voltage = 10.0f;

That idea seems right to me, but I would avoid using a hashtable for
that. Instead, how about adding a new boolean flag to
the UpDeviceSupplyPrivate struct (shown_valid_voltage_warning or so)
and check/flip that?

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
_______________________________________________
devkit-devel mailing list
devkit-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/devkit-devel

Reply via email to