summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wiimote-ext.c
Commit message (Collapse)AuthorAgeFilesLines
* HID: wiimote: Parse classic controller dataDavid Herrmann2011-11-221-0/+156
| | | | | | | | | Nintendo Classic Controller extension reports lots of keys, two analog sticks and two analog buttons. We report all data through extension input device to userspace. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Parse nunchuck dataDavid Herrmann2011-11-221-1/+104
| | | | | | | | | The Nintendo Nunchuck extension reports accelerometer values, one analog stick and two buttons. See inline comments for data layout. We report all data to userspace through extension input device. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Parse motion+ dataDavid Herrmann2011-11-221-0/+70
| | | | | | | | | | | | | | Motion+ reports rotation gyro data which we report to userspace as ABS_RX/Y/Z values. The device reports them either in fast or slow mode. We adjust the values to get a linear scale so userspace does not need to know about slow and fast mode. The motion+ also reports whether an extension is connected to it. We keep track of this value and reinitialize the extensions if an extension is plugged or unplugged. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Add extension handler stubsDavid Herrmann2011-11-221-0/+29
| | | | | | | | | | | | | All supported extensions report data as 6 byte block. All DRMs with extension data provide at least 6 extension bytes. Hence a generic handler for all extension bytes is sufficient and can be called on all DRMs. The handler distinguishes the input and passes it to the right handler. Motion+ passes data interleaved so we can have Motion+ and a regular extension enabled simultaneously. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Register input devices for extensionsDavid Herrmann2011-11-221-3/+106
| | | | | | | | | Motion+ and regular extensions are physical adapters for the wiimote so create one input device for each of them. This also allows to enable only opened extensions and turn unused extenions off to save battery power. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Add extension sysfs attributeDavid Herrmann2011-11-221-0/+46
| | | | | | | | Add new sysfs attribute "extension" which returns the currently connected and initialized extensions. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Add extension initializersDavid Herrmann2011-11-221-2/+79
| | | | | | | | | The wiimote extension registers are not fully understood, so we always disable all extensions on extension-port events. Then we reinitialize and reidentify them and activate all requested extensions. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Add extension initializer stubsDavid Herrmann2011-11-221-0/+38
| | | | | | | | Add stub functions to read and identify extensions and then initialize all connected extensions. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: wiimote: Add extension support stubDavid Herrmann2011-11-221-0/+130
The wiimote supports several extensions. This adds a separate source file which handles all extensions and can be disabled at compile-time. The driver reacts on "plug"-events on the extension port and starts a worker which initializes or deinitializes the extensions. Currently, the initialization logic is not fully understood and we can only detect and enable all extensions when all extensions are deactivated. Therefore, we need to disable all extensions, then detect and activate them again to react on "plug"-events. However, deactivating extensions will generate a new "plug"-event and we will never leave that loop. Hence, we only support extensions if they are plugged before the wiimote is connected (or before the ext-input device is opened). In the future we may support full extension hotplug support, but reverse-engineering this may take a while. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>