All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Logitech USB mice/trackball extensions
@ 2003-03-26  2:29 Eric Wong
  2003-03-26  3:35 ` Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Eric Wong @ 2003-03-26  2:29 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb-devel, linux-kernel

This patch adds support for controlling 400/800 cpi resolution and
SMS/Smart Scroll/Cruise control for certain Logitech mice.  Disabling
SMS lets you use the extra buttons on MX500/700 as regular buttons if
an application supports evdev since ExpPS/2 doesn't support all the
buttons.

For XFree86, there are some patches (not mine) to support evdev here: 
http://people.debian.org/~warp/evdev/

diff -ruN a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
--- a/drivers/usb/input/Kconfig	2003-03-17 13:44:22.000000000 -0800
+++ b/drivers/usb/input/Kconfig	2003-03-24 20:06:26.000000000 -0800
@@ -90,6 +90,36 @@
 
 	  If unsure, say Y.
 
+config USB_HIDLOGITECH
+ 	bool "Logitech HID extensions"
+ 	default n
+ 	depends on USB_HID
+ 	help
+ 	  Say Y here will enable control of Logitech specific extensions
+ 
+	  module parameter: 'hid_logitech_sms' type: boolean
+	  
+	  Toggle simulated scrolling with the Smart Scroll / Cruise Control
+ 	  buttons (7 and 8) on the following Logitech devices: 
+ 	  - MX500 Optical Mouse
+ 	  - Receiver for Cordless Elite Duo
+ 	  - Receiver for MX700 Optical Mouse
+ 	  - Receiver for Cordless Optical TrackMan
+
+  	  default: 1 (Smart Scroll / Cruise Control enabled)
+ 
+	  module parameter: 'hid_logitech_res' type: boolean
+	  Toggle 400 / 800 cpi (characters per inch) resolution on Logitech
+ 	  devices that support it:
+ 	  - Wheel Mouse Optical
+ 	  - MouseMan Traveler
+ 	  - MouseMan Dual Optical
+ 	  - MX300 Optical Mouse
+ 	  - MX500 Optical Mouse
+ 	  - iFeel Mouse (silver)
+	  
+ 	  default: 0 (400 cpi)
+
 menu "USB HID Boot Protocol drivers"
 	depends on USB!=n && USB_HID!=y
 
diff -ruN a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
--- a/drivers/usb/input/Makefile	2003-03-17 13:44:11.000000000 -0800
+++ b/drivers/usb/input/Makefile	2003-03-24 20:06:26.000000000 -0800
@@ -25,6 +25,9 @@
 ifeq ($(CONFIG_HID_FF),y)
 	hid-objs	+= hid-ff.o
 endif
+ifeq ($(CONFIG_USB_HIDLOGITECH),y)
+	hid-objs	+= hid-logitech.o
+endif
 
 obj-$(CONFIG_USB_AIPTEK)	+= aiptek.o
 obj-$(CONFIG_USB_HID)		+= hid.o
diff -ruN a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2003-03-24 19:22:13.000000000 -0800
+++ b/drivers/usb/input/hid-core.c	2003-03-25 18:05:48.000000000 -0800
@@ -1610,6 +1610,7 @@
 	hid_dump_device(hid);
 
 	hid_ff_init(hid);
+	hid_logitech_extras(hid);
 
 	if (!hidinput_connect(hid))
 		hid->claimed |= HID_CLAIMED_INPUT;
@@ -1687,3 +1688,19 @@
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE(DRIVER_LICENSE);
+
+/* Module parameters */
+MODULE_PARM(hid_poll_interval, "i");
+MODULE_PARM_DESC(hid_poll_interval, "polling interval, millseconds (default=10)");
+
+#ifndef MODULE
+static int __init hid_poll_interval_setup(char *str)
+{
+	get_option(&str,&hid_poll_interval);
+	return 1;
+}
+
+__setup("hid_poll_interval=", hid_poll_interval_setup);
+
+#endif
+
diff -ruN a/drivers/usb/input/hid-logitech.c b/drivers/usb/input/hid-logitech.c
--- a/drivers/usb/input/hid-logitech.c	1969-12-31 16:00:00.000000000 -0800
+++ b/drivers/usb/input/hid-logitech.c	2003-03-25 18:11:16.000000000 -0800
@@ -0,0 +1,156 @@
+/*
+ *  Copyright (c) 2003 Eric Wong <eric@yhbt.net>
+ *
+ *  Logitech extensions for HID devices
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/input.h>
+#include <linux/usb.h>
+#include "hid.h"
+
+/* 
+ * Logitech USB extra features 
+ */
+
+#define HID_QUIRK_LOGI_HIRES	0x01
+#define HID_QUIRK_LOGI_SMS	0x02
+
+#if 0
+#define HID_QUIRK_LOGI_CSR	0x04 /* not implemented */
+#endif
+
+/*
+ * RES - Resolution switching between 400 cpi and 800 cpi
+ *                type  req  value  index  length   
+ * Set 400 cpi    40    02   0E 00  03 00  00 00  
+ * Set 800 cpi    40    02   0E 00  04 00  00 00  
+ * Get resolution C0    01   0E 00  00 00  01 00 
+ * 	returns: 03 for 400 cpi or 04 for 800 cpi
+ *
+ * SMS - Smart Scroll / Cruise Control
+ *                type  req  value  index  length   
+ * Enable SMS     40    02   17 00  01 00  00 00  
+ * Disable SMS    40    02   17 00  00 00  00 00  
+ * Get SMS mode   C0    01   17 00  00 00  01 00 
+ * 	returns: 00 for disabled, 01 for enabled
+ */
+
+#define USB_VENDOR_ID_LOGITECH		0x046d
+
+/* mice */
+#define USB_DEVICE_ID_LOGITECH_WMOPT	0xc00e	/* Wheel Mouse Optical */
+#define USB_DEVICE_ID_LOGITECH_MMTRAV	0xc00f	/* MouseMan Traveler */
+#define USB_DEVICE_ID_LOGITECH_MMDUAL	0xc012	/* MouseMan Dual Optical */
+#define USB_DEVICE_ID_LOGITECH_MX300	0xc024	/* MX300 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_MX500	0xc025	/* MX500 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_IFEEL	0xc031	/* iFeel Mouse (silver) */
+
+/* receivers for cordless devices */
+#define USB_DEVICE_ID_LOGITECH_CEDUO	0xc505	/* Cordless Elite Duo */
+#define USB_DEVICE_ID_LOGITECH_MX700	0xc506	/* MX700 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_COTRACK	0xc508	/* Cordless Optical TrackMan */
+
+/*
+ * keep this separate from the main hid-core.c blacklist to avoid bloating the
+ * code for people who don't use these Logitech products.  This isn't a
+ * blacklist, it's a whitelist :)
+ */
+
+struct hid_logitech_quirklist {
+	__u16 idVendor;
+	__u16 idProduct;
+	unsigned features;
+} hid_logitech_quirklist[] = { 
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WMOPT,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MMTRAV,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MMDUAL,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX300,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_IFEEL,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX500,
+		HID_QUIRK_LOGI_HIRES | HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CEDUO,
+		HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX700,
+		HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_COTRACK,
+		HID_QUIRK_LOGI_SMS },
+	{ 0, 0 }
+};
+	
+/* 
+ * Logitech SMS and RES
+ * these are the logitech defaults for dpi and smart scrolling 
+ * I don't like them, but they're the defaults. Also why I made this patch
+ */
+
+#define HID_LOGITECH_RES	0
+#define HID_LOGITECH_SMS	1
+
+static int hid_logitech_res = HID_LOGITECH_RES;
+static int hid_logitech_sms = HID_LOGITECH_SMS;
+
+void hid_logitech_extras (struct hid_device *hid) 
+{
+	unsigned features = 0;
+	int n;
+	for (n = 0; hid_logitech_quirklist[n].idVendor; ++n)
+		if ((hid_logitech_quirklist[n].idVendor == hid->dev->descriptor.idVendor) &&
+			(hid_logitech_quirklist[n].idProduct == hid->dev->descriptor.idProduct))
+				features = hid_logitech_quirklist[n].features;
+
+	if ( (features & HID_QUIRK_LOGI_SMS) && !hid_logitech_sms ) 
+		/* disable sms */
+	        usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x0017, 0x0000, NULL, 0, HZ);
+	else if ( (features & HID_QUIRK_LOGI_SMS) && hid_logitech_sms ) 
+		/* enable sms */
+	        usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x0017, 0x0001, NULL, 0, HZ);
+
+	if ( (features & HID_QUIRK_LOGI_HIRES) && hid_logitech_res ) 
+		/* 800 cpi resolution */
+	        usb_control_msg(hid->dev,usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x000e, 0x0004, NULL, 0, HZ);
+	else if ( (features & HID_QUIRK_LOGI_HIRES) && !hid_logitech_res ) 
+		/* 400 cpi resolution */
+	        usb_control_msg(hid->dev,usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x000e, 0x0003, NULL, 0, HZ);
+}
+
+MODULE_PARM(hid_logitech_res, "i");
+MODULE_PARM_DESC(hid_logitech_res, "resolution, 1 = 800cpi | 0 = 400cpi (default)");
+MODULE_PARM(hid_logitech_sms, "i");
+MODULE_PARM_DESC(hid_logitech_sms, "auto-repeat, 1 = enabled (default) | 0 = disabled");
+
+#ifndef MODULE
+static int __init hid_logitech_res_setup(char *str)
+{
+	get_option(&str,&hid_logitech_res);
+	return 1;
+}
+
+static int __init hid_logitech_sms_setup(char *str)
+{
+	get_option(&str,&hid_logitech_sms);
+	return 1;
+}
+__setup("hid_logitech_res=", hid_logitech_res_setup);
+__setup("hid_logitech_sms=", hid_logitech_sms_setup);
+#endif
+
diff -ruN a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	2003-03-17 13:43:37.000000000 -0800
+++ b/drivers/usb/input/hid.h	2003-03-24 20:06:26.000000000 -0800
@@ -432,6 +432,12 @@
 static inline void hidinput_disconnect(struct hid_device *hid) { }
 #endif
 
+#ifdef CONFIG_USB_HIDLOGITECH
+extern void hid_logitech_extras (struct hid_device *);
+#else
+static inline void hid_logitech_extras (struct hid_device *hid) { }
+#endif 
+
 int hid_open(struct hid_device *);
 void hid_close(struct hid_device *);
 int hid_find_field(struct hid_device *, unsigned int, unsigned int, struct hid_field **);



-- 
Eric Wong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  2:29 [PATCH] Logitech USB mice/trackball extensions Eric Wong
@ 2003-03-26  3:35 ` Eric Wong
       [not found] ` <20030326030330.GC12549@BL4ST>
  2003-03-26  4:10 ` Robert Love
  2 siblings, 0 replies; 11+ messages in thread
From: Eric Wong @ 2003-03-26  3:35 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

Oops, ignore this part, it's part of a separate patch :)

> +/* Module parameters */
> +MODULE_PARM(hid_poll_interval, "i");
> +MODULE_PARM_DESC(hid_poll_interval, "polling interval, millseconds (default=10)");
> +
> +#ifndef MODULE
> +static int __init hid_poll_interval_setup(char *str)
> +{
> +	get_option(&str,&hid_poll_interval);
> +	return 1;
> +}
> +
> +__setup("hid_poll_interval=", hid_poll_interval_setup);
> +
> +#endif
> +

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Logitech USB mice/trackball extensions
       [not found] ` <20030326030330.GC12549@BL4ST>
@ 2003-03-26  3:48   ` Greg KH
  2003-03-26  4:09     ` Eric Wong
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2003-03-26  3:48 UTC (permalink / raw)
  To: Eric Wong; +Cc: linux-usb-devel, linux-kernel

On Tue, Mar 25, 2003 at 07:03:30PM -0800, Eric Wong wrote:
> Oops, ignore this part, it's part of a separate patch :)

Can you send me an updated patch?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  3:48   ` Greg KH
@ 2003-03-26  4:09     ` Eric Wong
  2003-03-26  5:54       ` [linux-usb-devel] " Brad Hards
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Wong @ 2003-03-26  4:09 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb-devel, linux-kernel

Greg KH <greg@kroah.com> wrote:
> On Tue, Mar 25, 2003 at 07:03:30PM -0800, Eric Wong wrote:
> > Oops, ignore this part, it's part of a separate patch :)
> 
> Can you send me an updated patch?

here ya go

diff -ruN a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
--- a/drivers/usb/input/Kconfig	2003-03-17 13:44:22.000000000 -0800
+++ b/drivers/usb/input/Kconfig	2003-03-25 20:04:54.000000000 -0800
@@ -90,6 +90,36 @@
 
 	  If unsure, say Y.
 
+config USB_HIDLOGITECH
+ 	bool "Logitech HID extensions"
+ 	default n
+ 	depends on USB_HID
+ 	help
+ 	  Say Y here will enable control of Logitech specific extensions
+ 
+	  module parameter: 'hid_logitech_sms' type: boolean
+	  
+	  Toggle simulated scrolling with the Smart Scroll / Cruise Control
+ 	  buttons (7 and 8) on the following Logitech devices: 
+ 	  - MX500 Optical Mouse
+ 	  - Receiver for Cordless Elite Duo
+ 	  - Receiver for MX700 Optical Mouse
+ 	  - Receiver for Cordless Optical TrackMan
+
+  	  default: 1 (Smart Scroll / Cruise Control enabled)
+ 
+	  module parameter: 'hid_logitech_res' type: boolean
+	  Toggle 400 / 800 cpi (characters per inch) resolution on Logitech
+ 	  devices that support it:
+ 	  - Wheel Mouse Optical
+ 	  - MouseMan Traveler
+ 	  - MouseMan Dual Optical
+ 	  - MX300 Optical Mouse
+ 	  - MX500 Optical Mouse
+ 	  - iFeel Mouse (silver)
+	  
+ 	  default: 0 (400 cpi)
+
 menu "USB HID Boot Protocol drivers"
 	depends on USB!=n && USB_HID!=y
 
diff -ruN a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
--- a/drivers/usb/input/Makefile	2003-03-17 13:44:11.000000000 -0800
+++ b/drivers/usb/input/Makefile	2003-03-25 20:04:54.000000000 -0800
@@ -25,6 +25,9 @@
 ifeq ($(CONFIG_HID_FF),y)
 	hid-objs	+= hid-ff.o
 endif
+ifeq ($(CONFIG_USB_HIDLOGITECH),y)
+	hid-objs	+= hid-logitech.o
+endif
 
 obj-$(CONFIG_USB_AIPTEK)	+= aiptek.o
 obj-$(CONFIG_USB_HID)		+= hid.o
diff -ruN a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2003-03-24 19:22:13.000000000 -0800
+++ b/drivers/usb/input/hid-core.c	2003-03-25 20:05:21.000000000 -0800
@@ -1610,6 +1610,7 @@
 	hid_dump_device(hid);
 
 	hid_ff_init(hid);
+	hid_logitech_extras(hid);
 
 	if (!hidinput_connect(hid))
 		hid->claimed |= HID_CLAIMED_INPUT;
diff -ruN a/drivers/usb/input/hid-logitech.c b/drivers/usb/input/hid-logitech.c
--- a/drivers/usb/input/hid-logitech.c	1969-12-31 16:00:00.000000000 -0800
+++ b/drivers/usb/input/hid-logitech.c	2003-03-25 20:04:54.000000000 -0800
@@ -0,0 +1,156 @@
+/*
+ *  Copyright (c) 2003 Eric Wong <eric@yhbt.net>
+ *
+ *  Logitech extensions for HID devices
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/input.h>
+#include <linux/usb.h>
+#include "hid.h"
+
+/* 
+ * Logitech USB extra features 
+ */
+
+#define HID_QUIRK_LOGI_HIRES	0x01
+#define HID_QUIRK_LOGI_SMS	0x02
+
+#if 0
+#define HID_QUIRK_LOGI_CSR	0x04 /* not implemented */
+#endif
+
+/*
+ * RES - Resolution switching between 400 cpi and 800 cpi
+ *                type  req  value  index  length   
+ * Set 400 cpi    40    02   0E 00  03 00  00 00  
+ * Set 800 cpi    40    02   0E 00  04 00  00 00  
+ * Get resolution C0    01   0E 00  00 00  01 00 
+ * 	returns: 03 for 400 cpi or 04 for 800 cpi
+ *
+ * SMS - Smart Scroll / Cruise Control
+ *                type  req  value  index  length   
+ * Enable SMS     40    02   17 00  01 00  00 00  
+ * Disable SMS    40    02   17 00  00 00  00 00  
+ * Get SMS mode   C0    01   17 00  00 00  01 00 
+ * 	returns: 00 for disabled, 01 for enabled
+ */
+
+#define USB_VENDOR_ID_LOGITECH		0x046d
+
+/* mice */
+#define USB_DEVICE_ID_LOGITECH_WMOPT	0xc00e	/* Wheel Mouse Optical */
+#define USB_DEVICE_ID_LOGITECH_MMTRAV	0xc00f	/* MouseMan Traveler */
+#define USB_DEVICE_ID_LOGITECH_MMDUAL	0xc012	/* MouseMan Dual Optical */
+#define USB_DEVICE_ID_LOGITECH_MX300	0xc024	/* MX300 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_MX500	0xc025	/* MX500 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_IFEEL	0xc031	/* iFeel Mouse (silver) */
+
+/* receivers for cordless devices */
+#define USB_DEVICE_ID_LOGITECH_CEDUO	0xc505	/* Cordless Elite Duo */
+#define USB_DEVICE_ID_LOGITECH_MX700	0xc506	/* MX700 Optical Mouse */
+#define USB_DEVICE_ID_LOGITECH_COTRACK	0xc508	/* Cordless Optical TrackMan */
+
+/*
+ * keep this separate from the main hid-core.c blacklist to avoid bloating the
+ * code for people who don't use these Logitech products.  This isn't a
+ * blacklist, it's a whitelist :)
+ */
+
+struct hid_logitech_quirklist {
+	__u16 idVendor;
+	__u16 idProduct;
+	unsigned features;
+} hid_logitech_quirklist[] = { 
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WMOPT,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MMTRAV,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MMDUAL,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX300,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_IFEEL,
+		HID_QUIRK_LOGI_HIRES },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX500,
+		HID_QUIRK_LOGI_HIRES | HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CEDUO,
+		HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MX700,
+		HID_QUIRK_LOGI_SMS },
+	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_COTRACK,
+		HID_QUIRK_LOGI_SMS },
+	{ 0, 0 }
+};
+	
+/* 
+ * Logitech SMS and RES
+ * these are the logitech defaults for dpi and smart scrolling 
+ * I don't like them, but they're the defaults. Also why I made this patch
+ */
+
+#define HID_LOGITECH_RES	0
+#define HID_LOGITECH_SMS	1
+
+static int hid_logitech_res = HID_LOGITECH_RES;
+static int hid_logitech_sms = HID_LOGITECH_SMS;
+
+void hid_logitech_extras (struct hid_device *hid) 
+{
+	unsigned features = 0;
+	int n;
+	for (n = 0; hid_logitech_quirklist[n].idVendor; ++n)
+		if ((hid_logitech_quirklist[n].idVendor == hid->dev->descriptor.idVendor) &&
+			(hid_logitech_quirklist[n].idProduct == hid->dev->descriptor.idProduct))
+				features = hid_logitech_quirklist[n].features;
+
+	if ( (features & HID_QUIRK_LOGI_SMS) && !hid_logitech_sms ) 
+		/* disable sms */
+	        usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x0017, 0x0000, NULL, 0, HZ);
+	else if ( (features & HID_QUIRK_LOGI_SMS) && hid_logitech_sms ) 
+		/* enable sms */
+	        usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x0017, 0x0001, NULL, 0, HZ);
+
+	if ( (features & HID_QUIRK_LOGI_HIRES) && hid_logitech_res ) 
+		/* 800 cpi resolution */
+	        usb_control_msg(hid->dev,usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x000e, 0x0004, NULL, 0, HZ);
+	else if ( (features & HID_QUIRK_LOGI_HIRES) && !hid_logitech_res ) 
+		/* 400 cpi resolution */
+	        usb_control_msg(hid->dev,usb_sndctrlpipe(hid->dev, 0),
+				0x02, 0x40, 0x000e, 0x0003, NULL, 0, HZ);
+}
+
+MODULE_PARM(hid_logitech_res, "i");
+MODULE_PARM_DESC(hid_logitech_res, "resolution, 1 = 800cpi | 0 = 400cpi (default)");
+MODULE_PARM(hid_logitech_sms, "i");
+MODULE_PARM_DESC(hid_logitech_sms, "auto-repeat, 1 = enabled (default) | 0 = disabled");
+
+#ifndef MODULE
+static int __init hid_logitech_res_setup(char *str)
+{
+	get_option(&str,&hid_logitech_res);
+	return 1;
+}
+
+static int __init hid_logitech_sms_setup(char *str)
+{
+	get_option(&str,&hid_logitech_sms);
+	return 1;
+}
+__setup("hid_logitech_res=", hid_logitech_res_setup);
+__setup("hid_logitech_sms=", hid_logitech_sms_setup);
+#endif
+
diff -ruN a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	2003-03-17 13:43:37.000000000 -0800
+++ b/drivers/usb/input/hid.h	2003-03-25 20:04:54.000000000 -0800
@@ -432,6 +432,12 @@
 static inline void hidinput_disconnect(struct hid_device *hid) { }
 #endif
 
+#ifdef CONFIG_USB_HIDLOGITECH
+extern void hid_logitech_extras (struct hid_device *);
+#else
+static inline void hid_logitech_extras (struct hid_device *hid) { }
+#endif 
+
 int hid_open(struct hid_device *);
 void hid_close(struct hid_device *);
 int hid_find_field(struct hid_device *, unsigned int, unsigned int, struct hid_field **);

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  2:29 [PATCH] Logitech USB mice/trackball extensions Eric Wong
  2003-03-26  3:35 ` Eric Wong
       [not found] ` <20030326030330.GC12549@BL4ST>
@ 2003-03-26  4:10 ` Robert Love
  2 siblings, 0 replies; 11+ messages in thread
From: Robert Love @ 2003-03-26  4:10 UTC (permalink / raw)
  To: Eric Wong; +Cc: Greg KH, linux-usb-devel, linux-kernel

On Tue, 2003-03-25 at 21:29, Eric Wong wrote:
> This patch adds support for controlling 400/800 cpi resolution and
> SMS/Smart Scroll/Cruise control for certain Logitech mice.  Disabling
> SMS lets you use the extra buttons on MX500/700 as regular buttons if
> an application supports evdev since ExpPS/2 doesn't support all the
> buttons.

Cool :)

For those of us not using modules, any chance of making these available
via some runtime mechanism (sysfs, perhaps)?

Also, have you looked into what it takes to read the battery from either
the wireless mouseman or the MX700?  I recently ditched my MX700 for an
MX500, as the battery life was awful after a few months... but I think
it would be a nice feature nonetheless.

Good work,

	Robert Love


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  4:09     ` Eric Wong
@ 2003-03-26  5:54       ` Brad Hards
  2003-03-26  6:25         ` Greg KH
  2003-03-26  6:27         ` Brad Hards
  0 siblings, 2 replies; 11+ messages in thread
From: Brad Hards @ 2003-03-26  5:54 UTC (permalink / raw)
  To: Eric Wong, Greg KH; +Cc: linux-usb-devel, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 26 Mar 2003 15:09, Eric Wong wrote:
> Greg KH <greg@kroah.com> wrote:
> > On Tue, Mar 25, 2003 at 07:03:30PM -0800, Eric Wong wrote:
> > > Oops, ignore this part, it's part of a separate patch :)
> >
> > Can you send me an updated patch?
Doing it in kernel space with module options is gross. This is clearly a case 
for userspace.

See: http://www.linmagau.org/modules.php?name=Sections&op=viewarticle&artid=40

Brad

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+gUCAW6pHgIdAuOMRAq3GAKCOMCH9x+n9pIiezYfy1wkubYW7/gCeIY6O
b9/lNmg7lOOEsG6EQhbW3KY=
=1q8A
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  5:54       ` [linux-usb-devel] " Brad Hards
@ 2003-03-26  6:25         ` Greg KH
  2003-03-26  6:27         ` Brad Hards
  1 sibling, 0 replies; 11+ messages in thread
From: Greg KH @ 2003-03-26  6:25 UTC (permalink / raw)
  To: Brad Hards; +Cc: Eric Wong, linux-usb-devel, linux-kernel

On Wed, Mar 26, 2003 at 04:54:08PM +1100, Brad Hards wrote:
> On Wed, 26 Mar 2003 15:09, Eric Wong wrote:
> > Greg KH <greg@kroah.com> wrote:
> > > On Tue, Mar 25, 2003 at 07:03:30PM -0800, Eric Wong wrote:
> > > > Oops, ignore this part, it's part of a separate patch :)
> > >
> > > Can you send me an updated patch?
> Doing it in kernel space with module options is gross. This is clearly a case 
> for userspace.
> 
> See: http://www.linmagau.org/modules.php?name=Sections&op=viewarticle&artid=40

Sweet, nice job.

Sorry, Eric, I'll not apply this patch, as the userspace implementation
makes much more sense.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  5:54       ` [linux-usb-devel] " Brad Hards
  2003-03-26  6:25         ` Greg KH
@ 2003-03-26  6:27         ` Brad Hards
  2003-03-26 18:41           ` Josh McKinney
  2003-03-27  7:03           ` Eric Wong
  1 sibling, 2 replies; 11+ messages in thread
From: Brad Hards @ 2003-03-26  6:27 UTC (permalink / raw)
  To: Eric Wong, Greg KH; +Cc: linux-usb-devel, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 26 Mar 2003 16:54, Brad Hards wrote:
> On Wed, 26 Mar 2003 15:09, Eric Wong wrote:
> > Greg KH <greg@kroah.com> wrote:
> > > On Tue, Mar 25, 2003 at 07:03:30PM -0800, Eric Wong wrote:
> > > > Oops, ignore this part, it's part of a separate patch :)
> > >
> > > Can you send me an updated patch?
>
> Doing it in kernel space with module options is gross. This is clearly a
> case for userspace.
>
> See:
> http://www.linmagau.org/modules.php?name=Sections&op=viewarticle&artid=40

And for those who actually want the code:
http://www.frogmouth.net/logitech-applet-0.2.tar.gz

Brad
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+gUhjW6pHgIdAuOMRAhEBAKCnueBPDc6bL3m7dNZlq/n/NujTlACffk49
69KrT5znLIvHsjPyl+nGItc=
=ypcY
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  6:27         ` Brad Hards
@ 2003-03-26 18:41           ` Josh McKinney
  2003-03-27  7:03           ` Eric Wong
  1 sibling, 0 replies; 11+ messages in thread
From: Josh McKinney @ 2003-03-26 18:41 UTC (permalink / raw)
  To: linux-kernel

On approximately Wed, Mar 26, 2003 at 05:27:47PM +1100, Brad Hards wrote:
> 
> And for those who actually want the code:
> http://www.frogmouth.net/logitech-applet-0.2.tar.gz
> 
> Brad
> 

HTTP 404 - File not found
Internet Information Services

Microsoft?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-26  6:27         ` Brad Hards
  2003-03-26 18:41           ` Josh McKinney
@ 2003-03-27  7:03           ` Eric Wong
  2003-03-27  8:23             ` Josh McKinney
  1 sibling, 1 reply; 11+ messages in thread
From: Eric Wong @ 2003-03-27  7:03 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

Brad Hards <bhards@bigpond.net.au> wrote:
> > Doing it in kernel space with module options is gross. This is clearly a
> > case for userspace.
> >
> > See:
> > http://www.linmagau.org/modules.php?name=Sections&op=viewarticle&artid=40
> 
> And for those who actually want the code:
> http://www.frogmouth.net/logitech-applet-0.2.tar.gz

Cool, works great!

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions
  2003-03-27  7:03           ` Eric Wong
@ 2003-03-27  8:23             ` Josh McKinney
  0 siblings, 0 replies; 11+ messages in thread
From: Josh McKinney @ 2003-03-27  8:23 UTC (permalink / raw)
  To: linux-kernel

On approximately Wed, Mar 26, 2003 at 11:03:01PM -0800, Eric Wong wrote:
> Brad Hards <bhards@bigpond.net.au> wrote:
> > > Doing it in kernel space with module options is gross. This is clearly a
> > > case for userspace.
> > >
> > > See:
> > > http://www.linmagau.org/modules.php?name=Sections&op=viewarticle&artid=40
> > 
> > And for those who actually want the code:
> > http://www.frogmouth.net/logitech-applet-0.2.tar.gz
> 
> Cool, works great!
> 

Ok, the file is there now.  Thanks.  One question though, is this expected
behavior from the MX700?

 $ ./logitech_applet 
001/002     046D/C506   C-BF16-MSE      MX700 Optical Mouse
Error getting cruise control setting from device : error sending control
message: Broken pipe   Cruise Control / Smart Scroll: 8 (Unexpected result)
Unexpected cruise value : 8
   Result: 8
   P6  = 20
   P0  = 3d
   P4  = 8b
   P5  = 4d Channel 2    Battery: 5
   P8  = d7
   P9  = f
   PB0 = 1
   PB1 = ee Two channel   800cpi support   No Horizontal Roller   Vertical
   Roller   8 buttons 

I assume this is because of the MX700 firmware bugs.  Other than that it does
what it is supposed to.

Josh

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-03-27  8:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-26  2:29 [PATCH] Logitech USB mice/trackball extensions Eric Wong
2003-03-26  3:35 ` Eric Wong
     [not found] ` <20030326030330.GC12549@BL4ST>
2003-03-26  3:48   ` Greg KH
2003-03-26  4:09     ` Eric Wong
2003-03-26  5:54       ` [linux-usb-devel] " Brad Hards
2003-03-26  6:25         ` Greg KH
2003-03-26  6:27         ` Brad Hards
2003-03-26 18:41           ` Josh McKinney
2003-03-27  7:03           ` Eric Wong
2003-03-27  8:23             ` Josh McKinney
2003-03-26  4:10 ` Robert Love

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.