-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HID: wiimote: Add debugfs support stubs
Add initializer and deinitializer for debugfs support. This will later allow raw eeprom access and direct DRM modifications to debug wiimote behaviour and further protocol reverse-engineerings. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
- Loading branch information
David Herrmann
authored and
Jiri Kosina
committed
Nov 22, 2011
1 parent
5906215
commit 43e5e7c
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Debug support for HID Nintendo Wiimote devices | ||
* Copyright (c) 2011 David Herrmann | ||
*/ | ||
|
||
/* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/spinlock.h> | ||
#include "hid-wiimote.h" | ||
|
||
struct wiimote_debug { | ||
struct wiimote_data *wdata; | ||
}; | ||
|
||
int wiidebug_init(struct wiimote_data *wdata) | ||
{ | ||
struct wiimote_debug *dbg; | ||
unsigned long flags; | ||
|
||
dbg = kzalloc(sizeof(*dbg), GFP_KERNEL); | ||
if (!dbg) | ||
return -ENOMEM; | ||
|
||
dbg->wdata = wdata; | ||
|
||
spin_lock_irqsave(&wdata->state.lock, flags); | ||
wdata->debug = dbg; | ||
spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
|
||
return 0; | ||
} | ||
|
||
void wiidebug_deinit(struct wiimote_data *wdata) | ||
{ | ||
struct wiimote_debug *dbg = wdata->debug; | ||
unsigned long flags; | ||
|
||
if (!dbg) | ||
return; | ||
|
||
spin_lock_irqsave(&wdata->state.lock, flags); | ||
wdata->debug = NULL; | ||
spin_unlock_irqrestore(&wdata->state.lock, flags); | ||
|
||
kfree(dbg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters