Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1317964 > unrolled thread
| Started by | Jiri Kosina <jikos@kernel.org> |
|---|---|
| First post | 2016-01-26 15:30 +0100 |
| Last post | 2016-01-28 10:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar Jiri Kosina <jikos@kernel.org> - 2016-01-26 15:30 +0100
Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar "Piotr Sawuk" <a9702387@unet.univie.ac.at> - 2016-01-28 00:20 +0100
Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar Jiri Kosina <jikos@kernel.org> - 2016-01-28 10:00 +0100
| From | Jiri Kosina <jikos@kernel.org> |
|---|---|
| Date | 2016-01-26 15:30 +0100 |
| Subject | Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar |
| Message-ID | <qVcN4-5n8-17@gated-at.bofh.it> |
On Sat, 9 Jan 2016, Piotr Sawuk wrote:
> added support for my pid so I can test the changes:
> 3 events were mapped to one, this allows discerning which is which.
> on my mouse there is a button with a 3 colour-led.
> I can now determine in user-space which colour is visible.
> this patch replaces my previous one which merely added rat5-support.
>
> Signed-off-by: Piotr Sawuk <piotr5@users.sf.net>
The patch has been damaged by your mail client, and as such can't be
applied. Could you please fix that up and resend?
> ---
> add support for mad catz r.a.t.5
> add a file in sysfs called "mode" exposing the integer of that name.
>
> diff -rup linux-4.2.6-gentoo/drivers/hid/hid-core.c
> linux-4.2.6-gentoo-rat5/drivers/hid/hid-core.c
> --- linux-4.2.6-gentoo/drivers/hid/hid-core.c 2015-08-30
> 20:34:09.000000000 +0200
> +++ linux-4.2.6-gentoo-rat5/drivers/hid/hid-core.c 2015-12-30
> 12:09:14.340841552 +0100
> @@ -1959,6 +1959,7 @@ static const struct hid_device_id hid_ha
> { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
> { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
> { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
> + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) },
Could you please keep the list sorted (at least by parts)?
> #endif
> { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG,
> USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
> { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG,
> USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
> diff -rup linux-4.2.6-gentoo/drivers/hid/hid-ids.h
> linux-4.2.6-gentoo-rat5/drivers/hid/hid-ids.h
> --- linux-4.2.6-gentoo/drivers/hid/hid-ids.h 2015-08-30
> 20:34:09.000000000 +0200
> +++ linux-4.2.6-gentoo-rat5/drivers/hid/hid-ids.h 2015-12-29
> 18:47:36.756225217 +0100
> @@ -634,6 +634,7 @@
>
> #define USB_VENDOR_ID_MADCATZ 0x0738
> #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
> +#define USB_DEVICE_ID_MADCATZ_RAT5 0x1705
> #define USB_DEVICE_ID_MADCATZ_RAT9 0x1709
>
> #define USB_VENDOR_ID_MCC 0x09db
> diff -rup linux-4.2.6-gentoo/drivers/hid/hid-saitek.c
> linux-4.2.6-gentoo-rat5/drivers/hid/hid-saitek.c
> --- linux-4.2.6-gentoo/drivers/hid/hid-saitek.c 2015-08-30
> 20:34:09.000000000 +0200
> +++ linux-4.2.6-gentoo-rat5/drivers/hid/hid-saitek.c 2016-01-09
> 12:19:19.574905612 +0100
> @@ -7,10 +7,11 @@
> * (This module is based on "hid-ortek".)
> * Copyright (c) 2012 Andreas Hübner
> *
> - * R.A.T.7, R.A.T.9, M.M.O.7 (USB gaming mice):
> + * R.A.T.5, R.A.T.7, R.A.T.9, M.M.O.7 (USB gaming mice):
> * Fixes the mode button which cycles through three constantly pressed
> * buttons. All three press events are mapped to one button and the
> * missing release event is generated immediately.
> + * Original press event is available in "mode" file on sysfs.
> *
> */
>
> @@ -37,6 +38,40 @@ struct saitek_sc {
> int mode;
> };
>
> +static ssize_t show_mode(struct device *dev,
> + struct device_attribute *attr,
> + char *mode_buf);
> +
> +/* world-readable since errors are caught and no usb-interaction needed. */
> +DEVICE_ATTR(mode, 0444, show_mode, NULL);
> +
> +static ssize_t show_mode(struct device *dev,
> + struct device_attribute *attr,
> + char *mode_buf)
> +{
> + struct saitek_sc *ssc;
> + struct hid_device *hdev;
> +
> + /* error-messages in sysfs file since it's non-critical. */
> + if (dev == NULL) {
> + return snprintf(mode_buf, PAGE_SIZE, "No parent.\n");
> + }
> +
> + hdev = container_of(dev, struct hid_device, dev);
You can use to_hid_device() here.
Thanks,
--
Jiri Kosina
SUSE Labs
[toc] | [next] | [standalone]
| From | "Piotr Sawuk" <a9702387@unet.univie.ac.at> |
|---|---|
| Date | 2016-01-28 00:20 +0100 |
| Subject | Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar |
| Message-ID | <qVHxw-2GU-7@gated-at.bofh.it> |
| In reply to | #1317964 |
On Di, 26.01.2016, 15:29, Jiri Kosina wrote: > On Sat, 9 Jan 2016, Piotr Sawuk wrote: > >> Signed-off-by: Piotr Sawuk <piotr5@users.sf.net> > > The patch has been damaged by your mail client, and as such can't be > applied. Could you please fix that up and resend? thanks, I fixed that by an addon to thunderbird. > > > Could you please keep the list sorted (at least by parts)? done. > >> + hdev = container_of(dev, struct hid_device, dev); > > You can use to_hid_device() here. sorry, didn't notice that recent addition. my new patch wont work against older kernel versions though... P
[toc] | [prev] | [next] | [standalone]
| From | Jiri Kosina <jikos@kernel.org> |
|---|---|
| Date | 2016-01-28 10:00 +0100 |
| Subject | Re: [Patch] hid: enhance hid-saitek for use with R.A.T.5 and similar |
| Message-ID | <qVQAP-Qb-19@gated-at.bofh.it> |
| In reply to | #1320128 |
On Thu, 28 Jan 2016, Piotr Sawuk wrote: > >> + hdev = container_of(dev, struct hid_device, dev); > > > > You can use to_hid_device() here. > > sorry, didn't notice that recent addition. > my new patch wont work against older kernel versions though... The only thing that really matters is that it works with the kernel it's being applied to and pushed upstream. If anyone wants to backport it later to some older kernel, as part of a backport he'd have to open-code to_hide_device() ... no big deal. Thanks, -- Jiri Kosina SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web