aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wiimote-ext.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2011-11-17 08:12:06 -0500
committerJiri Kosina <jkosina@suse.cz>2011-11-22 17:09:34 -0500
commit0b6815d75d8bf214998455d94061a40f3b4a77f3 (patch)
treefd8e5bca1ed7a805546f204faad80e3b91fc72b6 /drivers/hid/hid-wiimote-ext.c
parent479901ba1847902623cc348b1d09c7d8979a9683 (diff)
HID: wiimote: Add extension handler stubs
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>
Diffstat (limited to 'drivers/hid/hid-wiimote-ext.c')
-rw-r--r--drivers/hid/hid-wiimote-ext.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
index b9254015c58f..ecc7b7b9b171 100644
--- a/drivers/hid/hid-wiimote-ext.c
+++ b/drivers/hid/hid-wiimote-ext.c
@@ -204,6 +204,35 @@ bool wiiext_active(struct wiimote_data *wdata)
204 return wdata->ext->motionp || wdata->ext->ext_type; 204 return wdata->ext->motionp || wdata->ext->ext_type;
205} 205}
206 206
207static void handler_motionp(struct wiimote_ext *ext, const __u8 *payload)
208{
209}
210
211static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload)
212{
213}
214
215static void handler_classic(struct wiimote_ext *ext, const __u8 *payload)
216{
217}
218
219/* call this with state.lock spinlock held */
220void wiiext_handle(struct wiimote_data *wdata, const __u8 *payload)
221{
222 struct wiimote_ext *ext = wdata->ext;
223
224 if (!ext)
225 return;
226
227 if (ext->motionp && (payload[5] & 0x02)) {
228 handler_motionp(ext, payload);
229 } else if (ext->ext_type == WIIEXT_NUNCHUCK) {
230 handler_nunchuck(ext, payload);
231 } else if (ext->ext_type == WIIEXT_CLASSIC) {
232 handler_classic(ext, payload);
233 }
234}
235
207static ssize_t wiiext_show(struct device *dev, struct device_attribute *attr, 236static ssize_t wiiext_show(struct device *dev, struct device_attribute *attr,
208 char *buf) 237 char *buf)
209{ 238{