All of lore.kernel.org
 help / color / mirror / Atom feed
From: twunknown@gmail.com (Brock York)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Is this a good first patch for enabling screen rotation?
Date: Fri, 30 Jan 2015 00:45:30 +0800	[thread overview]
Message-ID: <1422549930-32443-1-git-send-email-twunknown@gmail.com> (raw)

Hello 

This is my first patch and after speaking to a few kernel
devs at LCA2015 I thought I would ask here for some advice on
if I have followed the newbie guide correctly.

The patch is to get automatic screen rotation working on a
acer iconia w500 tablet.

The patch was made against linux-next branch next-20150129
and successfully built and ran.

Do you think this is a succificient patch to get accepted by the
platform-x86 maintainers? I used get_maintainer.pl and it suggested
the platform-x86 mailing list.

Thank you, any help is much appreciated.
Regards Brock York.

BEGIN PATCH BELOW------------
Subject: [PATCH] acer-wmi: Enable screen auto-rotation via udev

Emit udev event via kobject_uevent when accelerometer position
is updated. This is to allow userspace to grab the accelerometer
position and rotate the screen accordingly.

Swap the x and y values and negate the x value converting the
accelerometers coordinate system into the coordinate system
userspace udev expects.

Accelerometer		Expected
Coordinates		Coordinates
        x+		    y+
        ^		    ^
        |		    |
        |		    |
 y+<----/		    /---->x+
       /		   /
      z+		  z+

Screen Orientation
 ________
|        |
|        |
|________|

Tested on a Acer Iconia W500 tablet with Gnome 3

Signed-off-by: Brock York <twunknown@gmail.com>
---
 drivers/platform/x86/acer-wmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 3ac29a1..d5678e4 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1491,12 +1491,14 @@ static int acer_gsensor_event(void)
 		return -1;
 
 	input_report_abs(acer_wmi_accel_dev, ABS_X,
-		(s16)out_obj->package.elements[0].integer.value);
+		-(s16)out_obj->package.elements[1].integer.value);
 	input_report_abs(acer_wmi_accel_dev, ABS_Y,
-		(s16)out_obj->package.elements[1].integer.value);
+		(s16)out_obj->package.elements[0].integer.value);
 	input_report_abs(acer_wmi_accel_dev, ABS_Z,
 		(s16)out_obj->package.elements[2].integer.value);
 	input_sync(acer_wmi_accel_dev);
+
+	kobject_uevent(&acer_wmi_accel_dev->dev.kobj, KOBJ_CHANGE);
 	return 0;
 }
 
-- 
2.2.2

             reply	other threads:[~2015-01-29 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 16:45 Brock York [this message]
2015-01-29 17:12 ` Is this a good first patch for enabling screen rotation? Valdis.Kletnieks at vt.edu
2015-02-11 15:33   ` Brock York

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=1422549930-32443-1-git-send-email-twunknown@gmail.com \
    --to=twunknown@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.