Skip to contentSkip to conversation

R.A.T.5 also works with hid-saitek

PATCH In review Piotr Sawuk 2 participants 3 messages Dec 30, 2015 – Jan 9, 2016 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 R.A.T.5 also works with hid-saitek

sorry for the old kernel. tell me if it failed to apply.

and I have a question, since I know nothing of linux-programming:
in include/linux/hidraw.h there is a struct hidraw defined. obviously one of these is assigned to each device.
also hid-saitek.c uses that and stores its data inside. more exactly in ->hid->dev->mode is a value I'd like to read. what is the proper way to do that? is it possible from userspace? hid-saitek module removes information on what colour the mode-LED has. that information is stored in the mode variable of struct saitec_sc. since that struct is only defined in the c-sources, I have a problem? would it be sufficient to move that definition into include/? any suggestions on where to?

P

---
add support for mad catz r.a.t.5

drivers/hid/hid-core.c +1 -0
diff -rup linux-4.2.6-gentoo/drivers/hid/hid-core.c linux-4.2.6-gentoo-rat5/drivers/hid/hid-core.c
@@ -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) },
 #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) },
drivers/hid/hid-ids.h +1 -0
diff -rup linux-4.2.6-gentoo/drivers/hid/hid-ids.h linux-4.2.6-gentoo-rat5/drivers/hid/hid-ids.h
@@ -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
drivers/hid/hid-saitek.c +2 -0
diff -rup linux-4.2.6-gentoo/drivers/hid/hid-saitek.c linux-4.2.6-gentoo-rat5/drivers/hid/hid-saitek.c
@@ -181,6 +181,8 @@ static const struct hid_device_id saitek
 		.driver_data = SAITEK_RELEASE_MODE_RAT7 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
 		.driver_data = SAITEK_RELEASE_MODE_RAT7 },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5),
+		.driver_data = SAITEK_RELEASE_MODE_RAT7 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
 		.driver_data = SAITEK_RELEASE_MODE_RAT7 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7),
drivers/hid/Kconfig +1 -0
diff -rup linux-4.2.6-gentoo/drivers/hid/Kconfig linux-4.2.6-gentoo-rat5/drivers/hid/Kconfig
@@ -665,6 +665,7 @@ config HID_SAITEK
 
 	Supported devices:
 	- PS1000 Dual Analog Pad
+	- R.A.T.5 Gaming Mouse
 	- R.A.T.9 Gaming Mouse
 	- R.A.T.7 Gaming Mouse
 	- M.M.O.7 Gaming Mouse
#1 lore raw
Quoted 1 line · Piotr Sawuk

sorry for the old kernel. tell me if it failed to apply.

You should send your patch to the appropriate maintainers (use the get_maintainer.pl script) and your patch should be inline (not an attachment). See documentation/SubmittingPatches for more information.

Quoted 13 lines

and I have a question, since I know nothing of linux-programming:
in include/linux/hidraw.h there is a struct hidraw defined.
obviously one of these is assigned to each device.
also hid-saitek.c uses that and stores its data inside.
more exactly in ->hid->dev->mode is a value I'd like to read.
From what I read, it uses the driver data pointer from the hid_device structure. As its name imply, it is a way for a driver to attach some data to a device for internal use (only the driver knows its meaning). what is the proper way to do that? is it possible from userspace?
hid-saitek module removes information on what colour the mode-LED has.
that information is stored in the mode variable of struct saitec_sc.
since that struct is only defined in the c-sources, I have a problem?
would it be sufficient to move that definition into include/?
any suggestions on where to?

You can add a sysfs attribute to expose the value to userspace, you should find plenty of example code around.

If you have more questions, I suggest you send them to the kernelnewbies mailing list, you may get more help there.

Quoted 2 lines

P

#2 lore raw

Am 03.01.2016 um 11:45 schrieb Clément Vuchener:

Quoted 7 lines · Piotr Sawuk
Quoted 1 line

sorry for the old kernel. tell me if it failed to apply.

You should send your patch to the appropriate maintainers (use the get_maintainer.pl script) and your patch should be inline (not an attachment). See documentation/SubmittingPatches for more information.

You can add a sysfs attribute to expose the value to userspace, you should find plenty of example code around.

If you have more questions, I suggest you send them to the kernelnewbies mailing list, you may get more help there.

many thanks, your answer was sufficient.
take a look at my new patch replacing this one...

P
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html