Lines Matching refs:gf2k
81 struct gf2k { struct
175 static void gf2k_read(struct gf2k *gf2k, unsigned char *data) in gf2k_read() argument
177 struct input_dev *dev = gf2k->dev; in gf2k_read()
180 for (i = 0; i < 4 && i < gf2k_axes[gf2k->id]; i++) in gf2k_read()
183 for (i = 0; i < 2 && i < gf2k_axes[gf2k->id] - 4; i++) in gf2k_read()
188 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_read()
193 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_read()
196 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_read()
208 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_poll() local
211 gf2k->reads++; in gf2k_poll()
213 if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id]) in gf2k_poll()
214 gf2k->bads++; in gf2k_poll()
216 gf2k_read(gf2k, data); in gf2k_poll()
221 struct gf2k *gf2k = input_get_drvdata(dev); in gf2k_open() local
223 gameport_start_polling(gf2k->gameport); in gf2k_open()
229 struct gf2k *gf2k = input_get_drvdata(dev); in gf2k_close() local
231 gameport_stop_polling(gf2k->gameport); in gf2k_close()
240 struct gf2k *gf2k; in gf2k_connect() local
245 gf2k = kzalloc(sizeof(struct gf2k), GFP_KERNEL); in gf2k_connect()
247 if (!gf2k || !input_dev) { in gf2k_connect()
252 gf2k->gameport = gameport; in gf2k_connect()
253 gf2k->dev = input_dev; in gf2k_connect()
255 gameport_set_drvdata(gameport, gf2k); in gf2k_connect()
274 if (!(gf2k->id = GB(7,2,0) | GB(3,3,2) | GB(0,3,5))) { in gf2k_connect()
280 if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) && in gf2k_connect()
281 (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) { in gf2k_connect()
286 gf2k->id = 6; in gf2k_connect()
289 if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) { in gf2k_connect()
291 gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]); in gf2k_connect()
299 snprintf(gf2k->phys, sizeof(gf2k->phys), "%s/input0", gameport->phys); in gf2k_connect()
301 gf2k->length = gf2k_lens[gf2k->id]; in gf2k_connect()
303 input_dev->name = gf2k_names[gf2k->id]; in gf2k_connect()
304 input_dev->phys = gf2k->phys; in gf2k_connect()
307 input_dev->id.product = gf2k->id; in gf2k_connect()
311 input_set_drvdata(input_dev, gf2k); in gf2k_connect()
318 for (i = 0; i < gf2k_axes[gf2k->id]; i++) in gf2k_connect()
321 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_connect()
324 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_connect()
327 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_connect()
330 gf2k_read_packet(gameport, gf2k->length, data); in gf2k_connect()
331 gf2k_read(gf2k, data); in gf2k_connect()
333 for (i = 0; i < gf2k_axes[gf2k->id]; i++) { in gf2k_connect()
344 err = input_register_device(gf2k->dev); in gf2k_connect()
353 kfree(gf2k); in gf2k_connect()
359 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_disconnect() local
361 input_unregister_device(gf2k->dev); in gf2k_disconnect()
364 kfree(gf2k); in gf2k_disconnect()