* [PATCH] mouse button #1 emulation for mac_hid
@ 2009-10-31 10:57 Soeren Sonnenburg
0 siblings, 0 replies; 7+ messages in thread
From: Soeren Sonnenburg @ 2009-10-31 10:57 UTC (permalink / raw)
To: Linux Kernel
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
Dear all,
I am not sure what the future of mac_hid is (the source says will be
removed, but since 9 years). In case it stays in kernel the attached
patch adds support for mouse button 1 emulation. If this driver stays in
the kernel I would also suggest to rename it - it is not mac specific (I
am using this on a netbook).
Rationale? Broken touchpads, within linux unsupported (multi-)touch pads
where click and hold + moving the mouse does not work.
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
[-- Attachment #2: mac_hid_lmb.diff --]
[-- Type: text/x-patch, Size: 3294 bytes --]
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index cc9f275..3aac90f 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -19,6 +19,7 @@
static struct input_dev *emumousebtn;
static int emumousebtn_input_register(void);
static int mouse_emulate_buttons;
+static int mouse_button1_keycode = KEY_RIGHTSHIFT; /* right shift key */
static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
static int mouse_last_keycode;
@@ -35,6 +36,14 @@ static ctl_table mac_hid_files[] = {
.proc_handler = &proc_dointvec,
},
{
+ .ctl_name = DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE,
+ .procname = "mouse_button1_keycode",
+ .data = &mouse_button1_keycode,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
.ctl_name = DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE,
.procname = "mouse_button2_keycode",
.data = &mouse_button2_keycode,
@@ -83,16 +92,24 @@ static struct ctl_table_header *mac_hid_sysctl_header;
int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
{
+ unsigned int reportcode;
+
switch (caller) {
case 1:
/* Called from keyboard.c */
if (mouse_emulate_buttons
- && (keycode == mouse_button2_keycode
- || keycode == mouse_button3_keycode)) {
+ && (keycode == mouse_button1_keycode ||
+ keycode == mouse_button2_keycode ||
+ keycode == mouse_button3_keycode)) {
if (mouse_emulate_buttons == 1) {
- input_report_key(emumousebtn,
- keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT,
- down);
+ if (keycode==mouse_button1_keycode)
+ reportcode=BTN_LEFT;
+ else if (keycode==mouse_button2_keycode)
+ reportcode=BTN_MIDDLE;
+ else
+ reportcode=BTN_RIGHT;
+
+ input_report_key(emumousebtn, reportcode, down);
input_sync(emumousebtn);
return 1;
}
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1e4743e..d38f5a0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -913,9 +913,10 @@ enum {
DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
- DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
- DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
- DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
+ DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE=4,
+ DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=5,
+ DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=6,
+ DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=7
};
/* /proc/sys/dev/scsi */
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index b6e7aae..60fa7fe 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -816,6 +816,7 @@ static const struct trans_ctl_table trans_mac_hid_files[] = {
/* DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES unused */
/* DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES unused */
{ DEV_MAC_HID_MOUSE_BUTTON_EMULATION, "mouse_button_emulation" },
+ { DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE, "mouse_button1_keycode" },
{ DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, "mouse_button2_keycode" },
{ DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, "mouse_button3_keycode" },
/* DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES unused */
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mouse button 1 emulation for mac_hid
@ 2009-11-09 10:28 Soeren Sonnenburg
2009-11-14 5:42 ` Dmitry Torokhov
0 siblings, 1 reply; 7+ messages in thread
From: Soeren Sonnenburg @ 2009-11-09 10:28 UTC (permalink / raw)
To: Linux Kernel
Cc: Linus Torvalds, Adrian Bunk, Dmitry Torokhov, olh, Jiri Slaby
[-- Attachment #1.1: Type: text/plain, Size: 810 bytes --]
(this is a resent with all the people included in the CC that git
blame'd they are the authors).
Dear all,
I am not sure what the future of mac_hid is (the source says will be
removed, but since 9 years). In case it stays in kernel the attached
patch adds support for mouse button 1 emulation. If this driver stays in
the kernel I would also suggest to rename it - it is not mac specific (I
am using this on a netbook).
Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
where click and hold + moving the mouse does not work (yet?).
I am using this for over a week now with about that uptime - so it
should be safe.
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
[-- Attachment #1.2: mac_hid_lmb.diff --]
[-- Type: text/x-patch, Size: 3294 bytes --]
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index cc9f275..3aac90f 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -19,6 +19,7 @@
static struct input_dev *emumousebtn;
static int emumousebtn_input_register(void);
static int mouse_emulate_buttons;
+static int mouse_button1_keycode = KEY_RIGHTSHIFT; /* right shift key */
static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
static int mouse_last_keycode;
@@ -35,6 +36,14 @@ static ctl_table mac_hid_files[] = {
.proc_handler = &proc_dointvec,
},
{
+ .ctl_name = DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE,
+ .procname = "mouse_button1_keycode",
+ .data = &mouse_button1_keycode,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
.ctl_name = DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE,
.procname = "mouse_button2_keycode",
.data = &mouse_button2_keycode,
@@ -83,16 +92,24 @@ static struct ctl_table_header *mac_hid_sysctl_header;
int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
{
+ unsigned int reportcode;
+
switch (caller) {
case 1:
/* Called from keyboard.c */
if (mouse_emulate_buttons
- && (keycode == mouse_button2_keycode
- || keycode == mouse_button3_keycode)) {
+ && (keycode == mouse_button1_keycode ||
+ keycode == mouse_button2_keycode ||
+ keycode == mouse_button3_keycode)) {
if (mouse_emulate_buttons == 1) {
- input_report_key(emumousebtn,
- keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT,
- down);
+ if (keycode==mouse_button1_keycode)
+ reportcode=BTN_LEFT;
+ else if (keycode==mouse_button2_keycode)
+ reportcode=BTN_MIDDLE;
+ else
+ reportcode=BTN_RIGHT;
+
+ input_report_key(emumousebtn, reportcode, down);
input_sync(emumousebtn);
return 1;
}
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1e4743e..d38f5a0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -913,9 +913,10 @@ enum {
DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
- DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
- DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
- DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
+ DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE=4,
+ DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=5,
+ DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=6,
+ DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=7
};
/* /proc/sys/dev/scsi */
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index b6e7aae..60fa7fe 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -816,6 +816,7 @@ static const struct trans_ctl_table trans_mac_hid_files[] = {
/* DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES unused */
/* DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES unused */
{ DEV_MAC_HID_MOUSE_BUTTON_EMULATION, "mouse_button_emulation" },
+ { DEV_MAC_HID_MOUSE_BUTTON1_KEYCODE, "mouse_button1_keycode" },
{ DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, "mouse_button2_keycode" },
{ DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, "mouse_button3_keycode" },
/* DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES unused */
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mouse button 1 emulation for mac_hid
2009-11-09 10:28 [PATCH] mouse button 1 emulation for mac_hid Soeren Sonnenburg
@ 2009-11-14 5:42 ` Dmitry Torokhov
2009-11-14 10:31 ` Soeren Sonnenburg
2009-11-16 12:59 ` Jiri Kosina
0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2009-11-14 5:42 UTC (permalink / raw)
To: Soeren Sonnenburg
Cc: Linux Kernel, Linus Torvalds, Adrian Bunk, olh, Jiri Slaby
Hi Soeren,
On Mon, Nov 09, 2009 at 11:28:51AM +0100, Soeren Sonnenburg wrote:
> (this is a resent with all the people included in the CC that git
> blame'd they are the authors).
>
> Dear all,
>
> I am not sure what the future of mac_hid is (the source says will be
> removed, but since 9 years). In case it stays in kernel the attached
> patch adds support for mouse button 1 emulation. If this driver stays in
> the kernel I would also suggest to rename it - it is not mac specific (I
> am using this on a netbook).
>
> Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
> where click and hold + moving the mouse does not work (yet?).
>
I would rather fix the touchpads so they work properly than pile more
quirks in kernel.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mouse button 1 emulation for mac_hid
2009-11-14 5:42 ` Dmitry Torokhov
@ 2009-11-14 10:31 ` Soeren Sonnenburg
2009-11-16 12:59 ` Jiri Kosina
1 sibling, 0 replies; 7+ messages in thread
From: Soeren Sonnenburg @ 2009-11-14 10:31 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Linux Kernel, Linus Torvalds, Adrian Bunk, olh, Jiri Slaby
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]
On Fri, 2009-11-13 at 21:42 -0800, Dmitry Torokhov wrote:
> Hi Soeren,
Hi Dmitry,
> On Mon, Nov 09, 2009 at 11:28:51AM +0100, Soeren Sonnenburg wrote:
> > (this is a resent with all the people included in the CC that git
> > blame'd they are the authors).
> >
> > Dear all,
> >
> > I am not sure what the future of mac_hid is (the source says will be
> > removed, but since 9 years). In case it stays in kernel the attached
> > patch adds support for mouse button 1 emulation. If this driver stays in
> > the kernel I would also suggest to rename it - it is not mac specific (I
> > am using this on a netbook).
> >
> > Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
> > where click and hold + moving the mouse does not work (yet?).
> >
>
> I would rather fix the touchpads so they work properly than pile more
> quirks in kernel.
Well I guess this whole mouse button emulation should not exist (not
only not in the kernel). But given that it is hard to fix a touchpad
that has no or only one mouse button ... I don't know.
Anyway, the patch is really small/non-intrusive but if it is not
appropriate I can - thanks to git - easily have it in some local
branch :)
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mouse button 1 emulation for mac_hid
2009-11-14 5:42 ` Dmitry Torokhov
2009-11-14 10:31 ` Soeren Sonnenburg
@ 2009-11-16 12:59 ` Jiri Kosina
2009-11-16 17:05 ` Dmitry Torokhov
1 sibling, 1 reply; 7+ messages in thread
From: Jiri Kosina @ 2009-11-16 12:59 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Soeren Sonnenburg, Linux Kernel, Linus Torvalds, Adrian Bunk, olh,
Jiri Slaby
On Fri, 13 Nov 2009, Dmitry Torokhov wrote:
> > I am not sure what the future of mac_hid is (the source says will be
> > removed, but since 9 years). In case it stays in kernel the attached
> > patch adds support for mouse button 1 emulation. If this driver stays in
> > the kernel I would also suggest to rename it - it is not mac specific (I
> > am using this on a netbook).
> >
> > Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
> > where click and hold + moving the mouse does not work (yet?).
>
> I would rather fix the touchpads so they work properly than pile more
> quirks in kernel.
Hi Dmitry,
in exactly what way are you planning to "fix the touchpads"?
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mouse button 1 emulation for mac_hid
2009-11-16 12:59 ` Jiri Kosina
@ 2009-11-16 17:05 ` Dmitry Torokhov
2009-11-16 17:11 ` Soeren Sonnenburg
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2009-11-16 17:05 UTC (permalink / raw)
To: Jiri Kosina
Cc: Soeren Sonnenburg, Linux Kernel, Linus Torvalds, Adrian Bunk, olh,
Jiri Slaby
On Mon, Nov 16, 2009 at 01:59:37PM +0100, Jiri Kosina wrote:
> On Fri, 13 Nov 2009, Dmitry Torokhov wrote:
>
> > > I am not sure what the future of mac_hid is (the source says will be
> > > removed, but since 9 years). In case it stays in kernel the attached
> > > patch adds support for mouse button 1 emulation. If this driver stays in
> > > the kernel I would also suggest to rename it - it is not mac specific (I
> > > am using this on a netbook).
> > >
> > > Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
> > > where click and hold + moving the mouse does not work (yet?).
> >
> > I would rather fix the touchpads so they work properly than pile more
> > quirks in kernel.
>
> Hi Dmitry,
>
> in exactly what way are you planning to "fix the touchpads"?
>
Hi Jiri,
It would be helpful to know which ones are currently. Obviously we can't
help with physically broken ones but I don't believe it is kernel's task
to deal with physically broken hardware. The ones that are not
physically broken - PS/2 should have fairly decent hardware emulation
mode (at least all I tried supported tap and trag while working as
regular PS/2 mouse) - so that can be used while we figuring out native
protocol. USB - appletouch, bcm - are there any issues at the moment?
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mouse button 1 emulation for mac_hid
2009-11-16 17:05 ` Dmitry Torokhov
@ 2009-11-16 17:11 ` Soeren Sonnenburg
0 siblings, 0 replies; 7+ messages in thread
From: Soeren Sonnenburg @ 2009-11-16 17:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Jiri Kosina, Linux Kernel, Linus Torvalds, Adrian Bunk, olh,
Jiri Slaby
[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]
On Mon, 2009-11-16 at 09:05 -0800, Dmitry Torokhov wrote:
> On Mon, Nov 16, 2009 at 01:59:37PM +0100, Jiri Kosina wrote:
> > On Fri, 13 Nov 2009, Dmitry Torokhov wrote:
> >
> > > > I am not sure what the future of mac_hid is (the source says will be
> > > > removed, but since 9 years). In case it stays in kernel the attached
> > > > patch adds support for mouse button 1 emulation. If this driver stays in
> > > > the kernel I would also suggest to rename it - it is not mac specific (I
> > > > am using this on a netbook).
> > > >
> > > > Rationale? Broken touchpads, within linux unsupported (multi-)touchpads
> > > > where click and hold + moving the mouse does not work (yet?).
> > >
> > > I would rather fix the touchpads so they work properly than pile more
> > > quirks in kernel.
> >
> > Hi Dmitry,
> >
> > in exactly what way are you planning to "fix the touchpads"?
> >
>
> Hi Jiri,
>
> It would be helpful to know which ones are currently. Obviously we can't
> help with physically broken ones but I don't believe it is kernel's task
> to deal with physically broken hardware. The ones that are not
> physically broken - PS/2 should have fairly decent hardware emulation
> mode (at least all I tried supported tap and trag while working as
> regular PS/2 mouse) - so that can be used while we figuring out native
> protocol. USB - appletouch, bcm - are there any issues at the moment?
Ignoring broken hardware, there is the problem or feature that some
touchpads have the mouse *under the touchpad*. So when you click there
and want to move the mouse - well good luck. Of course this is something
that needs to be ultimately fixed in the synaptics xorg driver.
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-16 17:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 10:28 [PATCH] mouse button 1 emulation for mac_hid Soeren Sonnenburg
2009-11-14 5:42 ` Dmitry Torokhov
2009-11-14 10:31 ` Soeren Sonnenburg
2009-11-16 12:59 ` Jiri Kosina
2009-11-16 17:05 ` Dmitry Torokhov
2009-11-16 17:11 ` Soeren Sonnenburg
-- strict thread matches above, loose matches on Subject: below --
2009-10-31 10:57 [PATCH] mouse button #1 " Soeren Sonnenburg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox