From 1bd36a4d0f7e1e9fdea9c4c991188bc1dc9da421 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Sat, 25 Mar 2017 18:02:06 +0100 Subject: lxrandr: add patch to cope with i.mx 6 segfault Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- ...mprove-xrandr-output-parser-to-cope-with-.patch | 81 ++++++++++++++++++++++ recipes-lxde/lxrandr/lxrandr_0.3.1.bb | 5 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 recipes-lxde/lxrandr/lxrandr/0001-lxrandr.c-improve-xrandr-output-parser-to-cope-with-.patch diff --git a/recipes-lxde/lxrandr/lxrandr/0001-lxrandr.c-improve-xrandr-output-parser-to-cope-with-.patch b/recipes-lxde/lxrandr/lxrandr/0001-lxrandr.c-improve-xrandr-output-parser-to-cope-with-.patch new file mode 100644 index 0000000..04f34a2 --- /dev/null +++ b/recipes-lxde/lxrandr/lxrandr/0001-lxrandr.c-improve-xrandr-output-parser-to-cope-with-.patch @@ -0,0 +1,81 @@ +From 81c49c9cb5180894fee6adab99d4d2e982d2a293 Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Sat, 25 Mar 2017 17:51:53 +0100 +Subject: [PATCH] lxrandr.c: improve xrandr output parser to cope with i.mx 6 + +Prevents segmentation fault on i.MX 6 because the xrandr output can not be +parsed and no monitors are found. + +The Vivante Xdriver reports output names with spaces and multiple numbers, +resolution is given as an unusual string. + +root@colibri-imx6:~# xrandr +Screen 0: minimum 240 x 240, current 1920 x 1080, maximum 8192 x 8192 +DISP3 BG - DI1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm + S:1920x1080p-60 60.00*+ + S:1920x1080p-50 50.00 + U:1680x1050p-60 60.00 + V:1280x1024p-75 75.03 + +vs. + +x86> xrandr +Screen 0: minimum 8 x 8, current 3840 x 1200, maximum 16384 x 16384 +DVI-D-0 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm + 1920x1200 60.0*+ + 1600x1200 60.0 + +Signed-off-by: Max Krummenacher +--- + src/lxrandr.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/lxrandr.c b/src/lxrandr.c +index 33e02b2..b8c266d 100644 +--- a/src/lxrandr.c ++++ b/src/lxrandr.c +@@ -118,8 +118,8 @@ static gboolean get_xrandr_info() + return FALSE; + } + +- regex = g_regex_new( "\n([-a-zA-Z]+[-0-9]*) +connected ([^(\n ]*)[^\n]*" +- "((\n +[0-9]+x[0-9]+[^\n]+)+)", ++ regex = g_regex_new( "\n([ -a-zA-Z0-9]+[-0-9]*) +connected [ a-zA-Z]*([^(\n ]*)[^\n]*" ++ "((\n +[SUV:]*[0-9]+x[0-9]+.*[^\n]+)+)", + 0, 0, NULL ); + if( g_regex_match( regex, output, 0, &match ) ) + { +@@ -343,8 +343,9 @@ static GString* get_command_xrandr_info() + for( l = monitors; l; l = l->next ) + { + Monitor* m = (Monitor*)l->data; +- g_string_append( cmd, " --output " ); ++ g_string_append( cmd, " --output \"" ); + g_string_append( cmd, m->name ); ++ g_string_append( cmd, "\"" ); + + // if the monitor is turned on + if (m->try_mode >= 0) +@@ -403,7 +404,9 @@ static GString* get_command_xrandr_info() + case PLACEMENT_DEFAULT: + g_string_append(cmd, " --same-as "); + } ++ g_string_append(cmd, "\""); + g_string_append(cmd, LVDS->name); ++ g_string_append(cmd, "\""); + } + else if (l != monitors) + { +@@ -426,7 +429,9 @@ static GString* get_command_xrandr_info() + case PLACEMENT_DEFAULT: + g_string_append(cmd, " --same-as "); + } ++ g_string_append(cmd, "\""); + g_string_append(cmd, first->name); ++ g_string_append(cmd, "\""); + } + + /* g_string_append( cmd, "" ); */ +-- +2.6.6 + diff --git a/recipes-lxde/lxrandr/lxrandr_0.3.1.bb b/recipes-lxde/lxrandr/lxrandr_0.3.1.bb index 3522e44..d1ec999 100644 --- a/recipes-lxde/lxrandr/lxrandr_0.3.1.bb +++ b/recipes-lxde/lxrandr/lxrandr_0.3.1.bb @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" DEPENDS = "glib-2.0-native intltool-native virtual/libintl xrandr" -SRC_URI = "${SOURCEFORGE_MIRROR}/lxde/lxrandr-${PV}.tar.xz" +SRC_URI = " \ + ${SOURCEFORGE_MIRROR}/lxde/lxrandr-${PV}.tar.xz \ + file://0001-lxrandr.c-improve-xrandr-output-parser-to-cope-with-.patch \ +" SRC_URI[md5sum] = "b327938f18a4baac85c4707f927d606e" SRC_URI[sha256sum] = "6d98338485a90d9e47f6d08184df77ca0d9715517f8a45a914e861750589184e" -- cgit v1.2.3