Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 726574 Details for
Bug 802552
sys-power/upower-0.99.12: does not recognize laptop battery
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
diff libgudev 234 vs 236
libgudev236.patch (text/plain), 3.90 KB, created by
Maxim Britov
on 2021-07-24 18:28:21 UTC
(
hide
)
Description:
diff libgudev 234 vs 236
Filename:
MIME Type:
Creator:
Maxim Britov
Created:
2021-07-24 18:28:21 UTC
Size:
3.90 KB
patch
obsolete
>diff -Naur libgudev-234/gudev/gudevdevice.c libgudev-234-1/gudev/gudevdevice.c >--- libgudev-234/gudev/gudevdevice.c 2020-09-15 16:34:57.759586133 +0300 >+++ libgudev-234-1/gudev/gudevdevice.c 2021-03-16 15:29:29.996178900 +0300 >@@ -896,6 +896,17 @@ > return result; > } > >+static char * >+truncate_at_linefeed (const char *value) >+{ >+ const char *p; >+ >+ p = strchr (value, '\n'); >+ if (!p) >+ return NULL; >+ return g_strndup (value, p - value); >+} >+ > /** > * g_udev_device_get_sysfs_attr_as_boolean: > * @device: A #GUdevDevice. >@@ -903,7 +914,7 @@ > * > * Look up the sysfs attribute with @name on @device and convert it to an > * boolean. This is done by doing a case-insensitive string comparison >- * on the string value against "1" and "true". The retrieved value is >+ * on the string value against "1", "true", "Y" and "y". The retrieved value is > * cached in the device. Repeated calls will return the same value and > * not open the attribute again, unless updated through one of the > * "uncached" functions. >@@ -916,18 +927,26 @@ > const gchar *name) > { > gboolean result; >- const gchar *s; >+ const gchar *raw; >+ g_autofree char *truncated = NULL; >+ const char *s; > > g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); > g_return_val_if_fail (name != NULL, FALSE); > > result = FALSE; >- s = g_udev_device_get_sysfs_attr (device, name); >- if (s == NULL) >+ raw = g_udev_device_get_sysfs_attr (device, name); >+ if (raw == NULL) > goto out; > >- if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) >+ truncated = truncate_at_linefeed (raw); >+ s = truncated ?: raw; >+ if (strcmp (s, "1") == 0 || >+ g_ascii_strcasecmp (s, "true") == 0 || >+ g_ascii_strcasecmp (s, "y") == 0) { > result = TRUE; >+ } >+ > out: > return result; > } >@@ -1141,7 +1160,7 @@ > * > * Look up the sysfs attribute with @name on @device and convert it to an > * boolean. This is done by doing a case-insensitive string comparison >- * on the string value against "1" and "true". This function does >+ * on the string value against "1", "true", "Y" and "y". This function does > * blocking I/O, and updates the sysfs attributes cache. > * > * Returns: The value of the sysfs attribute or %FALSE if there is no such >@@ -1152,18 +1171,26 @@ > const gchar *name) > { > gboolean result; >- const gchar *s; >+ const gchar *raw; >+ g_autofree char *truncated = NULL; >+ const char *s; > > g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); > g_return_val_if_fail (name != NULL, FALSE); > > result = FALSE; >- s = g_udev_device_get_sysfs_attr_uncached (device, name); >- if (s == NULL) >+ raw = g_udev_device_get_sysfs_attr_uncached (device, name); >+ if (raw == NULL) > goto out; > >- if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) >+ truncated = truncate_at_linefeed (raw); >+ s = truncated ?: raw; >+ if (strcmp (s, "1") == 0 || >+ g_ascii_strcasecmp (s, "true") == 0 || >+ g_ascii_strcasecmp (s, "y") == 0) { > result = TRUE; >+ } >+ > out: > return result; > } >diff -Naur libgudev-234/gudev/gudevenumtypes.h libgudev-234-1/gudev/gudevenumtypes.h >--- libgudev-234/gudev/gudevenumtypes.h 2020-09-14 18:01:38.774127699 +0300 >+++ libgudev-234-1/gudev/gudevenumtypes.h 1970-01-01 03:00:00.000000000 +0300 >@@ -1,19 +0,0 @@ >- >-/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ >- >-#ifndef __GUDEV_ENUM_TYPES_H__ >-#define __GUDEV_ENUM_TYPES_H__ >- >-#include <glib-object.h> >- >-G_BEGIN_DECLS >- >-/* enumerations from "/home/hadess/Projects/jhbuild/libgudev/gudev/gudevenums.h" */ >-GType g_udev_device_type_get_type (void) G_GNUC_CONST; >-#define G_TYPE_UDEV_DEVICE_TYPE (g_udev_device_type_get_type ()) >-G_END_DECLS >- >-#endif /* __GUDEV_ENUM_TYPES_H__ */ >- >-/* Generated data ends here */ >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 802552
: 726574