From: Felipe Balbi <felipe.balbi@nokia.com>
To: linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: [RFC] Add Input IOCTL for accelerometer devices
Date: Fri, 15 May 2009 16:16:36 +0300 [thread overview]
Message-ID: <20090515131636.GE4443@nokia.com> (raw)
Hi all,
the following patch is just an idea to see how the community feels about
it. Considering accelerometer devices, you might have different use
cases for it while running different applications. You could be using it
for screen rotation in one case but when opening a game, you could use
it as a game controller by turning the device side-by-side.
Thinking about that, I decided it would be nice to have some parameters
configured at runtime in order to be able to use the accelerometer on
different use cases.
The following proposal (really draft) tries to add a new IOCTL on input
layer such as userland could use that for passing proper parameters to
accelerometer drivers.
ps: the patch is in really early stage, I'm guessing the best would be
to, as force feedback devices, provide proper registration for an
accelerometer device.
diff --git a/include/linux/input.h b/include/linux/input.h
index adc1332..c3c9e82 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -55,6 +55,26 @@ struct input_absinfo {
__s32 flat;
};
+#define INPUT_ACCEL_IRQ_NONE 0
+#define INPUT_ACCEL_IRQ_HIGH BIT(0)
+#define INPUT_ACCEL_IRQ_LOW BIT(1)
+#define INPUT_ACCEL_IRQ_LATCH BIT(2)
+
+struct input_accelinfo {
+ __u32 threshold;
+ __u32 duration;
+
+ /* the following 4 fields configure how the irqs will be generated:
+ * - High Event
+ * - Low Event
+ * - Latch irq request
+ */
+ __u8 x_irq;
+ __u8 y_irq;
+ __u8 z_irq;
+ __u8 click_irq;
+};
+
#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */
@@ -81,6 +101,8 @@ struct input_absinfo {
#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
+#define EVIOCACCELINFO _IOW('E', 0x91, struct input_accelinfo) /* set accelerometer's parameters */
+
/*
* Event types
*/
@@ -975,6 +997,8 @@ struct ff_effect {
#include <linux/timer.h>
#include <linux/mod_devicetable.h>
+struct input_accelinfo;
+
/**
* struct input_dev - represents an input device
* @name: name of the device
@@ -1069,6 +1093,7 @@ struct input_dev {
void *keycode;
int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode);
+ int (*set_accelinfo)(struct input_dev *dev, struct input_accelinfo *info);
struct ff_device *ff;
--
balbi
next reply other threads:[~2009-05-15 13:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 13:16 Felipe Balbi [this message]
2009-05-15 18:06 ` [RFC] Add Input IOCTL for accelerometer devices Trilok Soni
2009-05-15 19:30 ` Mohamed Ikbel Boulabiar
2009-05-15 20:02 ` Felipe Balbi
2009-05-16 4:19 ` Mohamed Ikbel Boulabiar
2009-05-16 12:50 ` Felipe Balbi
2009-05-18 7:45 ` Kim Kyuwon
2009-05-18 9:12 ` Felipe Balbi
2009-05-18 10:11 ` Jonathan Cameron
2009-05-18 10:31 ` Felipe Balbi
2009-05-18 11:37 ` Jonathan Cameron
2009-05-19 6:32 ` Kim Kyuwon
2009-05-21 11:42 ` Jonathan Cameron
2009-05-22 8:21 ` Kim Kyuwon
2009-05-22 13:35 ` Jonathan Cameron
2009-05-25 8:15 ` Kim Kyuwon
2009-05-25 8:52 ` Mohamed Ikbel Boulabiar
2009-05-25 11:07 ` Jonathan Cameron
2009-05-19 2:41 ` Kim Kyuwon
2009-05-19 10:42 ` Felipe Balbi
2009-05-19 12:34 ` Mohamed Ikbel Boulabiar
2009-05-21 10:21 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090515131636.GE4443@nokia.com \
--to=felipe.balbi@nokia.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox