The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / x11r7 / xdriver_xf86-input-tslib / 0002-port-abi-12.patch
1 Fetch from: https://launchpad.net/ubuntu/+archive/primary/+files/xf86-input-tslib_0.0.6-7build3.debian.tar.gz
2 Fixes build against newer versions of xorg.
3
4 Signed-off-by: Jesper Baekdahl <jbb@gamblify.com>
5 ---
6 Index: xf86-input-tslib-trunk/src/tslib.c
7 ===================================================================
8 --- xf86-input-tslib-trunk/src/tslib.c  (revision 48)
9 +++ xf86-input-tslib-trunk/src/tslib.c  (working copy)
10 @@ -69,6 +69,13 @@
11  #define DEFAULT_HEIGHT         240
12  #define DEFAULT_WIDTH          320
13  
14 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
15 +#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options), NULL)
16 +#else
17 +#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options))
18 +#endif
19 +
20 +
21  enum { TSLIB_ROTATE_NONE=0, TSLIB_ROTATE_CW=270, TSLIB_ROTATE_UD=180, TSLIB_ROTATE_CCW=90 };
22  
23  enum button_state { BUTTON_NOT_PRESSED = 0, BUTTON_1_PRESSED = 1, BUTTON_3_CLICK = 3, BUTTON_3_CLICKED=4, BUTTON_EMULATION_OFF=-1 };
24 @@ -106,7 +113,7 @@
25  }
26  
27  static Bool
28 -ConvertProc( LocalDevicePtr local,
29 +ConvertProc( InputInfoPtr local,
30                          int first,
31                          int num,
32                          int v0,
33 @@ -135,7 +142,7 @@
34      return t;
35  }
36  
37 -static void ReadInput (LocalDevicePtr local)
38 +static void ReadInput (InputInfoPtr local)
39  {
40         struct ts_priv *priv = (struct ts_priv *) (local->private);
41         struct ts_sample samp;
42 @@ -382,7 +389,11 @@
43                                                axiswidth - 1,   /* max val */
44                                                axiswidth,       /* resolution */
45                                                0,               /* min_res */
46 -                                              axiswidth);      /* max_res */
47 +                                              axiswidth        /* max_res */
48 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
49 +                                              ,Absolute
50 +#endif
51 +                                              );
52  
53                 InitValuatorAxisStruct(device, 1,
54  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
55 @@ -392,7 +403,11 @@
56                                                axisheight - 1,  /* max val */
57                                                axisheight,      /* resolution */
58                                                0,               /* min_res */
59 -                                              axisheight);     /* max_res */
60 +                                              axisheight       /* max_res */
61 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
62 +                                              ,Absolute
63 +#endif
64 +                                              );
65  
66                 if (InitProximityClassDeviceStruct (device) == FALSE) {
67                         ErrorF ("Unable to allocate EVTouch touchscreen ProximityClassDeviceStruct\n");
68 @@ -434,7 +449,7 @@
69         ErrorF("%s\n", __FUNCTION__);
70         xf86TslibControlProc(pInfo->dev, DEVICE_OFF);
71         ts_close(priv->ts);
72 -       xfree(pInfo->private);
73 +       free(pInfo->private);
74         pInfo->private = NULL;
75         xf86DeleteInput(pInfo, 0);
76  }
77 @@ -444,47 +459,57 @@
78   *
79   * called when the module subsection is found in XF86Config
80   */
81 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
82 +static int 
83 +xf86TslibInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
84 +#else
85  static InputInfoPtr
86  xf86TslibInit(InputDriverPtr drv, IDevPtr dev, int flags)
87 +#endif
88  {
89         struct ts_priv *priv;
90         char *s;
91 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
92         InputInfoPtr pInfo;
93 +#endif
94  
95 -       priv = xcalloc (1, sizeof (struct ts_priv));
96 +       priv = calloc (1, sizeof (struct ts_priv));
97          if (!priv)
98 -                return NULL;
99 +                return BadValue;
100  
101 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
102         if (!(pInfo = xf86AllocateInput(drv, 0))) {
103 -               xfree(priv);
104 -               return NULL;
105 +               free(priv);
106 +               return BadValue;
107         }
108  
109         /* Initialise the InputInfoRec. */
110         pInfo->name = dev->identifier;
111 -       pInfo->type_name = XI_TOUCHSCREEN;
112         pInfo->flags =
113             XI86_KEYBOARD_CAPABLE | XI86_POINTER_CAPABLE |
114             XI86_SEND_DRAG_EVENTS;
115 -       pInfo->device_control = xf86TslibControlProc;
116 -       pInfo->read_input = ReadInput;
117  #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
118         pInfo->motion_history_proc = xf86GetMotionEvents;
119         pInfo->history_size = 0;
120  #endif
121 -       pInfo->control_proc = NULL;
122 +       pInfo->conf_idev = dev;
123         pInfo->close_proc = NULL;
124 -       pInfo->switch_mode = NULL;
125         pInfo->conversion_proc = ConvertProc;
126         pInfo->reverse_conversion_proc = NULL;
127 -       pInfo->dev = NULL;
128         pInfo->private_flags = 0;
129         pInfo->always_core_feedback = 0;
130 -       pInfo->conf_idev = dev;
131 +#endif
132 +
133 +       pInfo->type_name = XI_TOUCHSCREEN;
134 +       pInfo->control_proc = NULL;
135 +       pInfo->read_input = ReadInput;
136 +       pInfo->device_control = xf86TslibControlProc;
137 +       pInfo->switch_mode = NULL;
138         pInfo->private = priv;
139 +       pInfo->dev = NULL;
140  
141         /* Collect the options, and process the common options. */
142 -       xf86CollectInputOptions(pInfo, NULL, NULL);
143 +       COLLECT_INPUT_OPTIONS(pInfo, NULL);
144         xf86ProcessCommonOptions(pInfo, pInfo->options);
145  
146         priv->screen_num = xf86SetIntOption(pInfo->options, "ScreenNumber", 0 );
147 @@ -510,23 +535,31 @@
148                 priv->rotate = TSLIB_ROTATE_NONE;
149         }
150  
151 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
152         s = xf86CheckStrOption(dev->commonOptions, "path", NULL);
153 +#else
154 +       s = xf86CheckStrOption(pInfo->options, "path", NULL);
155 +#endif
156         if (!s)
157 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
158                 s = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
159 +#else
160 +               s = xf86CheckStrOption(pInfo->options, "Device", NULL);
161 +#endif
162   
163         priv->ts = ts_open(s, 1);
164 -       xfree(s);
165 +       free(s);
166  
167         if (!priv->ts) {
168                 ErrorF("ts_open failed (device=%s)\n",s);
169                 xf86DeleteInput(pInfo, 0);
170 -               return NULL;
171 +               return BadValue;
172         }
173  
174         if (ts_config(priv->ts)) {
175                 ErrorF("ts_config failed\n");
176                 xf86DeleteInput(pInfo, 0);
177 -               return NULL;
178 +               return BadValue;
179         }
180  
181         pInfo->fd = ts_fd(priv->ts);
182 @@ -536,11 +569,13 @@
183                 priv->state = BUTTON_EMULATION_OFF;
184         }
185  
186 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
187         /* Mark the device configured */
188         pInfo->flags |= XI86_CONFIGURED;
189 +#endif
190  
191         /* Return the configured device */
192 -       return (pInfo);
193 +       return Success;
194  }
195  
196  _X_EXPORT InputDriverRec TSLIB = {