summaryrefslogtreecommitdiff
path: root/sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c
diff options
context:
space:
mode:
authorGuido Falsi <madpilot@FreeBSD.org>2019-05-10 17:40:02 +0000
committerGuido Falsi <madpilot@FreeBSD.org>2019-05-10 17:40:02 +0000
commit5e10f01da8726956a1ea6cf93d915be423158380 (patch)
tree0edb8c22899c00da9a010ed16662fbd3e658ef1a /sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c
parentnet/py-libnet: fix on powerpc64 (diff)
- Fix reported sporadic crashes
- Enumerate all displays for backlight support - Fix some compile warnings - When building debug binaries enable extra debugging code too PR: 237714 Submitted by: rozhuk.im@gmail.com MFH: 2019Q2
Notes
Notes: svn path=/head/; revision=501188
Diffstat (limited to 'sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c')
-rw-r--r--sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c b/sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c
new file mode 100644
index 000000000000..087f2ed85bc1
--- /dev/null
+++ b/sysutils/xfce4-power-manager/files/patch-src_xfpm-backlight-helper.c
@@ -0,0 +1,42 @@
+--- src/xfpm-backlight-helper.c.orig 2017-11-23 23:52:06 UTC
++++ src/xfpm-backlight-helper.c
+@@ -49,6 +49,8 @@
+ #define EXIT_CODE_INVALID_USER 4
+ #define EXIT_CODE_NO_BRIGHTNESS_SWITCH 5
+
++#define MAX_DEVICE_NUM 8
++
+ #if !defined(BACKEND_TYPE_FREEBSD)
+ #define BACKLIGHT_SYSFS_LOCATION "/sys/class/backlight"
+ #define BRIGHTNESS_SWITCH_LOCATION "/sys/module/video/parameters/brightness_switch_enabled"
+@@ -204,19 +206,23 @@ backlight_helper_get_device (void)
+ /* devices in priority order */
+ gchar *types[] = { "lcd", "crt", "out", "ext", "tv", NULL };
+ gchar *device = NULL;
+- gint i;
++ gint i, j;
+
+- device = (gchar *) g_malloc (sizeof (gchar));
++ device = (gchar *) g_malloc (sizeof (gchar) * 8);
+
+ for (i = 0; types[i] != NULL; i++) {
+- g_snprintf (device, (gulong) strlen (types[i]), "%s0", types[i]);
++ for (j = 0; j < MAX_DEVICE_NUM; j++) {
++ g_snprintf (device, 8, "%s%i", types[i], j);
+
+- /* stop, when first device is found */
+- if (acpi_video_is_enabled (device))
+- break;
++ /* stop, when first device is found */
++ if (acpi_video_is_enabled (device))
++ return (device);
++ }
+ }
+
+- return device;
++ g_free (device);
++
++ return (NULL);
+ }
+
+ /*