diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2011-11-17 14:12:02 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-11-22 23:08:40 +0100 |
commit | 82fb1b39581e7cdd71a6ce3cf12996711a583df2 (patch) | |
tree | fa2da049edd46c8ed1866c220581c4e2f2b68f42 /drivers/hid/hid-wiimote-ext.c | |
parent | cb99221ba74bb16576a9c3b7e49357b6b12ff3ea (diff) | |
download | talos-obmc-linux-82fb1b39581e7cdd71a6ce3cf12996711a583df2.tar.gz talos-obmc-linux-82fb1b39581e7cdd71a6ce3cf12996711a583df2.zip |
HID: wiimote: Add extension initializer stubs
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>
Diffstat (limited to 'drivers/hid/hid-wiimote-ext.c')
-rw-r--r-- | drivers/hid/hid-wiimote-ext.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c index fa9c67722aca..3e3e1fc8d838 100644 --- a/drivers/hid/hid-wiimote-ext.c +++ b/drivers/hid/hid-wiimote-ext.c @@ -33,10 +33,48 @@ enum wiiext_type { WIIEXT_NUNCHUCK, /* Nintendo nunchuck controller */ }; +/* diable all extensions */ +static void ext_disable(struct wiimote_ext *ext) +{ + unsigned long flags; + + spin_lock_irqsave(&ext->wdata->state.lock, flags); + ext->motionp = false; + ext->ext_type = WIIEXT_NONE; + spin_unlock_irqrestore(&ext->wdata->state.lock, flags); +} + +static bool motionp_read(struct wiimote_ext *ext) +{ + return false; +} + +static __u8 ext_read(struct wiimote_ext *ext) +{ + return WIIEXT_NONE; +} + +static void ext_enable(struct wiimote_ext *ext, bool motionp, __u8 ext_type) +{ + unsigned long flags; + + spin_lock_irqsave(&ext->wdata->state.lock, flags); + ext->motionp = motionp; + ext->ext_type = ext_type; + spin_unlock_irqrestore(&ext->wdata->state.lock, flags); +} + static void wiiext_worker(struct work_struct *work) { struct wiimote_ext *ext = container_of(work, struct wiimote_ext, worker); + bool motionp; + __u8 ext_type; + + ext_disable(ext); + motionp = motionp_read(ext); + ext_type = ext_read(ext); + ext_enable(ext, motionp, ext_type); } /* schedule work only once, otherwise mark for reschedule */ |