Skip to contentSkip to conversation

updated hdaps driver.

PATCH New Greg KH 2 participants 2 messages Sep 12, 2005 – Sep 14, 2005 Hardware monitoring

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 updated hdaps driver.

[PATCH] updated hdaps driver.

Driver for the IBM Hard Drive Active Protection System (HDAPS), an accelerometer found in most modern ThinkPads.

---
commit 860e1d6b46bd4cbc67d8d065f0f682143513382f
tree 704018339937594b5242d1e153752e0749fec6b9
parent 5dce225bd9ea60e28e17076de63df0dee51b2883
author Robert Love <[email protected]> Wed, 31 Aug 2005 23:57:59 -0400 committer Greg Kroah-Hartman <[email protected]> Fri, 09 Sep 2005 14:23:07 -0700

 MAINTAINERS            |    7 
 drivers/hwmon/Kconfig  |   17 +
 drivers/hwmon/Makefile |    1 
 drivers/hwmon/hdaps.c  |  739 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 764 insertions(+), 0 deletions(-)
MAINTAINERS +7 -0
@@ -951,6 +951,13 @@ L:	[email protected]
 W:	http://www.lm-sensors.nu/
 S:	Maintained
 
+HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
+P:	Robert Love
+M:	[email protected]
+M:	[email protected]
+W:	http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/
+S:	Maintained
+
 HARMONY SOUND DRIVER
 P:	Kyle McMartin
 M:	[email protected]
drivers/hwmon/Kconfig +17 -0
@@ -411,6 +411,23 @@ config SENSORS_W83627EHF
 	  This driver can also be built as a module.  If so, the module
 	  will be called w83627ehf.
 
+config SENSORS_HDAPS
+	tristate "IBM Hard Drive Active Protection System (hdaps)"
+	depends on HWMON && INPUT && X86
+	default n
+	help
+	  This driver provides support for the IBM Hard Drive Active Protection
+	  System (hdaps), which provides an accelerometer and other misc. data.
+	  Supported laptops include the IBM ThinkPad T41, T42, T43, and R51.
+	  The accelerometer data is readable via sysfs.
+
+	  This driver also provides an input class device, allowing the
+	  laptop to act as a pinball machine-esque mouse.  This is off by
+	  default but enabled via sysfs or the module parameter "mousedev".
+
+	  Say Y here if you have an applicable laptop and want to experience
+	  the awesome power of hdaps.
+
 config HWMON_DEBUG_CHIP
 	bool "Hardware Monitoring Chip debugging messages"
 	depends on HWMON
drivers/hwmon/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
 obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
+obj-$(CONFIG_SENSORS_HDAPS)	+= hdaps.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_LM63)	+= lm63.o
 obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
drivers/hwmon/hdaps.c new file +739 -0

739 lines not on this page · raw message

#1 lore raw

PATCH 1/1 updated hdaps driver.

Quoted 5 lines · Greg KH
drivers/hwmon/hdaps.c new file +5 -0
+static void hdaps_mousedev_enable(void)
+{
+       down(&hdaps_sem);
+
+       /* calibrate the device before enabling */

drivers/hwmon/hdaps.c line 356

Quoted 10 lines
drivers/hwmon/hdaps.c new file +10 -0
+       hdaps_calibrate();
+
+       /* initialize the input class */
+       init_input_dev(&hdaps_idev);
+       hdaps_idev.dev = &pdev->dev;
+       hdaps_idev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
+       hdaps_idev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
+       hdaps_idev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT);
+       input_register_device(&hdaps_idev);
+

I do not see the device ever reporting BTN_LEFT, why is its presence advertised?

drivers/hwmon/hdaps.c line 376

Quoted 8 lines
drivers/hwmon/hdaps.c new file +8 -0
+
+/*
+ * hdaps_mousedev_disable - disable the input class device.  Caller must hold
+ * hdaps_sem.
+ */
+static void hdaps_mousedev_disable(void)
+{
+       down(&hdaps_sem);

Bad comment. The function itself holds the semaphore.

drivers/hwmon/hdaps.c line 701

Quoted 4 lines
drivers/hwmon/hdaps.c new file +4 -0
+
+       if (hdaps_mousedev)
+               hdaps_mousedev_enable();
+

Please consider converting the input device to an absolute device (reporting ABS_X/ABS_Y). This way it will be bound to a joystick interface (/dev/input/jsX) and won't mess your /dev/input/mice so you won't have to fiddle with enabling/disabling and will be able to have the device turned on unconditionally.

Signature · 1 line
Dmitry