Skip to contentSkip to conversation

Logitech USB mice/trackball extensions

PATCH In review Eric Wong 5 participants 11 messages Mar 26, 2003 – Mar 27, 2003 1 message not in the archive USB

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 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/

drivers/usb/input/Kconfig +30 -0
diff -ruN a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
@@ -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
 
drivers/usb/input/Makefile +3 -0
diff -ruN a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
@@ -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
drivers/usb/input/hid-core.c +17 -0
diff -ruN a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
@@ -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
+
drivers/usb/input/hid-logitech.c +156 -0

156 lines not on this page · raw message

drivers/usb/input/hid.h +6 -0
diff -ruN a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
@@ -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 **);
Signature · 1 line
Eric Wong
author
#1 lore raw

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

Quoted 15 lines
drivers/usb/input/hid-core.c +15 -0
+/* 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
+
Signature · 1 line
Eric Wong

A message that is not in the archive (sent off-list or not yet received): 20030326030330.GC12549@BL4ST

#3 lore raw
Quoted 1 line · Eric Wong

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

Can you send me an updated patch?

thanks,

greg k-h

author
#4 lore raw
Quoted 4 lines · Greg KH
Quoted 1 line · Eric Wong

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

Can you send me an updated patch?

here ya go

drivers/usb/input/Kconfig +30 -0
diff -ruN a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
@@ -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
 
drivers/usb/input/Makefile +3 -0
diff -ruN a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
@@ -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
drivers/usb/input/hid-core.c +1 -0
diff -ruN a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
@@ -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;
drivers/usb/input/hid-logitech.c +156 -0

156 lines not on this page · raw message

drivers/usb/input/hid.h +6 -0
diff -ruN a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
@@ -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 **);
Signature · 1 line
Eric Wong
#5 lore raw

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

Quoted 5 lines · Eric Wong
Quoted 4 lines · Greg KH
Quoted 1 line · Eric Wong

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-----

#6 lore raw
Quoted 10 lines · Brad Hards
Quoted 5 lines · Eric Wong
Quoted 4 lines · Greg KH
Quoted 1 line · Eric Wong

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

#7 lore raw
In reply to Brad Hards

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

Quoted 5 lines · Brad Hards
Quoted 4 lines · Eric Wong
Quoted 3 lines · Greg KH
Quoted 1 line · Eric Wong

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

Quoted 7 lines
Quoted 1 line
Quoted 1 line

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-----

#10 lore raw
Quoted 4 lines · Eric Wong
Quoted 3 lines · Brad Hards
Quoted 3 lines

Doing it in kernel space with module options is gross. This is clearly a case for userspace.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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

#11 lore raw
In reply to Eric Wong
Quoted 5 lines · Eric Wong

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