From: Harald Albrecht <harald.albrecht@gmx.net>
Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: drivers/input/input.c and a broken USB HID Contour ShuttlePRO v2
Date: Sun, 09 Mar 2014 18:31:52 +0100 [thread overview]
Message-ID: <531CA588.7030408@gmx.net> (raw)
In-Reply-To: <20140309171907.GC30196@kroah.com>
It seems that I will need help from both mailing lists. I've researched
more and would like to propose this idea ... and I need feedback from
the input and usb kernel maintainers in order to get my idea right.
So for the input part I would like to propose to introduce a new input
property INPUT_PROP_REL_IS_ABS with value 0x04 (this would be the next
available "propbit" in input land (include/linux/input.h).
#define INPUT_PROP_REL_IS_ABS 0x04 /* relative events report absolute
coordinates */
When handling EV_REL events in drivers/input/input.c we then could check
for the propbit being set and then always pass events from such devices
to the handlers. This would allow us to selectively enable this fix for
broken devices only.
static int input_get_disposition(struct input_dev *dev, unsigned int
type, unsigned int code, int value)
{
...
if (is_event_supported(code, dev->relbit, REL_MAX) &&
(value || test_bit(INPUT_PROP_REL_IS_ABS, dev->propbit))
disposition = INPUT_PASS_TO_HANDLERS;
As for the USB part I'm currently lost. My idea is to have a contour USB
device module that gets registered as a HID (sub?) driver so the generic
HID can do all the normal handling. The part I don't know yet is how to
switch on the propbit I mentioned in the previous paragraph. Can this be
done in the input_mapped function of such an HID subdriver? Do I need to
chain my own input_mapped to the generic one? I have to admit that I'm
lost at this time, as this is my first journey into Linux driver land
and Linux USB HID territory... So in my simple mind I would think of
something like...
static int contour_input_mapped(struct hid_device *hdev, struct
hid_input *hi,
struct hid_field *field, struct hid_usage *usage, unsigned long
**bit,
int *max)
{
__set_bit(INPUT_PROP_REL_IS_ABS, hi->input->propbit);
return 0;
}
static const struct hid_device_id contour_devices[] = {
{ HID_USB_DEVICE(0x0b33, 0x0030) }
{ }
};
static struct hid_driver contour_driver = {
.name = "contour",
.id_table = contour_devices,
.input_mapped = contour_input_mapped,
};
module_hid_driver(contour_driver);
MODULE_DESCRIPTION("Driver for Contour ShuttlePRO v2");
MODULE_LICENSE("GPL");
So, please bear with me and help is greatly appreciated!
-- TheDiveO
On 09.03.2014 18:19, Greg KH wrote:
> On Sun, Mar 09, 2014 at 04:55:32PM +0100, Harald Albrecht wrote:
>> I would like to improve support for the multimedia controllers from
>> Contour company, as there currently get relative events swalled by input.c.
>>
>> The background: Contour seems to have messed up the USB HID descriptions
>> of their multimedia controller devices in that these report to use
>> relative axis when in fact they are creating EV_REL events with absolute
>> coordinate values. The problem here is, that mapping these events to
>> EV_ABS will break all existing software that supports these devices.
>>
>> Unfortunately, drivers/input/input.c correctly swallows any relative
>> events with a relative movement value of zero...
>>
>> case EV_REL:
>> if (is_event_supported(code, dev->relbit, REL_MAX) && value)
>> disposition = INPUT_PASS_TO_HANDLERS;
>> break;
>>
>> Simply removing the "&& value" would most probably have adverse effect
>> on many software. Unfortunately, there is yet no "quirks" handling
>> present in input.c.
>>
>> How can I add such quirks handling in a way that would be acceptable by
>> the kernel maintainers?
> The people on linux-input@vger.kernel.org (now cc:ed) might know more...
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-03-09 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <531C8EF4.9090609@gmx.net>
2014-03-09 17:19 ` drivers/input/input.c and a broken USB HID Contour ShuttlePRO v2 Greg KH
2014-03-09 17:31 ` Harald Albrecht [this message]
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=531CA588.7030408@gmx.net \
--to=harald.albrecht@gmx.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).