2003-03-26 02:17:59

by Eric Wong

[permalink] [raw]
Subject: [PATCH] Logitech USB mice/trackball extensions

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 <[email protected]>
+ *
+ * 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


2003-03-26 03:27:28

by Eric Wong

[permalink] [raw]
Subject: Re: [PATCH] Logitech USB mice/trackball extensions

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

2003-03-26 03:38:15

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] Logitech USB mice/trackball extensions

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

2003-03-26 03:58:42

by Eric Wong

[permalink] [raw]
Subject: Re: [PATCH] Logitech USB mice/trackball extensions

Greg KH <[email protected]> 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 <[email protected]>
+ *
+ * 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

2003-03-26 03:59:49

by Robert Love

[permalink] [raw]
Subject: Re: [PATCH] Logitech USB mice/trackball extensions

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

2003-03-26 05:59:13

by Brad Hards

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

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

On Wed, 26 Mar 2003 15:09, Eric Wong wrote:
> Greg KH <[email protected]> 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-----

2003-03-26 06:14:57

by Greg KH

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

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 <[email protected]> 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

2003-03-26 06:32:52

by Brad Hards

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

-----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 <[email protected]> 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-----

2003-03-26 18:30:40

by Josh McKinney

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

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?

2003-03-27 06:52:51

by Eric Wong

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

Brad Hards <[email protected]> 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

2003-03-27 08:12:22

by Josh McKinney

[permalink] [raw]
Subject: Re: [linux-usb-devel] Re: [PATCH] Logitech USB mice/trackball extensions

On approximately Wed, Mar 26, 2003 at 11:03:01PM -0800, Eric Wong wrote:
> Brad Hards <[email protected]> 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