David Herrmann | 27f0694 | 2013-05-05 23:12:51 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Device Modules for Nintendo Wii / Wii U HID Driver |
| 3 | * Copyright (c) 2011-2013 David Herrmann <dh.herrmann@gmail.com> |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the Free |
| 9 | * Software Foundation; either version 2 of the License, or (at your option) |
| 10 | * any later version. |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * Wiimote Modules |
| 15 | * Nintendo devices provide different peripherals and many new devices lack |
| 16 | * initial features like the IR camera. Therefore, each peripheral device is |
| 17 | * implemented as an independent module and we probe on each device only the |
| 18 | * modules for the hardware that really is available. |
| 19 | * |
| 20 | * Module registration is sequential. Unregistration is done in reverse order. |
| 21 | * After device detection, the needed modules are loaded. Users can trigger |
| 22 | * re-detection which causes all modules to be unloaded and then reload the |
| 23 | * modules for the new detected device. |
| 24 | * |
| 25 | * wdata->input is a shared input device. It is always initialized prior to |
| 26 | * module registration. If at least one registered module is marked as |
| 27 | * WIIMOD_FLAG_INPUT, then the input device will get registered after all |
| 28 | * modules were registered. |
| 29 | * Please note that it is unregistered _before_ the "remove" callbacks are |
| 30 | * called. This guarantees that no input interaction is done, anymore. However, |
| 31 | * the wiimote core keeps a reference to the input device so it is freed only |
| 32 | * after all modules were removed. It is safe to send events to unregistered |
| 33 | * input devices. |
| 34 | */ |
| 35 | |
| 36 | #include <linux/device.h> |
| 37 | #include <linux/hid.h> |
| 38 | #include <linux/input.h> |
| 39 | #include <linux/spinlock.h> |
| 40 | #include "hid-wiimote.h" |
| 41 | |
| 42 | /* module table */ |
| 43 | |
| 44 | const struct wiimod_ops *wiimod_table[WIIMOD_NUM] = { |
| 45 | }; |