Lines Matching refs:data
72 static int a3d_read_packet(struct gameport *gameport, int length, char *data)
91 data[i++] = v >> 5;
105 static int a3d_csum(char *data, int count)
110 csum += data[i];
111 return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]);
114 static void a3d_read(struct a3d *a3d, unsigned char *data)
124 input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7));
125 input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7));
127 input_report_key(dev, BTN_RIGHT, data[2] & 1);
128 input_report_key(dev, BTN_LEFT, data[3] & 2);
129 input_report_key(dev, BTN_MIDDLE, data[3] & 4);
133 a3d->axes[0] = ((signed char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
134 a3d->axes[1] = ((signed char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
135 a3d->axes[2] = ((signed char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
136 a3d->axes[3] = ((signed char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128;
138 a3d->buttons = ((data[3] << 3) | data[4]) & 0xf;
144 input_report_rel(dev, REL_X, ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7));
145 input_report_rel(dev, REL_Y, ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7));
147 input_report_key(dev, BTN_RIGHT, data[2] & 1);
148 input_report_key(dev, BTN_LEFT, data[3] & 2);
149 input_report_key(dev, BTN_MIDDLE, data[3] & 4);
150 input_report_key(dev, BTN_SIDE, data[7] & 2);
151 input_report_key(dev, BTN_EXTRA, data[7] & 4);
153 input_report_abs(dev, ABS_X, ((signed char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128);
154 input_report_abs(dev, ABS_Y, ((signed char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128);
155 input_report_abs(dev, ABS_RUDDER, ((signed char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128);
156 input_report_abs(dev, ABS_THROTTLE, ((signed char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128);
158 input_report_abs(dev, ABS_HAT0X, ( data[5] & 1) - ((data[5] >> 2) & 1));
159 input_report_abs(dev, ABS_HAT0Y, ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1));
160 input_report_abs(dev, ABS_HAT1X, ((data[4] >> 1) & 1) - ( data[3] & 1));
161 input_report_abs(dev, ABS_HAT1Y, ((data[4] >> 2) & 1) - ( data[4] & 1));
163 input_report_key(dev, BTN_TRIGGER, data[8] & 1);
164 input_report_key(dev, BTN_THUMB, data[8] & 2);
165 input_report_key(dev, BTN_TOP, data[8] & 4);
166 input_report_key(dev, BTN_PINKIE, data[7] & 1);
176 * a3d_poll() reads and analyzes A3D joystick data.
182 unsigned char data[A3D_MAX_LENGTH];
185 if (a3d_read_packet(a3d->gameport, a3d->length, data) != a3d->length ||
186 data[0] != a3d->mode || a3d_csum(data, a3d->length))
189 a3d_read(a3d, data);
193 * a3d_adc_cooked_read() copies the acis and button data to the
211 * any but cooked data.
268 unsigned char data[A3D_MAX_LENGTH];
288 i = a3d_read_packet(gameport, A3D_MAX_LENGTH, data);
290 if (!i || a3d_csum(data, i)) {
295 a3d->mode = data[0];
341 a3d_read(a3d, data);
360 a3d_read(a3d, data);