[PATCH] block: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

2013-11-06 Thread Duan Jiong
This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong 
---
 block/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/ioctl.c b/block/ioctl.c
index a31d91d..7d5c3b2 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -64,7 +64,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct 
blkpg_ioctl_arg __user
part = add_partition(disk, partno, start, length,
 ADDPART_FLAG_NONE, NULL);
mutex_unlock(&bdev->bd_mutex);
-   return IS_ERR(part) ? PTR_ERR(part) : 0;
+   return PTR_ERR_OR_ZERO(part);
case BLKPG_DEL_PARTITION:
part = disk_get_part(disk, partno);
if (!part)
-- 
1.8.3.1

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


[PATCH] smsc: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

2013-11-06 Thread Duan Jiong
This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong 
---
 drivers/net/ethernet/smsc/smc9194.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc9194.c 
b/drivers/net/ethernet/smsc/smc9194.c
index 6f3491f..67d9fde 100644
--- a/drivers/net/ethernet/smsc/smc9194.c
+++ b/drivers/net/ethernet/smsc/smc9194.c
@@ -1545,9 +1545,7 @@ int __init init_module(void)
 
/* copy the parameters from insmod into the device structure */
devSMC9194 = smc_init(-1);
-   if (IS_ERR(devSMC9194))
-   return PTR_ERR(devSMC9194);
-   return 0;
+   return PTR_ERR_OR_ZERO(devSMC9194);
 }
 
 void __exit cleanup_module(void)
-- 
1.8.3.1

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


[PATCH] net:drivers/net: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

2013-11-06 Thread Duan Jiong
This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong 
---
 drivers/net/ethernet/i825xx/82596.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/i825xx/82596.c 
b/drivers/net/ethernet/i825xx/82596.c
index a15877a..7ce6379 100644
--- a/drivers/net/ethernet/i825xx/82596.c
+++ b/drivers/net/ethernet/i825xx/82596.c
@@ -1527,9 +1527,7 @@ int __init init_module(void)
if (debug >= 0)
i596_debug = debug;
dev_82596 = i82596_probe(-1);
-   if (IS_ERR(dev_82596))
-   return PTR_ERR(dev_82596);
-   return 0;
+   return PTR_ERR_OR_ZERO(dev_82596);
 }
 
 void __exit cleanup_module(void)
-- 
1.8.3.1

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


[PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)

2013-11-06 Thread Florian Echtler
From: "Florian Echtler" 

This patch adds support for the built-in multitouch sensor in the Samsung
SUR40 touchscreen device, also known as Microsoft Surface 2.0 or Microsoft
Pixelsense. Support for raw video output from the sensor as well as the 
accelerometer will be added in a later patch.

Signed-off-by: Florian Echtler 
---
 drivers/input/touchscreen/Kconfig  |   10 +
 drivers/input/touchscreen/Makefile |1 +
 drivers/input/touchscreen/sur40.c  |  467 
 3 files changed, 478 insertions(+)
 create mode 100644 drivers/input/touchscreen/sur40.c

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 515cfe7..99aaf10 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -876,6 +876,16 @@ config TOUCHSCREEN_STMPE
  To compile this driver as a module, choose M here: the
  module will be called stmpe-ts.
 
+config TOUCHSCREEN_SUR40
+   tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen"
+   depends on USB
+   help
+ Say Y here if you want support for the Samsung SUR40 touchscreen
+ (also known as Microsoft Surface 2.0 or Microsoft PixelSense).
+
+ To compile this driver as a module, choose M here: the
+ module will be called sur40.
+
 config TOUCHSCREEN_TPS6507X
tristate "TPS6507x based touchscreens"
depends on I2C
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 6bfbeab..b63a25d 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_TOUCHSCREEN_PIXCIR)  += pixcir_i2c_ts.o
 obj-$(CONFIG_TOUCHSCREEN_S3C2410)  += s3c2410_ts.o
 obj-$(CONFIG_TOUCHSCREEN_ST1232)   += st1232.o
 obj-$(CONFIG_TOUCHSCREEN_STMPE)+= stmpe-ts.o
+obj-$(CONFIG_TOUCHSCREEN_SUR40)+= sur40.o
 obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC)+= ti_am335x_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_TNETV107X)+= tnetv107x-ts.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)   += touchit213.o
diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
new file mode 100644
index 000..48787fd
--- /dev/null
+++ b/drivers/input/touchscreen/sur40.c
@@ -0,0 +1,467 @@
+/*
+   Surface2.0/SUR40/PixelSense input driver
+
+   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.
+
+   Copyright (c) 2013 by Florian 'floe' Echtler 
+
+   Derived from the USB Skeleton driver 1.1,
+   Copyright (c) 2003 Greg Kroah-Hartman (g...@kroah.com)
+
+   and from the Apple USB BCM5974 multitouch driver,
+   Copyright (c) 2008 Henrik Rydberg (rydb...@euromail.se)
+
+   and from the generic hid-multitouch driver,
+   Copyright (c) 2010-2012 Stephane Chatty 
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* read 512 bytes from endpoint 0x86 -> get header + blobs */
+struct sur40_header {
+
+   __le16 type;   /* always 0x0001 */
+   __le16 count;  /* count of blobs (if 0: continue prev. packet) */
+
+   __le32 packet_id;  /* unique ID for all packets in one frame */
+
+   __le32 timestamp;  /* milliseconds (inc. by 16 or 17 each frame) */
+   __le32 unknown;/* "epoch?" always 02/03 00 00 00 */
+
+} __packed;
+
+struct sur40_blob {
+
+   __le16 blob_id;
+
+   __u8 action;   /* 0x02 = enter/exit, 0x03 = update (?) */
+   __u8 unknown;  /* always 0x01 or 0x02 (no idea what this is?) */
+
+   __le16 bb_pos_x;   /* upper left corner of bounding box */
+   __le16 bb_pos_y;
+
+   __le16 bb_size_x;  /* size of bounding box */
+   __le16 bb_size_y;
+
+   __le16 pos_x;  /* finger tip position */
+   __le16 pos_y;
+
+   __le16 ctr_x;  /* centroid position */
+   __le16 ctr_y;
+
+   __le16 axis_x; /* somehow related to major/minor axis, mostly: */
+   __le16 axis_y; /* axis_x == bb_size_y && axis_y == bb_size_x */
+
+   __le32 angle;  /* orientation in radians relative to x axis -
+ actually an IEEE754 float, don't use in kernel */
+
+   __le32 area;   /* size in pixels/pressure (?) */
+
+   __u8 padding[32];
+
+} __packed;
+
+/* combined header/blob data */
+struct sur40_data {
+   struct sur40_header header;
+   struct sur40_blob   blobs[];
+} __packed;
+
+
+/* version information */
+#define DRIVER_SHORT   "sur40"
+#define DRIVER_AUTHOR  "Florian 'floe' Echtler "
+#define DRIVER_DESC"Surface2.0/SUR40/PixelSense input driver"
+
+/* vendor and device IDs */
+#define ID_MICROSOFT 0x045e
+#define ID_SUR40 0x0775
+
+/* sensor 

Re: [PATCH] Input: Adding support for touchpad on Dell XT2 model

2013-11-06 Thread Gaspard Jankowiak

On 31/10/13 08:56, Dmitry Torokhov wrote:



Applied, thank you.



Hi,

I don't know how to go about this, but it seems the patch is affecting 
other input devices. The trackpoint goes haywire when used, making the 
cursor jump all over the place and triggering random "right clicks" on 
the Latitude XT2. I don't know if it affects other models too.


Sorry for not spotting this earlier.

Name: kernel
Version : 3.11.6
Release : 201.fc19
Architecture: x86_64
Install Date: Tue 05 Nov 2013 09:22:37 CET
Group   : System Environment/Kernel
Size: 134433560
License : GPLv2 and Redistributable, no modification permitted
Signature   : RSA/SHA256, Sat 02 Nov 2013 22:00:51 CET, Key ID 
07477e65fb4b18e6

Source RPM  : kernel-3.11.6-201.fc19.src.rpm
Build Date  : Sat 02 Nov 2013 15:35:07 CET

Best,
Gaspard

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


Re: [appleir] BUG: unable to handle kernel NULL pointer dereference

2013-11-06 Thread Jiri Kosina
On Tue, 29 Oct 2013, Luis Henriques wrote:

> James has reported a NULL pointer dereference[1] on the appleir
> driver.  From the bug report[2] it looks like it is 100%
> reproducible using a 3.12-rc6 kernel simply by pressing any button on
> the IR remote.
> 
> >From the stack trace, it looks like input_event is invoked with the
> input_dev parameter set to NULL, which seems to indicate that
> appleir_input_configured is never invoked.
> 
> Any ideas?
> 
> [1] https://launchpadlibrarian.net/154942024/macmini-oops.jpg
> [2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1244505

[ adding some more CCs ]

Okay, so apparently we didn't register with input, but only hiddev / 
hidraw.

appleir 0003:05AC:8240.0005: hiddev0,hidraw4: USB HID v1.11 Device [Apple 
Computer, Inc. IR Receiver] on usb-:00:1d.3-2/input0

Therefore ->input_configured() callback has never been called, and thus we 
oops due to appleir->input_dev being NULL when the first raw event is 
reported.

Could you please provide report descriptor of the device?

The driver apparently relies on it being registered with hid-input, but 
for some reason that doesn't happen.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [appleir] BUG: unable to handle kernel NULL pointer dereference

2013-11-06 Thread Bastien Nocera
On Wed, 2013-11-06 at 16:38 +0100, Jiri Kosina wrote:
> On Tue, 29 Oct 2013, Luis Henriques wrote:
> 
> > James has reported a NULL pointer dereference[1] on the appleir
> > driver.  From the bug report[2] it looks like it is 100%
> > reproducible using a 3.12-rc6 kernel simply by pressing any button on
> > the IR remote.
> > 
> > >From the stack trace, it looks like input_event is invoked with the
> > input_dev parameter set to NULL, which seems to indicate that
> > appleir_input_configured is never invoked.
> > 
> > Any ideas?
> > 
> > [1] https://launchpadlibrarian.net/154942024/macmini-oops.jpg
> > [2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1244505
> 
> [ adding some more CCs ]
> 
> Okay, so apparently we didn't register with input, but only hiddev / 
> hidraw.
> 
> appleir 0003:05AC:8240.0005: hiddev0,hidraw4: USB HID v1.11 Device [Apple 
> Computer, Inc. IR Receiver] on usb-:00:1d.3-2/input0
> 
> Therefore ->input_configured() callback has never been called, and thus we 
> oops due to appleir->input_dev being NULL when the first raw event is 
> reported.
> 
> Could you please provide report descriptor of the device?
> 
> The driver apparently relies on it being registered with hid-input, but 
> for some reason that doesn't happen.

FWIW, my original patch (and driver) was an input driver, not a hid one.
I'm not sure either how the new driver got tested.


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


[PATCH 4/5] HID:hid-lg4ff: Initialize device properties before we touch autocentering.

2013-11-06 Thread Simon Wood
Re-arrange code slightly to ensure that device properties are configured
before calling auto-center command.

Reported-by: Michal MalĂ˝ 
Signed-off-by: Simon Wood 
---
 drivers/hid/hid-lg4ff.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 5d140b7..5492809 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -589,17 +589,6 @@ int lg4ff_init(struct hid_device *hid)
if (error)
return error;
 
-   /* Check if autocentering is available and
-* set the centering force to zero by default */
-   if (test_bit(FF_AUTOCENTER, dev->ffbit)) {
-   if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* 
Formula Force EX expects different autocentering command */
-   dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex;
-   else
-   dev->ff->set_autocenter = 
hid_lg4ff_set_autocenter_default;
-
-   dev->ff->set_autocenter(dev, 0);
-   }
-
/* Get private driver data */
drv_data = hid_get_drvdata(hid);
if (!drv_data) {
@@ -620,6 +609,17 @@ int lg4ff_init(struct hid_device *hid)
entry->max_range = lg4ff_devices[i].max_range;
entry->set_range = lg4ff_devices[i].set_range;
 
+   /* Check if autocentering is available and
+* set the centering force to zero by default */
+   if (test_bit(FF_AUTOCENTER, dev->ffbit)) {
+   if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* 
Formula Force EX expects different autocentering command */
+   dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex;
+   else
+   dev->ff->set_autocenter = 
hid_lg4ff_set_autocenter_default;
+
+   dev->ff->set_autocenter(dev, 0);
+   }
+
/* Create sysfs interface */
error = device_create_file(&hid->dev, &dev_attr_range);
if (error)
-- 
1.8.1.2

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


[PATCH 5/5] HID:hid-lg4ff: Correct Auto-center strength for wheels other than MOMO and MOMO2

2013-11-06 Thread Simon Wood
The MOMO and MOMO2 wheels have a slightly different autocenter command,
and accept values in the range 0..F (rather than 0..7 for the other wheels).

This patch uses the product ID to determine how to compute the strength.

Signed-off-by: Simon Wood 
---
 drivers/hid/hid-lg4ff.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 5492809..befe0e3 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -234,6 +234,20 @@ static void hid_lg4ff_set_autocenter_default(struct 
input_dev *dev, u16 magnitud
struct hid_report *report = list_entry(report_list->next, struct 
hid_report, list);
__s32 *value = report->field[0]->value;
__u32 expand_a, expand_b;
+   struct lg4ff_device_entry *entry;
+   struct lg_drv_data *drv_data;
+
+   drv_data = hid_get_drvdata(hid);
+   if (!drv_data) {
+   hid_err(hid, "Private driver data not found!\n");
+   return;
+   }
+
+   entry = drv_data->device_props;
+   if (!entry) {
+   hid_err(hid, "Device properties not found!\n");
+   return;
+   }
 
/* De-activate Auto-Center */
if (magnitude == 0) {
@@ -257,6 +271,16 @@ static void hid_lg4ff_set_autocenter_default(struct 
input_dev *dev, u16 magnitud
expand_b = (0x80 * 0x) + 0xff * (magnitude - 0x);
}
 
+   /* Adjust for non-MOMO wheels */
+   switch (entry->product_id) {
+   case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
+   case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
+   break;
+   default:
+   expand_a = expand_a >> 1;
+   break;
+   }
+
value[0] = 0xfe;
value[1] = 0x0d;
value[2] = expand_a / 0x;
-- 
1.8.1.2

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


[PATCH 3/5] HID:hid-lg4ff: ensure ConstantForce is disabled when set to 0

2013-11-06 Thread Simon Wood
When 'Constant Force' is set to 0 it is not turned off completely,
the wheel feels 'heavy'. This patch issues the '13 00..' command
to ensure that the force in slot 1 (the Constant Force) is
deactivated.

Reported-by: Elias Vanderstuyft 
Signed-off-by: Simon Wood 
---
 drivers/hid/hid-lg4ff.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 49f6cc0..5d140b7 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -196,6 +196,21 @@ static int hid_lg4ff_play(struct input_dev *dev, void 
*data, struct ff_effect *e
case FF_CONSTANT:
x = effect->u.ramp.start_level + 0x80;  /* 0x80 is no force */
CLAMP(x);
+
+   if (x == 0x80) {
+   /* De-activate force in slot-1*/
+   value[0] = 0x13;
+   value[1] = 0x00;
+   value[2] = 0x00;
+   value[3] = 0x00;
+   value[4] = 0x00;
+   value[5] = 0x00;
+   value[6] = 0x00;
+
+   hid_hw_request(hid, report, HID_REQ_SET_REPORT);
+   return 0;
+   }
+
value[0] = 0x11;/* Slot 1 */
value[1] = 0x08;
value[2] = x;
-- 
1.8.1.2

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


[PATCH 1/5] HID:hid-lg4ff: Scale autocentering force properly on Logitech wheel

2013-11-06 Thread Simon Wood
Adjust the scaling and lineartity to match that of the Windows
driver (from MOMO testing).

Reported-by: Elias Vanderstuyft 
Signed-off-by: Simon Wood 
---
 drivers/hid/hid-lg4ff.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 8782fe1..530fcd19 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -218,12 +218,21 @@ static void hid_lg4ff_set_autocenter_default(struct 
input_dev *dev, u16 magnitud
struct list_head *report_list = 
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
struct hid_report *report = list_entry(report_list->next, struct 
hid_report, list);
__s32 *value = report->field[0]->value;
+   __u32 expand_a, expand_b;
+
+   if (magnitude <= 0x) {
+   expand_a = 0x0c * magnitude;
+   expand_b = 0x80 * magnitude;
+   } else {
+   expand_a = (0x0c * 0x) + 0x06 * (magnitude - 0x);
+   expand_b = (0x80 * 0x) + 0xff * (magnitude - 0x);
+   }
 
value[0] = 0xfe;
value[1] = 0x0d;
-   value[2] = magnitude >> 13;
-   value[3] = magnitude >> 13;
-   value[4] = magnitude >> 8;
+   value[2] = expand_a / 0x;
+   value[3] = expand_a / 0x;
+   value[4] = expand_b / 0x;
value[5] = 0x00;
value[6] = 0x00;
 
-- 
1.8.1.2

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


[PATCH 2/5] HID:hid-lg4ff: Switch autocentering off when strength is set to zero.

2013-11-06 Thread Simon Wood
When the autocenter is set to zero, this patch issues a command to
totally disable the autocenter - this results in less resistance
in the wheel.

Reported-by: Elias Vanderstuyft 
Signed-off-by: Simon Wood 
---
 drivers/hid/hid-lg4ff.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 530fcd19..49f6cc0 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -220,6 +220,20 @@ static void hid_lg4ff_set_autocenter_default(struct 
input_dev *dev, u16 magnitud
__s32 *value = report->field[0]->value;
__u32 expand_a, expand_b;
 
+   /* De-activate Auto-Center */
+   if (magnitude == 0) {
+   value[0] = 0xf5;
+   value[1] = 0x00;
+   value[2] = 0x00;
+   value[3] = 0x00;
+   value[4] = 0x00;
+   value[5] = 0x00;
+   value[6] = 0x00;
+
+   hid_hw_request(hid, report, HID_REQ_SET_REPORT);
+   return;
+   }
+
if (magnitude <= 0x) {
expand_a = 0x0c * magnitude;
expand_b = 0x80 * magnitude;
@@ -237,6 +251,17 @@ static void hid_lg4ff_set_autocenter_default(struct 
input_dev *dev, u16 magnitud
value[6] = 0x00;
 
hid_hw_request(hid, report, HID_REQ_SET_REPORT);
+
+   /* Activate Auto-Center */
+   value[0] = 0x14;
+   value[1] = 0x00;
+   value[2] = 0x00;
+   value[3] = 0x00;
+   value[4] = 0x00;
+   value[5] = 0x00;
+   value[6] = 0x00;
+
+   hid_hw_request(hid, report, HID_REQ_SET_REPORT);
 }
 
 /* Sends autocentering command compatible with Formula Force EX */
-- 
1.8.1.2

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


[patch] Input: tnetv107x-keypad - make irqs signed for error handling

2013-11-06 Thread Dan Carpenter
There is a bug in keypad_probe() where we do:

kp->irq_press   = platform_get_irq_byname(pdev, "press");
kp->irq_release = platform_get_irq_byname(pdev, "release");
if (kp->irq_press < 0 || kp->irq_release < 0) {

The problem is that these irq variables are unsigned so the error
handling doesn't work.  I've changed them to signed values.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/input/keyboard/tnetv107x-keypad.c 
b/drivers/input/keyboard/tnetv107x-keypad.c
index 5f7b427..8bd24d5 100644
--- a/drivers/input/keyboard/tnetv107x-keypad.c
+++ b/drivers/input/keyboard/tnetv107x-keypad.c
@@ -60,8 +60,8 @@ struct keypad_data {
struct clk  *clk;
struct device   *dev;
spinlock_t  lock;
-   u32 irq_press;
-   u32 irq_release;
+   int irq_press;
+   int irq_release;
int rows, cols, row_shift;
int debounce_ms, active_low;
u32 prev_keys[3];
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [appleir] BUG: unable to handle kernel NULL pointer dereference

2013-11-06 Thread James Henstridge
On Wed, Nov 6, 2013 at 11:38 PM, Jiri Kosina  wrote:
> On Tue, 29 Oct 2013, Luis Henriques wrote:
>
>> James has reported a NULL pointer dereference[1] on the appleir
>> driver.  From the bug report[2] it looks like it is 100%
>> reproducible using a 3.12-rc6 kernel simply by pressing any button on
>> the IR remote.
>>
>> >From the stack trace, it looks like input_event is invoked with the
>> input_dev parameter set to NULL, which seems to indicate that
>> appleir_input_configured is never invoked.
>>
>> Any ideas?
>>
>> [1] https://launchpadlibrarian.net/154942024/macmini-oops.jpg
>> [2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1244505
>
> [ adding some more CCs ]
>
> Okay, so apparently we didn't register with input, but only hiddev /
> hidraw.
>
> appleir 0003:05AC:8240.0005: hiddev0,hidraw4: USB HID v1.11 Device [Apple 
> Computer, Inc. IR Receiver] on usb-:00:1d.3-2/input0
>
> Therefore ->input_configured() callback has never been called, and thus we
> oops due to appleir->input_dev being NULL when the first raw event is
> reported.
>
> Could you please provide report descriptor of the device?
>
> The driver apparently relies on it being registered with hid-input, but
> for some reason that doesn't happen.

Here is the relevant lsusb output that I think contains what you're
asking for (I had to unbind usbhid for it to include the descriptor):

Bus 005 Device 003: ID 05ac:8240 Apple, Inc. Built-in IR Receiver
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x05ac Apple, Inc.
  idProduct  0x8240 Built-in IR Receiver
  bcdDevice1.10
  iManufacturer   1 Apple Computer, Inc.
  iProduct2 IR Receiver
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   34
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  0 No Subclass
  bInterfaceProtocol  0 None
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.11
  bCountryCode0 Not supported
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength  41
  Report Descriptor: (length is 41)
Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
(null)
Item(Main  ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Global): Report ID, data= [ 0x24 ] 36
Item(Local ): Usage, data= [ 0x00 ] 0
(null)
Item(Main  ): Input, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position
Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Global): Report ID, data= [ 0x25 ] 37
Item(Local ): Usage, data= [ 0x00 ] 0
(null)
Item(Main  ): Input, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position
Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Global): Report ID, data= [ 0x26 ] 38
Item(Local ): Usage, data= [ 0x00 ] 0
(null)
Item(Main  ): Input, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position
Non_Volatile Bitfield
Item(Main  ): End Collection, data=none
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83  EP 3 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type