0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From daecf59cc8b294265666482a4766aaa3148c308b Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Sat, 30 Nov 2019 11:43:32 -0800
  4. Subject: [PATCH] Fix build on 32bit arches with 64bit time_t
  5. time element is deprecated on new input_event structure in kernel's
  6. input.h [1]
  7. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f
  8. [Retrieved from:
  9. https://github.com/LibVNC/x11vnc/commit/daecf59cc8b294265666482a4766aaa3148c308b]
  10. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  11. ---
  12. src/uinput.c | 25 +++++++++++++++++++++----
  13. 1 file changed, 21 insertions(+), 4 deletions(-)
  14. diff --git a/src/uinput.c b/src/uinput.c
  15. index 28fbad3..d71bcde 100644
  16. --- a/src/uinput.c
  17. +++ b/src/uinput.c
  18. @@ -54,6 +54,11 @@ so, delete this exception statement from your version.
  19. #include <linux/input.h>
  20. #include <linux/uinput.h>
  21. +#ifndef input_event_sec
  22. +#define input_event_sec time.tv_sec
  23. +#define input_event_usec time.tv_usec
  24. +#endif
  25. +
  26. #if !defined(EV_SYN) || !defined(SYN_REPORT)
  27. #undef UINPUT_OK
  28. #endif
  29. @@ -710,6 +715,7 @@ void parse_uinput_str(char *in) {
  30. static void ptr_move(int dx, int dy) {
  31. #ifdef UINPUT_OK
  32. struct input_event ev;
  33. + struct timeval tval;
  34. int d = direct_rel_fd < 0 ? fd : direct_rel_fd;
  35. if (injectable && strchr(injectable, 'M') == NULL) {
  36. @@ -720,7 +726,9 @@ static void ptr_move(int dx, int dy) {
  37. if (db) fprintf(stderr, "ptr_move(%d, %d) fd=%d\n", dx, dy, d);
  38. - gettimeofday(&ev.time, NULL);
  39. + gettimeofday(&tval, NULL);
  40. + ev.input_event_sec = tval.tv_sec;
  41. + ev.input_event_usec = tval.tv_usec;
  42. ev.type = EV_REL;
  43. ev.code = REL_Y;
  44. ev.value = dy;
  45. @@ -755,6 +763,7 @@ static void apply_tslib(int *x, int *y) {
  46. static void ptr_abs(int x, int y, int p) {
  47. #ifdef UINPUT_OK
  48. struct input_event ev;
  49. + struct timeval tval;
  50. int x0, y0;
  51. int d = direct_abs_fd < 0 ? fd : direct_abs_fd;
  52. @@ -773,7 +782,9 @@ static void ptr_abs(int x, int y, int p) {
  53. if (db) fprintf(stderr, "ptr_abs(%d, %d => %d %d, p=%d) fd=%d\n", x0, y0, x, y, p, d);
  54. - gettimeofday(&ev.time, NULL);
  55. + gettimeofday(&tval, NULL);
  56. + ev.input_event_sec = tval.tv_sec;
  57. + ev.input_event_usec = tval.tv_usec;
  58. ev.type = EV_ABS;
  59. ev.code = ABS_Y;
  60. ev.value = y;
  61. @@ -950,6 +961,7 @@ if (0) {usleep(100*1000) ;}
  62. static void button_click(int down, int btn) {
  63. #ifdef UINPUT_OK
  64. struct input_event ev;
  65. + struct timeval tval;
  66. int d = direct_btn_fd < 0 ? fd : direct_btn_fd;
  67. if (injectable && strchr(injectable, 'B') == NULL) {
  68. @@ -959,7 +971,9 @@ static void button_click(int down, int btn) {
  69. if (db) fprintf(stderr, "button_click: btn %d %s fd=%d\n", btn, down ? "down" : "up", d);
  70. memset(&ev, 0, sizeof(ev));
  71. - gettimeofday(&ev.time, NULL);
  72. + gettimeofday(&tval, NULL);
  73. + ev.input_event_sec = tval.tv_sec;
  74. + ev.input_event_usec = tval.tv_usec;
  75. ev.type = EV_KEY;
  76. ev.value = down;
  77. @@ -1230,6 +1244,7 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
  78. void uinput_key_command(int down, int keysym, rfbClientPtr client) {
  79. #ifdef UINPUT_OK
  80. struct input_event ev;
  81. + struct timeval tval;
  82. int scancode;
  83. allowed_input_t input;
  84. int d = direct_key_fd < 0 ? fd : direct_key_fd;
  85. @@ -1253,7 +1268,9 @@ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
  86. if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s fd=%d\n", keysym, scancode, down ? "down" : "up", d);
  87. memset(&ev, 0, sizeof(ev));
  88. - gettimeofday(&ev.time, NULL);
  89. + gettimeofday(&tval, NULL);
  90. + ev.input_event_sec = tval.tv_sec;
  91. + ev.input_event_usec = tval.tv_usec;
  92. ev.type = EV_KEY;
  93. ev.code = (unsigned char) scancode;
  94. ev.value = down;