mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 14:39:54 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user