Lines Matching refs:a3d
50 struct a3d { struct
109 static void a3d_read(struct a3d *a3d, unsigned char *data) in a3d_read() argument
111 struct input_dev *dev = a3d->dev; in a3d_read()
113 switch (a3d->mode) { in a3d_read()
128 a3d->axes[0] = ((signed char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128; in a3d_read()
129 a3d->axes[1] = ((signed char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128; in a3d_read()
130 a3d->axes[2] = ((signed char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128; in a3d_read()
131 a3d->axes[3] = ((signed char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128; in a3d_read()
133 a3d->buttons = ((data[3] << 3) | data[4]) & 0xf; in a3d_read()
176 struct a3d *a3d = gameport_get_drvdata(gameport); in a3d_poll() local
179 a3d->reads++; in a3d_poll()
180 if (a3d_read_packet(a3d->gameport, a3d->length, data) != a3d->length || in a3d_poll()
181 data[0] != a3d->mode || a3d_csum(data, a3d->length)) in a3d_poll()
182 a3d->bads++; in a3d_poll()
184 a3d_read(a3d, data); in a3d_poll()
195 struct a3d *a3d = gameport->port_data; in a3d_adc_cooked_read() local
199 axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1; in a3d_adc_cooked_read()
200 *buttons = a3d->buttons; in a3d_adc_cooked_read()
211 struct a3d *a3d = gameport->port_data; in a3d_adc_open() local
216 gameport_start_polling(a3d->gameport); in a3d_adc_open()
226 struct a3d *a3d = gameport->port_data; in a3d_adc_close() local
228 gameport_stop_polling(a3d->gameport); in a3d_adc_close()
237 struct a3d *a3d = input_get_drvdata(dev); in a3d_open() local
239 gameport_start_polling(a3d->gameport); in a3d_open()
249 struct a3d *a3d = input_get_drvdata(dev); in a3d_close() local
251 gameport_stop_polling(a3d->gameport); in a3d_close()
260 struct a3d *a3d; in a3d_connect() local
267 a3d = kzalloc(sizeof(struct a3d), GFP_KERNEL); in a3d_connect()
269 if (!a3d || !input_dev) { in a3d_connect()
274 a3d->dev = input_dev; in a3d_connect()
275 a3d->gameport = gameport; in a3d_connect()
277 gameport_set_drvdata(gameport, a3d); in a3d_connect()
290 a3d->mode = data[0]; in a3d_connect()
292 if (!a3d->mode || a3d->mode > 5) { in a3d_connect()
294 "(%s, id=%d), contact <vojtech@ucw.cz>\n", gameport->phys, a3d->mode); in a3d_connect()
302 snprintf(a3d->phys, sizeof(a3d->phys), "%s/input0", gameport->phys); in a3d_connect()
304 input_dev->name = a3d_names[a3d->mode]; in a3d_connect()
305 input_dev->phys = a3d->phys; in a3d_connect()
308 input_dev->id.product = a3d->mode; in a3d_connect()
314 input_set_drvdata(input_dev, a3d); in a3d_connect()
316 if (a3d->mode == A3D_MODE_PXL) { in a3d_connect()
320 a3d->length = 33; in a3d_connect()
336 a3d_read(a3d, data); in a3d_connect()
348 a3d->length = 29; in a3d_connect()
355 a3d_read(a3d, data); in a3d_connect()
357 if (!(a3d->adc = adc = gameport_allocate_port())) in a3d_connect()
360 adc->port_data = a3d; in a3d_connect()
366 gameport_set_name(adc, a3d_names[a3d->mode]); in a3d_connect()
374 err = input_register_device(a3d->dev); in a3d_connect()
380 fail3: if (a3d->adc) in a3d_connect()
381 gameport_unregister_port(a3d->adc); in a3d_connect()
385 kfree(a3d); in a3d_connect()
391 struct a3d *a3d = gameport_get_drvdata(gameport); in a3d_disconnect() local
393 input_unregister_device(a3d->dev); in a3d_disconnect()
394 if (a3d->adc) in a3d_disconnect()
395 gameport_unregister_port(a3d->adc); in a3d_disconnect()
398 kfree(a3d); in a3d_disconnect()