grip_mp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*
  2. * $Id: grip_mp.c,v 1.9 2002/07/20 19:28:45 bonnland Exp $
  3. *
  4. * Driver for the Gravis Grip Multiport, a gamepad "hub" that
  5. * connects up to four 9-pin digital gamepads/joysticks.
  6. * Driver tested on SMP and UP kernel versions 2.4.18-4 and 2.4.18-5.
  7. *
  8. * Thanks to Chris Gassib for helpful advice.
  9. *
  10. * Copyright (c) 2002 Brian Bonnlander, Bill Soudan
  11. * Copyright (c) 1998-2000 Vojtech Pavlik
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/slab.h>
  17. #include <linux/gameport.h>
  18. #include <linux/input.h>
  19. #include <linux/delay.h>
  20. #include <linux/proc_fs.h>
  21. #define DRIVER_DESC "Gravis Grip Multiport driver"
  22. MODULE_AUTHOR("Brian Bonnlander");
  23. MODULE_DESCRIPTION(DRIVER_DESC);
  24. MODULE_LICENSE("GPL");
  25. #ifdef GRIP_DEBUG
  26. #define dbg(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg)
  27. #else
  28. #define dbg(format, arg...) do {} while (0)
  29. #endif
  30. #define GRIP_MAX_PORTS 4
  31. /*
  32. * Grip multiport state
  33. */
  34. struct grip_port {
  35. struct input_dev *dev;
  36. int mode;
  37. int registered;
  38. /* individual gamepad states */
  39. int buttons;
  40. int xaxes;
  41. int yaxes;
  42. int dirty; /* has the state been updated? */
  43. };
  44. struct grip_mp {
  45. struct gameport *gameport;
  46. struct grip_port *port[GRIP_MAX_PORTS];
  47. // struct input_dev *dev[4];
  48. // int mode[4];
  49. // int registered[4];
  50. int reads;
  51. int bads;
  52. /* individual gamepad states */
  53. // int buttons[4];
  54. // int xaxes[4];
  55. // int yaxes[4];
  56. // int dirty[4]; /* has the state been updated? */
  57. };
  58. /*
  59. * Multiport packet interpretation
  60. */
  61. #define PACKET_FULL 0x80000000 /* packet is full */
  62. #define PACKET_IO_FAST 0x40000000 /* 3 bits per gameport read */
  63. #define PACKET_IO_SLOW 0x20000000 /* 1 bit per gameport read */
  64. #define PACKET_MP_MORE 0x04000000 /* multiport wants to send more */
  65. #define PACKET_MP_DONE 0x02000000 /* multiport done sending */
  66. /*
  67. * Packet status code interpretation
  68. */
  69. #define IO_GOT_PACKET 0x0100 /* Got a packet */
  70. #define IO_MODE_FAST 0x0200 /* Used 3 data bits per gameport read */
  71. #define IO_SLOT_CHANGE 0x0800 /* Multiport physical slot status changed */
  72. #define IO_DONE 0x1000 /* Multiport is done sending packets */
  73. #define IO_RETRY 0x4000 /* Try again later to get packet */
  74. #define IO_RESET 0x8000 /* Force multiport to resend all packets */
  75. /*
  76. * Gamepad configuration data. Other 9-pin digital joystick devices
  77. * may work with the multiport, so this may not be an exhaustive list!
  78. * Commodore 64 joystick remains untested.
  79. */
  80. #define GRIP_INIT_DELAY 2000 /* 2 ms */
  81. #define GRIP_MODE_NONE 0
  82. #define GRIP_MODE_RESET 1
  83. #define GRIP_MODE_GP 2
  84. #define GRIP_MODE_C64 3
  85. static const int grip_btn_gp[] = { BTN_TR, BTN_TL, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, -1 };
  86. static const int grip_btn_c64[] = { BTN_JOYSTICK, -1 };
  87. static const int grip_abs_gp[] = { ABS_X, ABS_Y, -1 };
  88. static const int grip_abs_c64[] = { ABS_X, ABS_Y, -1 };
  89. static const int *grip_abs[] = { NULL, NULL, grip_abs_gp, grip_abs_c64 };
  90. static const int *grip_btn[] = { NULL, NULL, grip_btn_gp, grip_btn_c64 };
  91. static const char *grip_name[] = { NULL, NULL, "Gravis Grip Pad", "Commodore 64 Joystick" };
  92. static const int init_seq[] = {
  93. 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  94. 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1,
  95. 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1,
  96. 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 };
  97. /* Maps multiport directional values to X,Y axis values (each axis encoded in 3 bits) */
  98. static const int axis_map[] = { 5, 9, 1, 5, 6, 10, 2, 6, 4, 8, 0, 4, 5, 9, 1, 5 };
  99. static int register_slot(int i, struct grip_mp *grip);
  100. /*
  101. * Returns whether an odd or even number of bits are on in pkt.
  102. */
  103. static int bit_parity(u32 pkt)
  104. {
  105. int x = pkt ^ (pkt >> 16);
  106. x ^= x >> 8;
  107. x ^= x >> 4;
  108. x ^= x >> 2;
  109. x ^= x >> 1;
  110. return x & 1;
  111. }
  112. /*
  113. * Poll gameport; return true if all bits set in 'onbits' are on and
  114. * all bits set in 'offbits' are off.
  115. */
  116. static inline int poll_until(u8 onbits, u8 offbits, int u_sec, struct gameport* gp, u8 *data)
  117. {
  118. int i, nloops;
  119. nloops = gameport_time(gp, u_sec);
  120. for (i = 0; i < nloops; i++) {
  121. *data = gameport_read(gp);
  122. if ((*data & onbits) == onbits &&
  123. (~(*data) & offbits) == offbits)
  124. return 1;
  125. }
  126. dbg("gameport timed out after %d microseconds.\n", u_sec);
  127. return 0;
  128. }
  129. /*
  130. * Gets a 28-bit packet from the multiport.
  131. *
  132. * After getting a packet successfully, commands encoded by sendcode may
  133. * be sent to the multiport.
  134. *
  135. * The multiport clock value is reflected in gameport bit B4.
  136. *
  137. * Returns a packet status code indicating whether packet is valid, the transfer
  138. * mode, and any error conditions.
  139. *
  140. * sendflags: current I/O status
  141. * sendcode: data to send to the multiport if sendflags is nonzero
  142. */
  143. static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *packet)
  144. {
  145. u8 raw_data; /* raw data from gameport */
  146. u8 data_mask; /* packet data bits from raw_data */
  147. u32 pkt; /* packet temporary storage */
  148. int bits_per_read; /* num packet bits per gameport read */
  149. int portvals = 0; /* used for port value sanity check */
  150. int i;
  151. /* Gameport bits B0, B4, B5 should first be off, then B4 should come on. */
  152. *packet = 0;
  153. raw_data = gameport_read(gameport);
  154. if (raw_data & 1)
  155. return IO_RETRY;
  156. for (i = 0; i < 64; i++) {
  157. raw_data = gameport_read(gameport);
  158. portvals |= 1 << ((raw_data >> 4) & 3); /* Demux B4, B5 */
  159. }
  160. if (portvals == 1) { /* B4, B5 off */
  161. raw_data = gameport_read(gameport);
  162. portvals = raw_data & 0xf0;
  163. if (raw_data & 0x31)
  164. return IO_RESET;
  165. gameport_trigger(gameport);
  166. if (!poll_until(0x10, 0, 308, gameport, &raw_data))
  167. return IO_RESET;
  168. } else
  169. return IO_RETRY;
  170. /* Determine packet transfer mode and prepare for packet construction. */
  171. if (raw_data & 0x20) { /* 3 data bits/read */
  172. portvals |= raw_data >> 4; /* Compare B4-B7 before & after trigger */
  173. if (portvals != 0xb)
  174. return 0;
  175. data_mask = 7;
  176. bits_per_read = 3;
  177. pkt = (PACKET_FULL | PACKET_IO_FAST) >> 28;
  178. } else { /* 1 data bit/read */
  179. data_mask = 1;
  180. bits_per_read = 1;
  181. pkt = (PACKET_FULL | PACKET_IO_SLOW) >> 28;
  182. }
  183. /* Construct a packet. Final data bits must be zero. */
  184. while (1) {
  185. if (!poll_until(0, 0x10, 77, gameport, &raw_data))
  186. return IO_RESET;
  187. raw_data = (raw_data >> 5) & data_mask;
  188. if (pkt & PACKET_FULL)
  189. break;
  190. pkt = (pkt << bits_per_read) | raw_data;
  191. if (!poll_until(0x10, 0, 77, gameport, &raw_data))
  192. return IO_RESET;
  193. }
  194. if (raw_data)
  195. return IO_RESET;
  196. /* If 3 bits/read used, drop from 30 bits to 28. */
  197. if (bits_per_read == 3) {
  198. pkt = (pkt & 0xffff0000) | ((pkt << 1) & 0xffff);
  199. pkt = (pkt >> 2) | 0xf0000000;
  200. }
  201. if (bit_parity(pkt) == 1)
  202. return IO_RESET;
  203. /* Acknowledge packet receipt */
  204. if (!poll_until(0x30, 0, 77, gameport, &raw_data))
  205. return IO_RESET;
  206. raw_data = gameport_read(gameport);
  207. if (raw_data & 1)
  208. return IO_RESET;
  209. gameport_trigger(gameport);
  210. if (!poll_until(0, 0x20, 77, gameport, &raw_data))
  211. return IO_RESET;
  212. /* Return if we just wanted the packet or multiport wants to send more */
  213. *packet = pkt;
  214. if ((sendflags == 0) || ((sendflags & IO_RETRY) && !(pkt & PACKET_MP_DONE)))
  215. return IO_GOT_PACKET;
  216. if (pkt & PACKET_MP_MORE)
  217. return IO_GOT_PACKET | IO_RETRY;
  218. /* Multiport is done sending packets and is ready to receive data */
  219. if (!poll_until(0x20, 0, 77, gameport, &raw_data))
  220. return IO_GOT_PACKET | IO_RESET;
  221. raw_data = gameport_read(gameport);
  222. if (raw_data & 1)
  223. return IO_GOT_PACKET | IO_RESET;
  224. /* Trigger gameport based on bits in sendcode */
  225. gameport_trigger(gameport);
  226. do {
  227. if (!poll_until(0x20, 0x10, 116, gameport, &raw_data))
  228. return IO_GOT_PACKET | IO_RESET;
  229. if (!poll_until(0x30, 0, 193, gameport, &raw_data))
  230. return IO_GOT_PACKET | IO_RESET;
  231. if (raw_data & 1)
  232. return IO_GOT_PACKET | IO_RESET;
  233. if (sendcode & 1)
  234. gameport_trigger(gameport);
  235. sendcode >>= 1;
  236. } while (sendcode);
  237. return IO_GOT_PACKET | IO_MODE_FAST;
  238. }
  239. /*
  240. * Disables and restores interrupts for mp_io(), which does the actual I/O.
  241. */
  242. static int multiport_io(struct gameport* gameport, int sendflags, int sendcode, u32 *packet)
  243. {
  244. int status;
  245. unsigned long flags;
  246. local_irq_save(flags);
  247. status = mp_io(gameport, sendflags, sendcode, packet);
  248. local_irq_restore(flags);
  249. return status;
  250. }
  251. /*
  252. * Puts multiport into digital mode. Multiport LED turns green.
  253. *
  254. * Returns true if a valid digital packet was received, false otherwise.
  255. */
  256. static int dig_mode_start(struct gameport *gameport, u32 *packet)
  257. {
  258. int i, seq_len = sizeof(init_seq)/sizeof(int);
  259. int flags, tries = 0, bads = 0;
  260. for (i = 0; i < seq_len; i++) { /* Send magic sequence */
  261. if (init_seq[i])
  262. gameport_trigger(gameport);
  263. udelay(GRIP_INIT_DELAY);
  264. }
  265. for (i = 0; i < 16; i++) /* Wait for multiport to settle */
  266. udelay(GRIP_INIT_DELAY);
  267. while (tries < 64 && bads < 8) { /* Reset multiport and try getting a packet */
  268. flags = multiport_io(gameport, IO_RESET, 0x27, packet);
  269. if (flags & IO_MODE_FAST)
  270. return 1;
  271. if (flags & IO_RETRY)
  272. tries++;
  273. else
  274. bads++;
  275. }
  276. return 0;
  277. }
  278. /*
  279. * Packet structure: B0-B15 => gamepad state
  280. * B16-B20 => gamepad device type
  281. * B21-B24 => multiport slot index (1-4)
  282. *
  283. * Known device types: 0x1f (grip pad), 0x0 (no device). Others may exist.
  284. *
  285. * Returns the packet status.
  286. */
  287. static int get_and_decode_packet(struct grip_mp *grip, int flags)
  288. {
  289. struct grip_port *port;
  290. u32 packet;
  291. int joytype = 0;
  292. int slot;
  293. /* Get a packet and check for validity */
  294. flags &= IO_RESET | IO_RETRY;
  295. flags = multiport_io(grip->gameport, flags, 0, &packet);
  296. grip->reads++;
  297. if (packet & PACKET_MP_DONE)
  298. flags |= IO_DONE;
  299. if (flags && !(flags & IO_GOT_PACKET)) {
  300. grip->bads++;
  301. return flags;
  302. }
  303. /* Ignore non-gamepad packets, e.g. multiport hardware version */
  304. slot = ((packet >> 21) & 0xf) - 1;
  305. if ((slot < 0) || (slot > 3))
  306. return flags;
  307. port = grip->port[slot];
  308. /*
  309. * Handle "reset" packets, which occur at startup, and when gamepads
  310. * are removed or plugged in. May contain configuration of a new gamepad.
  311. */
  312. joytype = (packet >> 16) & 0x1f;
  313. if (!joytype) {
  314. if (port->registered) {
  315. printk(KERN_INFO "grip_mp: removing %s, slot %d\n",
  316. grip_name[port->mode], slot);
  317. input_unregister_device(port->dev);
  318. port->registered = 0;
  319. }
  320. dbg("Reset: grip multiport slot %d\n", slot);
  321. port->mode = GRIP_MODE_RESET;
  322. flags |= IO_SLOT_CHANGE;
  323. return flags;
  324. }
  325. /* Interpret a grip pad packet */
  326. if (joytype == 0x1f) {
  327. int dir = (packet >> 8) & 0xf; /* eight way directional value */
  328. port->buttons = (~packet) & 0xff;
  329. port->yaxes = ((axis_map[dir] >> 2) & 3) - 1;
  330. port->xaxes = (axis_map[dir] & 3) - 1;
  331. port->dirty = 1;
  332. if (port->mode == GRIP_MODE_RESET)
  333. flags |= IO_SLOT_CHANGE;
  334. port->mode = GRIP_MODE_GP;
  335. if (!port->registered) {
  336. dbg("New Grip pad in multiport slot %d.\n", slot);
  337. register_slot(slot, grip);
  338. }
  339. return flags;
  340. }
  341. /* Handle non-grip device codes. For now, just print diagnostics. */
  342. {
  343. static int strange_code = 0;
  344. if (strange_code != joytype) {
  345. printk(KERN_INFO "Possible non-grip pad/joystick detected.\n");
  346. printk(KERN_INFO "Got joy type 0x%x and packet 0x%x.\n", joytype, packet);
  347. strange_code = joytype;
  348. }
  349. }
  350. return flags;
  351. }
  352. /*
  353. * Returns true if all multiport slot states appear valid.
  354. */
  355. static int slots_valid(struct grip_mp *grip)
  356. {
  357. int flags, slot, invalid = 0, active = 0;
  358. flags = get_and_decode_packet(grip, 0);
  359. if (!(flags & IO_GOT_PACKET))
  360. return 0;
  361. for (slot = 0; slot < 4; slot++) {
  362. if (grip->port[slot]->mode == GRIP_MODE_RESET)
  363. invalid = 1;
  364. if (grip->port[slot]->mode != GRIP_MODE_NONE)
  365. active = 1;
  366. }
  367. /* Return true if no active slot but multiport sent all its data */
  368. if (!active)
  369. return (flags & IO_DONE) ? 1 : 0;
  370. /* Return false if invalid device code received */
  371. return invalid ? 0 : 1;
  372. }
  373. /*
  374. * Returns whether the multiport was placed into digital mode and
  375. * able to communicate its state successfully.
  376. */
  377. static int multiport_init(struct grip_mp *grip)
  378. {
  379. int dig_mode, initialized = 0, tries = 0;
  380. u32 packet;
  381. dig_mode = dig_mode_start(grip->gameport, &packet);
  382. while (!dig_mode && tries < 4) {
  383. dig_mode = dig_mode_start(grip->gameport, &packet);
  384. tries++;
  385. }
  386. if (dig_mode)
  387. dbg("multiport_init(): digital mode activated.\n");
  388. else {
  389. dbg("multiport_init(): unable to activate digital mode.\n");
  390. return 0;
  391. }
  392. /* Get packets, store multiport state, and check state's validity */
  393. for (tries = 0; tries < 4096; tries++) {
  394. if (slots_valid(grip)) {
  395. initialized = 1;
  396. break;
  397. }
  398. }
  399. dbg("multiport_init(): initialized == %d\n", initialized);
  400. return initialized;
  401. }
  402. /*
  403. * Reports joystick state to the linux input layer.
  404. */
  405. static void report_slot(struct grip_mp *grip, int slot)
  406. {
  407. struct grip_port *port = grip->port[slot];
  408. int i;
  409. /* Store button states with linux input driver */
  410. for (i = 0; i < 8; i++)
  411. input_report_key(port->dev, grip_btn_gp[i], (port->buttons >> i) & 1);
  412. /* Store axis states with linux driver */
  413. input_report_abs(port->dev, ABS_X, port->xaxes);
  414. input_report_abs(port->dev, ABS_Y, port->yaxes);
  415. /* Tell the receiver of the events to process them */
  416. input_sync(port->dev);
  417. port->dirty = 0;
  418. }
  419. /*
  420. * Get the multiport state.
  421. */
  422. static void grip_poll(struct gameport *gameport)
  423. {
  424. struct grip_mp *grip = gameport_get_drvdata(gameport);
  425. int i, npkts, flags;
  426. for (npkts = 0; npkts < 4; npkts++) {
  427. flags = IO_RETRY;
  428. for (i = 0; i < 32; i++) {
  429. flags = get_and_decode_packet(grip, flags);
  430. if ((flags & IO_GOT_PACKET) || !(flags & IO_RETRY))
  431. break;
  432. }
  433. if (flags & IO_DONE)
  434. break;
  435. }
  436. for (i = 0; i < 4; i++)
  437. if (grip->port[i]->dirty)
  438. report_slot(grip, i);
  439. }
  440. /*
  441. * Called when a joystick device file is opened
  442. */
  443. static int grip_open(struct input_dev *dev)
  444. {
  445. struct grip_mp *grip = dev->private;
  446. gameport_start_polling(grip->gameport);
  447. return 0;
  448. }
  449. /*
  450. * Called when a joystick device file is closed
  451. */
  452. static void grip_close(struct input_dev *dev)
  453. {
  454. struct grip_mp *grip = dev->private;
  455. gameport_start_polling(grip->gameport);
  456. }
  457. /*
  458. * Tell the linux input layer about a newly plugged-in gamepad.
  459. */
  460. static int register_slot(int slot, struct grip_mp *grip)
  461. {
  462. struct grip_port *port = grip->port[slot];
  463. struct input_dev *input_dev;
  464. int j, t;
  465. port->dev = input_dev = input_allocate_device();
  466. if (!input_dev)
  467. return -ENOMEM;
  468. input_dev->name = grip_name[port->mode];
  469. input_dev->id.bustype = BUS_GAMEPORT;
  470. input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS;
  471. input_dev->id.product = 0x0100 + port->mode;
  472. input_dev->id.version = 0x0100;
  473. input_dev->cdev.dev = &grip->gameport->dev;
  474. input_dev->private = grip;
  475. input_dev->open = grip_open;
  476. input_dev->close = grip_close;
  477. input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
  478. for (j = 0; (t = grip_abs[port->mode][j]) >= 0; j++)
  479. input_set_abs_params(input_dev, t, -1, 1, 0, 0);
  480. for (j = 0; (t = grip_btn[port->mode][j]) >= 0; j++)
  481. if (t > 0)
  482. set_bit(t, input_dev->keybit);
  483. input_register_device(port->dev);
  484. port->registered = 1;
  485. if (port->dirty) /* report initial state, if any */
  486. report_slot(grip, slot);
  487. return 0;
  488. }
  489. static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
  490. {
  491. struct grip_mp *grip;
  492. int err;
  493. if (!(grip = kzalloc(sizeof(struct grip_mp), GFP_KERNEL)))
  494. return -ENOMEM;
  495. grip->gameport = gameport;
  496. gameport_set_drvdata(gameport, grip);
  497. err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
  498. if (err)
  499. goto fail1;
  500. gameport_set_poll_handler(gameport, grip_poll);
  501. gameport_set_poll_interval(gameport, 20);
  502. if (!multiport_init(grip)) {
  503. err = -ENODEV;
  504. goto fail2;
  505. }
  506. if (!grip->port[0]->mode && !grip->port[1]->mode && !grip->port[2]->mode && !grip->port[3]->mode) {
  507. /* nothing plugged in */
  508. err = -ENODEV;
  509. goto fail2;
  510. }
  511. return 0;
  512. fail2: gameport_close(gameport);
  513. fail1: gameport_set_drvdata(gameport, NULL);
  514. kfree(grip);
  515. return err;
  516. }
  517. static void grip_disconnect(struct gameport *gameport)
  518. {
  519. struct grip_mp *grip = gameport_get_drvdata(gameport);
  520. int i;
  521. for (i = 0; i < 4; i++)
  522. if (grip->port[i]->registered)
  523. input_unregister_device(grip->port[i]->dev);
  524. gameport_close(gameport);
  525. gameport_set_drvdata(gameport, NULL);
  526. kfree(grip);
  527. }
  528. static struct gameport_driver grip_drv = {
  529. .driver = {
  530. .name = "grip_mp",
  531. },
  532. .description = DRIVER_DESC,
  533. .connect = grip_connect,
  534. .disconnect = grip_disconnect,
  535. };
  536. static int __init grip_init(void)
  537. {
  538. gameport_register_driver(&grip_drv);
  539. return 0;
  540. }
  541. static void __exit grip_exit(void)
  542. {
  543. gameport_unregister_driver(&grip_drv);
  544. }
  545. module_init(grip_init);
  546. module_exit(grip_exit);