aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-10-18 22:38:27 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2016-10-26 10:28:38 +0200
commit2449866d8293311060f15f5e9ec9c020e1a83ce6 (patch)
treeb6605f63d5a08cc0d57b9b7c0598d8871099a423 /meta-oe/recipes-support
parent09ac7a66285be1a19371099e83a3deb04960070d (diff)
downloadmeta-openembedded-contrib-2449866d8293311060f15f5e9ec9c020e1a83ce6.tar.gz
meta-openembedded-contrib-2449866d8293311060f15f5e9ec9c020e1a83ce6.tar.bz2
meta-openembedded-contrib-2449866d8293311060f15f5e9ec9c020e1a83ce6.zip
gpm: Remove nested functions
Helps compiling with clang which doesnt support nested functions Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch326
-rw-r--r--meta-oe/recipes-support/gpm/gpm_1.99.7.bb1
2 files changed, 327 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch b/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch
new file mode 100644
index 0000000000..d2d6cb8a8c
--- /dev/null
+++ b/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch
@@ -0,0 +1,326 @@
+Remove nested functions, they are not available in all compilers
+e.g. clang will not support them.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gpm-1.99.7/src/drivers/summa/i.c
+===================================================================
+--- gpm-1.99.7.orig/src/drivers/summa/i.c
++++ gpm-1.99.7/src/drivers/summa/i.c
+@@ -36,6 +36,28 @@ extern int summamaxy;
+
+ extern signed char summaid;
+
++static void resetsumma(int fd)
++{
++ write(fd, 0, 1); /* Reset */
++ usleep(400000); /* wait */
++}
++
++static int waitsumma(int fd)
++{
++ struct timeval timeout;
++
++ fd_set readfds;
++
++ int err;
++
++ FD_ZERO(&readfds);
++ FD_SET(fd, &readfds);
++ timeout.tv_sec = 0;
++ timeout.tv_usec = 200000;
++ err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
++ return (err);
++}
++
+ Gpm_Type *I_summa(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
+ char **argv)
+ {
+@@ -43,24 +65,6 @@ Gpm_Type *I_summa(int fd, unsigned short
+ flags = argc = 0; /* FIXME: 1.99.13 */
+ argv = NULL;
+
+- void resetsumma() {
+- write(fd, 0, 1); /* Reset */
+- usleep(400000); /* wait */
+- }
+- int waitsumma() {
+- struct timeval timeout;
+-
+- fd_set readfds;
+-
+- int err;
+-
+- FD_ZERO(&readfds);
+- FD_SET(fd, &readfds);
+- timeout.tv_sec = 0;
+- timeout.tv_usec = 200000;
+- err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+- return (err);
+- }
+ int err;
+
+ char buffer[255];
+@@ -91,7 +95,7 @@ Gpm_Type *I_summa(int fd, unsigned short
+ */
+ setspeed(fd, 1200, 9600, 1,
+ B9600 | CS8 | CREAD | CLOCAL | HUPCL | PARENB | PARODD);
+- resetsumma();
++ resetsumma(fd);
+
+ write(fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE));
+
+@@ -103,7 +107,7 @@ Gpm_Type *I_summa(int fd, unsigned short
+ * read the Summa Firm-ID
+ */
+ write(fd, SS_FIRMID, strlen(SS_FIRMID));
+- err = waitsumma();
++ err = waitsumma(fd);
+ if(!((err == -1) || (!err))) {
+ summaid = 10; /* Original Summagraphics */
+ read(fd, buffer, 255); /* Read Firm-ID */
+@@ -111,14 +115,14 @@ Gpm_Type *I_summa(int fd, unsigned short
+ }
+
+ if(summaid < 0) { /* Genius-test */
+- resetsumma();
++ resetsumma(fd);
+ write(fd, GEN_MMSERIES, 1);
+ write(fd, &GEN_MODELL, 1); /* Read modell */
+- err = waitsumma();
++ err = waitsumma(fd);
+ if(!((err == -1) || (!err))) { /* read Genius-ID */
+- err = waitsumma();
++ err = waitsumma(fd);
+ if(!((err == -1) || (!err))) {
+- err = waitsumma();
++ err = waitsumma(fd);
+ if(!((err == -1) || (!err))) {
+ read(fd, &config, 1);
+ summaid = (config[0] & 224) >> 5; /* genius tablet-id
+@@ -135,14 +139,14 @@ Gpm_Type *I_summa(int fd, unsigned short
+ * unknown tablet ?
+ */
+ if((summaid < 0) || (summaid == 11)) {
+- resetsumma();
++ resetsumma(fd);
+ write(fd, SS_BINARY_FMT SS_PROMPT_MODE, 3);
+ }
+
+ /*
+ * read tablet size
+ */
+- err = waitsumma();
++ err = waitsumma(fd);
+ if(!((err == -1) || (!err)))
+ read(fd, buffer, sizeof(buffer));
+ write(fd, SS_READCONFIG, 1);
+Index: gpm-1.99.7/src/drivers/wacom/i.c
+===================================================================
+--- gpm-1.99.7.orig/src/drivers/wacom/i.c
++++ gpm-1.99.7/src/drivers/wacom/i.c
+@@ -30,10 +30,6 @@
+ #include "message.h" /* gpm_report */
+ #include "wacom.h" /* wacom */
+
+-Gpm_Type *I_wacom(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
+- char **argv)
+-{
+-
+ /* wacom graphire tablet */
+ #define UD_RESETBAUD "\r$" /* reset baud rate to default (wacom V) */
+ /*
+@@ -45,83 +41,91 @@ Gpm_Type *I_wacom(int fd, unsigned short
+ #define UD_COORD "~C\r" /* Request max coordinates */
+ #define UD_STOP "\nSP\r" /* stop sending coordinates */
+
+- flags = 0; /* FIXME: 1.99.13 */
+
+- void reset_wacom() {
+- /*
+- * Init Wacom communication; this is modified from xf86Wacom.so module
+- */
+- /*
+- * Set speed to 19200
+- */
+- setspeed(fd, 1200, 19200, 0, B19200 | CS8 | CREAD | CLOCAL | HUPCL);
+- /*
+- * Send Reset Baudrate Command
+- */
+- write(fd, UD_RESETBAUD, strlen(UD_RESETBAUD));
+- usleep(250000);
+- /*
+- * Send Reset Command
+- */
+- write(fd, UD_RESET, strlen(UD_RESET));
+- usleep(75000);
+- /*
+- * Set speed to 9600bps
+- */
+- setspeed(fd, 1200, 9600, 0, B9600 | CS8 | CREAD | CLOCAL | HUPCL);
+- /*
+- * Send Reset Command
+- */
+- write(fd, UD_RESET, strlen(UD_RESET));
+- usleep(250000);
+- write(fd, UD_STOP, strlen(UD_STOP));
+- usleep(100000);
+- }
++static void reset_wacom(int fd)
++{
++ /*
++ * Init Wacom communication; this is modified from xf86Wacom.so module
++ */
++ /*
++ * Set speed to 19200
++ */
++ setspeed(fd, 1200, 19200, 0, B19200 | CS8 | CREAD | CLOCAL | HUPCL);
++ /*
++ * Send Reset Baudrate Command
++ */
++ write(fd, UD_RESETBAUD, strlen(UD_RESETBAUD));
++ usleep(250000);
++ /*
++ * Send Reset Command
++ */
++ write(fd, UD_RESET, strlen(UD_RESET));
++ usleep(75000);
++ /*
++ * Set speed to 9600bps
++ */
++ setspeed(fd, 1200, 9600, 0, B9600 | CS8 | CREAD | CLOCAL | HUPCL);
++ /*
++ * Send Reset Command
++ */
++ write(fd, UD_RESET, strlen(UD_RESET));
++ usleep(250000);
++ write(fd, UD_STOP, strlen(UD_STOP));
++ usleep(100000);
++}
+
+- int wait_wacom() {
+- /*
+- * Wait up to 200 ms for Data from Tablet.
+- * Do not read that data.
+- * Give back 0 on timeout condition, -1 on error and 1 for DataPresent
+- */
+- struct timeval timeout;
+-
+- fd_set readfds;
+-
+- int err;
+-
+- FD_ZERO(&readfds);
+- FD_SET(fd, &readfds);
+- timeout.tv_sec = 0;
+- timeout.tv_usec = 200000;
+- err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+- return ((err > 0) ? 1 : err);
+- }
++static int wait_wacom(int fd)
++{
++ /*
++ * Wait up to 200 ms for Data from Tablet.
++ * Do not read that data.
++ * Give back 0 on timeout condition, -1 on error and 1 for DataPresent
++ */
++ struct timeval timeout;
+
+- char buffer[50], *p;
++ fd_set readfds;
+
+- int RequestData(char *cmd) {
+- int err;
++ int err;
+
+- /*
+- * Send cmd if not null, and get back answer from tablet.
+- * Get Data to buffer until full or timeout.
+- * Give back 0 for timeout and !0 for buffer full
+- */
+- if(cmd)
+- write(fd, cmd, strlen(cmd));
+- memset(buffer, 0, sizeof(buffer));
+- p = buffer;
+- err = wait_wacom();
+- while(err != -1 && err && (p - buffer) < (int) (sizeof(buffer) - 1)) {
+- p += read(fd, p, (sizeof(buffer) - 1) - (p - buffer));
+- err = wait_wacom();
+- }
+- /*
+- * return 1 for buffer full
+- */
+- return ((strlen(buffer) >= (sizeof(buffer) - 1)) ? !0 : 0);
++ FD_ZERO(&readfds);
++ FD_SET(fd, &readfds);
++ timeout.tv_sec = 0;
++ timeout.tv_usec = 200000;
++ err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
++ return ((err > 0) ? 1 : err);
++}
++
++static int RequestData(int fd, char *cmd, char *buffer)
++{
++ int err;
++ char *p;
++ /*
++ * Send cmd if not null, and get back answer from tablet.
++ * Get Data to buffer until full or timeout.
++ * Give back 0 for timeout and !0 for buffer full
++ */
++ if(cmd)
++ write(fd, cmd, strlen(cmd));
++ memset(buffer, 0, sizeof(buffer));
++ p = buffer;
++ err = wait_wacom(fd);
++ while(err != -1 && err && (p - buffer) < (int) (sizeof(buffer) - 1)) {
++ p += read(fd, p, (sizeof(buffer) - 1) - (p - buffer));
++ err = wait_wacom(fd);
+ }
++ /*
++ * return 1 for buffer full
++ */
++ return ((strlen(buffer) >= (sizeof(buffer) - 1)) ? !0 : 0);
++}
++
++Gpm_Type *I_wacom(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
++ char **argv)
++{
++
++ flags = 0; /* FIXME: 1.99.13 */
++
++ char buffer[50];
+
+ /*
+ * We do both modes, relative and absolute, with the same function.
+@@ -143,17 +147,17 @@ Gpm_Type *I_wacom(int fd, unsigned short
+ };
+ parse_argv(optioninfo, argc, argv);
+ type->absolute = WacomAbsoluteWanted;
+- reset_wacom();
++ reset_wacom(fd);
+
+ /*
+ * "Flush" input queque
+ */
+- while(RequestData(NULL)) ;
++ while(RequestData(fd, NULL, buffer)) ;
+
+ /*
+ * read WACOM-ID
+ */
+- RequestData(UD_FIRMID);
++ RequestData(fd, UD_FIRMID, buffer);
+
+ /*
+ * Search for matching modell
+@@ -180,7 +184,7 @@ Gpm_Type *I_wacom(int fd, unsigned short
+ * read Wacom max size
+ */
+ if(WacomModell != (-1) && (!wcmodell[WacomModell].maxX)) {
+- RequestData(UD_COORD);
++ RequestData(fd, UD_COORD, buffer);
+ sscanf(buffer + 2, "%d,%d", &wmaxx, &wmaxy);
+ wmaxx = (wmaxx - wcmodell[WacomModell].border);
+ wmaxy = (wmaxy - wcmodell[WacomModell].border);
diff --git a/meta-oe/recipes-support/gpm/gpm_1.99.7.bb b/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
index 7022057d4a..bbb8c28ac6 100644
--- a/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
+++ b/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
@@ -13,6 +13,7 @@ SRC_URI = "ftp://arcana.linux.it/pub/gpm/gpm-${PV}.tar.bz2 \
file://no-docs.patch \
file://processcreds.patch \
file://eglibc-2.17.patch \
+ file://remove_nested_functions.patch \
file://init"
inherit autotools-brokensep update-rc.d