* [PATCH 1/2] DT: i2c: Add more devices handled by the rtc-rs5c372 driver
From: Geert Uytterhoeven @ 2014-11-14 16:03 UTC (permalink / raw)
To: Wolfram Sang
Cc: Dmitry Torokhov, Alessandro Zummo,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
This allows checkpatch to validate more DTSes.
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
Documentation/devicetree/bindings/i2c/trivial-devices.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index fbde415078e6845c..7a2bbea61b70b942 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -74,7 +74,12 @@ ovti,ov5642 OV5642: Color CMOS QSXGA (5-megapixel) Image Sensor with OmniBSI an
pericom,pt7c4338 Real-time Clock Module
plx,pex8648 48-Lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch
ramtron,24c64 i2c serial eeprom (24cxx)
+ricoh,r2025sd I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
+ricoh,r2221tl I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
ricoh,rs5c372a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
+ricoh,rs5c372b I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
+ricoh,rv5c386 I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
+ricoh,rv5c387a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
samsung,24ad0xd1 S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
sii,s35390a 2-wire CMOS real-time clock
st-micro,24c256 i2c serial eeprom (24cxx)
--
1.9.1
^ permalink raw reply related
* [PATCH 2/2] DT: i2c: Add more devices handled by the adxl34x-i2c driver
From: Geert Uytterhoeven @ 2014-11-14 16:03 UTC (permalink / raw)
To: Wolfram Sang
Cc: Dmitry Torokhov, Alessandro Zummo, devicetree, linux-input,
rtc-linux, linux-kernel, linux-i2c, Geert Uytterhoeven
In-Reply-To: <1415981011-13423-1-git-send-email-geert+renesas@glider.be>
This allows checkpatch to validate more DTSes.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Documentation/devicetree/bindings/i2c/trivial-devices.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index 7a2bbea61b70b942..e0beef4f8cff5cdf 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -17,6 +17,9 @@ adi,adt7473 +/-1C TDM Extended Temp Range I.C
adi,adt7475 +/-1C TDM Extended Temp Range I.C
adi,adt7476 +/-1C TDM Extended Temp Range I.C
adi,adt7490 +/-1C TDM Extended Temp Range I.C
+adi,adxl345 Three-Axis Digital Accelerometer
+adi,adxl346 Three-Axis Digital Accelerometer
+adi,adxl34x Three-Axis Digital Accelerometer
at,24c08 i2c serial eeprom (24cxx)
atmel,24c00 i2c serial eeprom (24cxx)
atmel,24c01 i2c serial eeprom (24cxx)
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] driver: input :touchscreen : add Raydium I2C touch driver
From: Benson Leung @ 2014-11-14 17:43 UTC (permalink / raw)
To: jeffrey.lin
Cc: Dmitry Torokhov, Henrik Rydberg, Olof Johansson, Douglas Anderson,
benzh, davidriley, Joe Konno, jeffrey.lin, roger.yang, KP.li,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
In-Reply-To: <1415949562-14957-1-git-send-email-jeffrey.lin@rad-ic.com>
Hi Jeffrey,
On Thu, Nov 13, 2014 at 11:19 PM, jeffrey.lin <yajohn@gmail.com> wrote:
> this patch is porting Raydium I2C touch driver. Developer can enable
> Raydium touch driver by modifying define "CONFIG_TOUCHSCREEN_RM31100"
> in config/base.config
>
> Change-Id: Idae54cc4bca17f321a1d0895a8b59680bf9af859
This looks like it came from the chromiumos kernel. When you send a
patch to the linux-input list, make sure to strip out this stuff in
the commit message.
>
> Signed-off-by: jeffrey.lin@rad-ic.com
>
> chromeos: config: add Raydium touch default config
>
> Add to default table and set as not to use
>
> Signed-off-by: jeffrey.lin@rad-ic.com
> ---
> chromeos/config/base.config | 1 +
This file doesn't exist in upstream linux (only exists in
chromeos-kernels) so don't include this in the patch.
Basically, make sure whatever you send to the list actually applies to
mainline linux or linux-next.
> drivers/input/touchscreen/RM31100.c | 1037 +++++++++++++++++++++++++++++++++++
> include/linux/input/RM31100.h | 60 ++
> 3 files changed, 1098 insertions(+)
> create mode 100644 drivers/input/touchscreen/RM31100.c
> create mode 100644 include/linux/input/RM31100.h
>
> diff --git a/chromeos/config/base.config b/chromeos/config/base.config
> index 59fa689..45b1023 100644
> --- a/chromeos/config/base.config
> +++ b/chromeos/config/base.config
> @@ -1727,6 +1727,7 @@ CONFIG_TOUCHSCREEN_ATMEL_MXT=y
> # CONFIG_TOUCHSCREEN_TSC2007 is not set
> # CONFIG_TOUCHSCREEN_TSC_SERIO is not set
> CONFIG_TOUCHSCREEN_USB_COMPOSITE=m
> +# CONFIG_TOUCHSCREEN_RM_TS is not set
> # CONFIG_TOUCHSCREEN_WACOM_I2C is not set
> # CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
> # CONFIG_TPS6105X is not set
Thanks
--
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org
^ permalink raw reply
* Re: [PATCH] driver: input :touchscreen : add Raydium I2C touch driver
From: Dmitry Torokhov @ 2014-11-14 18:00 UTC (permalink / raw)
To: jeffrey.lin
Cc: rydberg, olof, dianders, benzh, davidriley, bleung, joe.konno,
jeffrey.lin, roger.yang, KP.li, linux-kernel, linux-input
In-Reply-To: <1415949562-14957-1-git-send-email-jeffrey.lin@rad-ic.com>
Hi Jeffrey,
On Fri, Nov 14, 2014 at 03:19:22PM +0800, jeffrey.lin wrote:
> From: "jeffrey.lin" <jeffrey.lin@rad-ic.com>
>
> this patch is porting Raydium I2C touch driver.
Thank you for your submission.
> Developer can enable
> Raydium touch driver by modifying define "CONFIG_TOUCHSCREEN_RM31100"
> in config/base.config
This does not make sense in context of mainline kernel, it is Chromeos
(or Android?) construct.
Also, for mainline submission, please get rid of EARLYSUSPEND bits,
convert the driver to threaded interrupt handler instead of private
workqueue, remove driver specific device interface, #if 0., DEBUG_PRINT,
convert to MT-B protocol.
Thank you.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v4 4/6] ARM: dts: AM335x: Make charge delay a DT parameter for TSC
From: Tony Lindgren @ 2014-11-14 18:03 UTC (permalink / raw)
To: Vignesh R
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
Benoit Cousson, Russell King, Jonathan Cameron, Hartmut Knaack,
richardcochran, Dmitry Torokhov, Lee Jones,
Sebastian Andrzej Siewior, Lars-Peter Clausen, Peter Meerwald,
Samuel Ortiz, Felipe Balbi, Brad Griffis, Sanjeev Sharma,
Paul Gortmaker, Jan Kardell, devicetree, linux-kernel, linux-omap
In-Reply-To: <1415941651-28962-5-git-send-email-vigneshr@ti.com>
* Vignesh R <vigneshr@ti.com> [141113 21:42]:
> The charge delay value is by default 0x400. But it can be set to lower
> values on some boards, as long as false pen-ups are avoided. Lowering the
> value increases the sampling rate (though current sampling rate is
> sufficient for TSC operation). In some boards, the value has to be
> increased to avoid false pen-up events. Hence, charge delay has been
> made a DT parameter.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
As long as the input and DT people are OK with this, ack for
merging the .dts changes along with the input patches:
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
>
> v4:
> - Set charge delay to 0x400 as default. Most devices function normally
> at this value
>
> .../devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 15 +++++++++++++++
> arch/arm/boot/dts/am335x-evm.dts | 1 +
> 2 files changed, 16 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> index 878549ba814d..6df5028a4ad3 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> @@ -28,6 +28,20 @@ Required properties:
> ti,adc-channels: List of analog inputs available for ADC.
> AIN0 = 0, AIN1 = 1 and so on till AIN7 = 7.
>
> +Optional properties:
> +- child "tsc"
> + ti,charge-delay: Length of touch screen charge delay step in terms of
> + ADC clock cycles. Charge delay value should be large
> + in order to avoid false pen-up events. This value
> + affects the overall sampling speed, hence need to be
> + kept as low as possible, while avoiding false pen-up
> + event. Start from a lower value, say 0x400, and
> + increase value until false pen-up events are avoided.
> + The pen-up detection happens immediately after the
> + charge step, so this does in fact function as a
> + hardware knob for adjusting the amount of "settling
> + time".
> +
> Example:
> tscadc: tscadc@44e0d000 {
> compatible = "ti,am3359-tscadc";
> @@ -36,6 +50,7 @@ Example:
> ti,x-plate-resistance = <200>;
> ti,coordiante-readouts = <5>;
> ti,wire-config = <0x00 0x11 0x22 0x33>;
> + ti,charge-delay = <0x400>;
> };
>
> adc {
> diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
> index e2156a583de7..ce12f6ef1e28 100644
> --- a/arch/arm/boot/dts/am335x-evm.dts
> +++ b/arch/arm/boot/dts/am335x-evm.dts
> @@ -641,6 +641,7 @@
> ti,x-plate-resistance = <200>;
> ti,coordinate-readouts = <5>;
> ti,wire-config = <0x00 0x11 0x22 0x33>;
> + ti,charge-delay = <0x400>;
> };
>
> adc {
> --
> 1.9.1
>
^ permalink raw reply
* [PATCH 2/7] input: alps: Move trackstick detection to alps_hw_init_*
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
Now when alps_identify() does not need do trackstick detection it is safe to
move code init hw_init functions.
This patch also fix trackstick detection in function alps_hw_init_v3() which
remove ALPS_DUALPOINT flag when trackstick is not detected.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 9ffa98d..cbfdcfc 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1732,6 +1732,7 @@ error:
static int alps_hw_init_v3(struct psmouse *psmouse)
{
+ struct alps_data *priv = psmouse->private;
struct ps2dev *ps2dev = &psmouse->ps2dev;
int reg_val;
unsigned char param[4];
@@ -1740,9 +1741,15 @@ static int alps_hw_init_v3(struct psmouse *psmouse)
if (reg_val == -EIO)
goto error;
- if (reg_val == 0 &&
- alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
- goto error;
+ if (reg_val == 0) {
+ reg_val = alps_setup_trackstick_v3(psmouse,
+ ALPS_REG_BASE_PINNACLE);
+ if (reg_val == -EIO)
+ goto error;
+ }
+
+ if (reg_val == -ENODEV)
+ priv->flags &= ~ALPS_DUALPOINT;
if (alps_enter_command_mode(psmouse) ||
alps_absolute_mode_v3(psmouse)) {
@@ -1849,15 +1856,20 @@ static int alps_hw_init_rushmore_v3(struct psmouse *psmouse)
struct ps2dev *ps2dev = &psmouse->ps2dev;
int reg_val, ret = -1;
- if (priv->flags & ALPS_DUALPOINT) {
+ reg_val = alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE);
+ if (reg_val == -EIO)
+ goto error;
+
+ if (reg_val == 0) {
reg_val = alps_setup_trackstick_v3(psmouse,
ALPS_REG_BASE_RUSHMORE);
if (reg_val == -EIO)
goto error;
- if (reg_val == -ENODEV)
- priv->flags &= ~ALPS_DUALPOINT;
}
+ if (reg_val == -ENODEV)
+ priv->flags &= ~ALPS_DUALPOINT;
+
if (alps_enter_command_mode(psmouse) ||
alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 ||
alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00))
@@ -2231,12 +2243,6 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
priv->y_bits = 12;
priv->flags |= ALPS_IS_RUSHMORE;
- /* hack to make addr_command, nibble_command available */
- psmouse->private = priv;
-
- if (alps_probe_trackstick_v3(psmouse, ALPS_REG_BASE_RUSHMORE))
- priv->flags &= ~ALPS_DUALPOINT;
-
return 0;
} else if (ec[0] == 0x88 && ec[1] == 0x07 &&
ec[2] >= 0x90 && ec[2] <= 0x9d) {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/7] input: alps: Move alps_dolphin_get_device_area into alps_hw_init_dolphin_v1
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
This patch moves function call alps_dolphin_get_device_area() from function
alps_identify() to alps_hw_init_dolphin_v1() so alps_identify() will not call
any other psmouse commands.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cbfdcfc..5603870 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1991,9 +1991,9 @@ error:
return -1;
}
-static int alps_dolphin_get_device_area(struct psmouse *psmouse,
- struct alps_data *priv)
+static int alps_dolphin_get_device_area(struct psmouse *psmouse)
{
+ struct alps_data *priv = psmouse->private;
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4] = {0};
int num_x_electrode, num_y_electrode;
@@ -2042,6 +2042,9 @@ static int alps_hw_init_dolphin_v1(struct psmouse *psmouse)
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2];
+ if (alps_dolphin_get_device_area(psmouse))
+ return -EIO;
+
/* This is dolphin "v1" as empirically defined by florin9doi */
param[0] = 0x64;
param[1] = 0x28;
@@ -2223,10 +2226,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) {
priv->proto_version = ALPS_PROTO_V5;
alps_set_defaults(priv);
- if (alps_dolphin_get_device_area(psmouse, priv))
- return -EIO;
- else
- return 0;
+
+ return 0;
} else if (ec[0] == 0x88 &&
((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) {
priv->proto_version = ALPS_PROTO_V7;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 4/7] input: alps: Use NULL instead dummy argument for alps_identify
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
This patch change alps_identify() function code so it can be called also without
priv parameter which is useful for alps_detect(). Instead passing dummy value
now alps_identify() accept also NULL value and skip filling priv data. It is
useless for alps_detect() and it will speed up detection of alps devices.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 114 +++++++++++++++++++++++++++-----------------
1 file changed, 71 insertions(+), 43 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 5603870..0176425 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2162,8 +2162,7 @@ static void alps_set_defaults(struct alps_data *priv)
}
}
-static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv,
- unsigned char *e7, unsigned char *ec)
+static const struct alps_model_info *alps_match_table(unsigned char *e7, unsigned char *ec)
{
const struct alps_model_info *model;
int i;
@@ -2174,24 +2173,49 @@ static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv,
if (!memcmp(e7, model->signature, sizeof(model->signature)) &&
(!model->command_mode_resp ||
model->command_mode_resp == ec[2])) {
+ return model;
+ }
+ }
- priv->proto_version = model->proto_version;
- alps_set_defaults(priv);
+ return NULL;
+}
- priv->flags = model->flags;
- priv->byte0 = model->byte0;
- priv->mask0 = model->mask0;
+static inline bool alps_match_v5(unsigned char *e7, unsigned char *ec)
+{
+ return (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 &&
+ ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02));
+}
- return 0;
- }
- }
+static inline bool alps_match_v7(unsigned char *e7, unsigned char *ec)
+{
+ return (ec[0] == 0x88 &&
+ ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0));
+}
- return -EINVAL;
+static inline bool alps_match_rushmore_v3(unsigned char *e7, unsigned char *ec)
+{
+ return (ec[0] == 0x88 && ec[1] == 0x08);
+}
+
+static inline bool alps_match_v3(unsigned char *e7, unsigned char *ec)
+{
+ return (ec[0] == 0x88 && ec[1] == 0x07 &&
+ ec[2] >= 0x90 && ec[2] <= 0x9d);
+}
+
+static inline bool alps_match_any(unsigned char *e7, unsigned char *ec)
+{
+ return (alps_match_table(e7, ec) ||
+ alps_match_v5(e7, ec) ||
+ alps_match_v7(e7, ec) ||
+ alps_match_rushmore_v3(e7, ec) ||
+ alps_match_v3(e7, ec));
}
static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
{
unsigned char e6[4], e7[4], ec[4];
+ const struct alps_model_info *model;
/*
* First try "E6 report".
@@ -2217,40 +2241,46 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
alps_exit_command_mode(psmouse))
return -EIO;
- /* Save the Firmware version */
- memcpy(priv->fw_ver, ec, 3);
+ if (priv) {
- if (alps_match_table(psmouse, priv, e7, ec) == 0) {
- return 0;
- } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 &&
- ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) {
- priv->proto_version = ALPS_PROTO_V5;
- alps_set_defaults(priv);
+ /* Save the Firmware version */
+ memcpy(priv->fw_ver, ec, 3);
- return 0;
- } else if (ec[0] == 0x88 &&
- ((ec[1] & 0xf0) == 0xb0 || (ec[1] & 0xf0) == 0xc0)) {
- priv->proto_version = ALPS_PROTO_V7;
- alps_set_defaults(priv);
-
- return 0;
- } else if (ec[0] == 0x88 && ec[1] == 0x08) {
- priv->proto_version = ALPS_PROTO_V3;
- alps_set_defaults(priv);
+ if ((model = alps_match_table(e7, ec))) {
+ priv->proto_version = model->proto_version;
+ alps_set_defaults(priv);
+ priv->flags = model->flags;
+ priv->byte0 = model->byte0;
+ priv->mask0 = model->mask0;
+ return 0;
+ } else if (alps_match_v5(e7, ec)) {
+ priv->proto_version = ALPS_PROTO_V5;
+ alps_set_defaults(priv);
+ return 0;
+ } else if (alps_match_v7(e7, ec)) {
+ priv->proto_version = ALPS_PROTO_V7;
+ alps_set_defaults(priv);
+ return 0;
+ } else if (alps_match_rushmore_v3(e7, ec)) {
+ priv->proto_version = ALPS_PROTO_V3;
+ alps_set_defaults(priv);
+ priv->hw_init = alps_hw_init_rushmore_v3;
+ priv->decode_fields = alps_decode_rushmore;
+ priv->x_bits = 16;
+ priv->y_bits = 12;
+ priv->flags |= ALPS_IS_RUSHMORE;
+ return 0;
+ } else if (alps_match_v3(e7, ec)) {
+ priv->proto_version = ALPS_PROTO_V3;
+ alps_set_defaults(priv);
+ return 0;
+ }
- priv->hw_init = alps_hw_init_rushmore_v3;
- priv->decode_fields = alps_decode_rushmore;
- priv->x_bits = 16;
- priv->y_bits = 12;
- priv->flags |= ALPS_IS_RUSHMORE;
+ } else {
- return 0;
- } else if (ec[0] == 0x88 && ec[1] == 0x07 &&
- ec[2] >= 0x90 && ec[2] <= 0x9d) {
- priv->proto_version = ALPS_PROTO_V3;
- alps_set_defaults(priv);
+ if (alps_match_any(e7, ec))
+ return 0;
- return 0;
}
psmouse_dbg(psmouse,
@@ -2427,9 +2457,7 @@ init_fail:
int alps_detect(struct psmouse *psmouse, bool set_properties)
{
- struct alps_data dummy;
-
- if (alps_identify(psmouse, &dummy) < 0)
+ if (alps_identify(psmouse, NULL) < 0)
return -1;
if (set_properties) {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 5/7] input: alps: Fix name, product and version of dev2 input device
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
This patch fix name, product and version of dev2 input device based on format
used in function psmouse_switch_protocol() in file psmouse-base.c.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0176425..2b7b74d 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2407,14 +2407,24 @@ int alps_init(struct psmouse *psmouse)
dev1->keybit[BIT_WORD(BTN_MIDDLE)] |= BIT_MASK(BTN_MIDDLE);
}
+ if (priv->flags & ALPS_DUALPOINT) {
+ /*
+ * format of input device name is: "protocol vendor name"
+ * see function psmouse_switch_protocol() in psmouse-base.c
+ */
+ dev2->name = "AlpsPS/2 ALPS DualPoint Stick";
+ dev2->id.product = PSMOUSE_ALPS;
+ dev2->id.version = priv->proto_version;
+ } else {
+ dev2->name = "PS/2 ALPS Mouse";
+ dev2->id.product = PSMOUSE_PS2;
+ dev2->id.version = 0x0000;
+ }
+
snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys);
dev2->phys = priv->phys;
- dev2->name = (priv->flags & ALPS_DUALPOINT) ?
- "DualPoint Stick" : "ALPS PS/2 Device";
dev2->id.bustype = BUS_I8042;
dev2->id.vendor = 0x0002;
- dev2->id.product = PSMOUSE_ALPS;
- dev2->id.version = 0x0000;
dev2->dev.parent = &psmouse->ps2dev.serio->dev;
dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 6/7] input: alps: Add sanity checks for non DualPoint devices
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
This patch adds sanity checks and reject trackstick packets from ALPS devices
which do not have trackstick present (those without ALPS_DUALPOINT flag).
Make sure that driver does not process some bogus packets as trackstick data
when there is no trackstick packet. Patch also write warning do dmesg so
possible problems with driver (e.g received invalid data) will be visible
for debugging.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 2b7b74d..770bec5 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -475,6 +475,13 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
struct input_dev *dev = priv->dev2;
int x, y, z, left, right, middle;
+ /* It should be a DualPoint when received trackstick packet */
+ if (!(priv->flags & ALPS_DUALPOINT)) {
+ psmouse_warn(psmouse,
+ "Rejected trackstick packet from non DualPoint device");
+ return;
+ }
+
/* Sanity check packet */
if (!(packet[0] & 0x40)) {
psmouse_dbg(psmouse, "Bad trackstick packet, discarding\n");
@@ -699,7 +706,8 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
alps_report_semi_mt_data(psmouse, fingers);
- if (!(priv->quirks & ALPS_QUIRK_TRACKSTICK_BUTTONS)) {
+ if ((priv->flags & ALPS_DUALPOINT) &&
+ !(priv->quirks & ALPS_QUIRK_TRACKSTICK_BUTTONS)) {
input_report_key(dev2, BTN_LEFT, f->ts_left);
input_report_key(dev2, BTN_RIGHT, f->ts_right);
input_report_key(dev2, BTN_MIDDLE, f->ts_middle);
@@ -743,8 +751,11 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
*/
if (packet[5] == 0x7F) {
/* It should be a DualPoint when received Trackpoint packet */
- if (!(priv->flags & ALPS_DUALPOINT))
+ if (!(priv->flags & ALPS_DUALPOINT)) {
+ psmouse_warn(psmouse,
+ "Rejected trackstick packet from non DualPoint device");
return;
+ }
/* Trackpoint packet */
x = packet[1] | ((packet[3] & 0x20) << 2);
@@ -962,6 +973,13 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
struct input_dev *dev2 = priv->dev2;
int x, y, z, left, right, middle;
+ /* It should be a DualPoint when received trackstick packet */
+ if (!(priv->flags & ALPS_DUALPOINT)) {
+ psmouse_warn(psmouse,
+ "Rejected trackstick packet from non DualPoint device");
+ return;
+ }
+
/*
* b7 b6 b5 b4 b3 b2 b1 b0
* Byte0 0 1 0 0 1 0 0 0
--
1.7.9.5
^ permalink raw reply related
* [PATCH 7/7] input: alps: Do not report both trackstick and external PS/2 mouse data to one input device
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
Before this patch dev2 device was used for both external PS/2 mouse and internal
trackstick device (if available).
This patch introduce dev3 device which is used for external PS/2 mouse data and
dev2 is not used only for trackstick.
In case that trackstick is not present dev2 is not created, so userspace does
not see non existent device in system.
Because laptops with ALPS devices often do not use i8042 active multiplexing
all data (from touchpad, trackstick and external PS/2 mouse) come to one port.
So it is not possible to know if external PS/2 mouse is connected or not. In
most cases external PS/2 mouse is not connected so driver will create dev3
input device after first bare PS/2 packet will be received. So there will not
be "ghost" input device.
This patch also helps identify possible problems in future if driver decide
to report 6-bytes trackstick packets as 3-bytes bare PS/2 (data will be
reported to dev3 instead dev2).
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 163 +++++++++++++++++++++++++++++++-------------
drivers/input/mouse/alps.h | 14 +++-
2 files changed, 128 insertions(+), 49 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 770bec5..6b69f4b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -150,8 +150,7 @@ static bool alps_is_valid_first_byte(struct alps_data *priv,
return (data & priv->mask0) == priv->byte0;
}
-static void alps_report_buttons(struct psmouse *psmouse,
- struct input_dev *dev1, struct input_dev *dev2,
+static void alps_report_buttons(struct input_dev *dev1, struct input_dev *dev2,
int left, int right, int middle)
{
struct input_dev *dev;
@@ -161,20 +160,21 @@ static void alps_report_buttons(struct psmouse *psmouse,
* other device (dev2) then this event should be also
* sent through that device.
*/
- dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
+ dev = (dev2 && test_bit(BTN_LEFT, dev2->key)) ? dev2 : dev1;
input_report_key(dev, BTN_LEFT, left);
- dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
+ dev = (dev2 && test_bit(BTN_RIGHT, dev2->key)) ? dev2 : dev1;
input_report_key(dev, BTN_RIGHT, right);
- dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
+ dev = (dev2 && test_bit(BTN_MIDDLE, dev2->key)) ? dev2 : dev1;
input_report_key(dev, BTN_MIDDLE, middle);
/*
* Sync the _other_ device now, we'll do the first
* device later once we report the rest of the events.
*/
- input_sync(dev2);
+ if (dev2)
+ input_sync(dev2);
}
static void alps_process_packet_v1_v2(struct psmouse *psmouse)
@@ -221,13 +221,13 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse)
input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x));
input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y));
- alps_report_buttons(psmouse, dev2, dev, left, right, middle);
+ alps_report_buttons(dev2, dev, left, right, middle);
input_sync(dev2);
return;
}
- alps_report_buttons(psmouse, dev, dev2, left, right, middle);
+ alps_report_buttons(dev, dev2, left, right, middle);
/* Convert hardware tap to a reasonable Z value */
if (ges && !fin)
@@ -1043,23 +1043,73 @@ static void alps_process_packet_v7(struct psmouse *psmouse)
alps_process_touchpad_packet_v7(psmouse);
}
-static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
+static DEFINE_MUTEX(alps_mutex);
+
+static void alps_register_bare_ps2_mouse(struct work_struct *work)
+{
+ struct alps_data *priv =
+ container_of(work, struct alps_data, dev3_register_work.work);
+ struct psmouse *psmouse = priv->psmouse;
+ struct input_dev *dev3;
+
+ mutex_lock(&alps_mutex);
+
+ if (priv->dev3)
+ goto out;
+
+ dev3 = input_allocate_device();
+ if (!dev3)
+ goto out;
+
+ snprintf(priv->phys3, sizeof(priv->phys3), "%s/%s",
+ psmouse->ps2dev.serio->phys,
+ (priv->dev2 ? "input2" : "input1"));
+ dev3->phys = priv->phys3;
+
+ /*
+ * format of input device name is: "protocol vendor name"
+ * see function psmouse_switch_protocol() in psmouse-base.c
+ */
+ dev3->name = "PS/2 ALPS Mouse";
+
+ dev3->id.bustype = BUS_I8042;
+ dev3->id.vendor = 0x0002;
+ dev3->id.product = PSMOUSE_PS2;
+ dev3->id.version = 0x0000;
+ dev3->dev.parent = &psmouse->ps2dev.serio->dev;
+
+ dev3->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
+ dev3->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
+ dev3->keybit[BIT_WORD(BTN_LEFT)] =
+ BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
+
+ __set_bit(INPUT_PROP_POINTER, dev3->propbit);
+
+ if (input_register_device(dev3)) {
+ input_free_device(dev3);
+ goto out;
+ }
+
+ priv->dev3 = dev3;
+
+out:
+ mutex_unlock(&alps_mutex);
+}
+
+static void alps_report_bare_ps2_packet(struct input_dev *dev,
unsigned char packet[],
bool report_buttons)
{
- struct alps_data *priv = psmouse->private;
- struct input_dev *dev2 = priv->dev2;
-
if (report_buttons)
- alps_report_buttons(psmouse, dev2, psmouse->dev,
+ alps_report_buttons(dev, NULL,
packet[0] & 1, packet[0] & 2, packet[0] & 4);
- input_report_rel(dev2, REL_X,
+ input_report_rel(dev, REL_X,
packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0);
- input_report_rel(dev2, REL_Y,
+ input_report_rel(dev, REL_Y,
packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0);
- input_sync(dev2);
+ input_sync(dev);
}
static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
@@ -1124,8 +1174,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
* de-synchronization.
*/
- alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
- false);
+ alps_report_bare_ps2_packet(priv->dev2,
+ &psmouse->packet[3], false);
/*
* Continue with the standard ALPS protocol handling,
@@ -1174,12 +1224,24 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
{
struct alps_data *priv = psmouse->private;
- /* FIXME: Could we receive bare PS/2 packets from DualPoint devices?? */
+ /* NOTE: Some ALPS devices do not have active multiplexing controller
+ * so everything comes mixed into single data stream. Which means
+ * also external devices plugged into PS/2 ports. If ALPS device
+ * is not out of sync check for bare PS/2 packet which could come
+ * from external PS/2 mouse.
+ */
if (!psmouse->out_of_sync_cnt &&
(psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
+ /* Register dev3 mouse if we received PS/2 packet first time */
+ if (!priv->dev3)
+ psmouse_queue_work(psmouse,
+ &priv->dev3_register_work, 0);
if (psmouse->pktcnt == 3) {
- alps_report_bare_ps2_packet(psmouse, psmouse->packet,
- true);
+ /* Once dev3 mouse device is registered report data */
+ if (priv->dev3)
+ alps_report_bare_ps2_packet(priv->dev3,
+ psmouse->packet,
+ true);
return PSMOUSE_FULL_PACKET;
}
return PSMOUSE_GOOD_DATA;
@@ -2325,7 +2387,10 @@ static void alps_disconnect(struct psmouse *psmouse)
psmouse_reset(psmouse);
del_timer_sync(&priv->timer);
- input_unregister_device(priv->dev2);
+ if (priv->dev2)
+ input_unregister_device(priv->dev2);
+ if (priv->dev3)
+ input_unregister_device(priv->dev3);
kfree(priv);
}
@@ -2359,17 +2424,17 @@ static void alps_set_abs_params_mt(struct alps_data *priv,
int alps_init(struct psmouse *psmouse)
{
struct alps_data *priv;
- struct input_dev *dev1 = psmouse->dev, *dev2;
+ struct input_dev *dev1 = psmouse->dev;
+ struct input_dev *dev2 = NULL;
priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
- dev2 = input_allocate_device();
- if (!priv || !dev2)
+ if (!priv)
goto init_fail;
- priv->dev2 = dev2;
setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse);
psmouse->private = priv;
+ priv->psmouse = psmouse;
psmouse_reset(psmouse);
@@ -2426,36 +2491,41 @@ int alps_init(struct psmouse *psmouse)
}
if (priv->flags & ALPS_DUALPOINT) {
+ dev2 = input_allocate_device();
+ if (!priv || !dev2)
+ goto init_fail;
+
+ priv->dev2 = dev2;
+
+ snprintf(priv->phys2, sizeof(priv->phys2), "%s/input1",
+ psmouse->ps2dev.serio->phys);
+ dev2->phys = priv->phys2;
+
/*
* format of input device name is: "protocol vendor name"
* see function psmouse_switch_protocol() in psmouse-base.c
*/
dev2->name = "AlpsPS/2 ALPS DualPoint Stick";
+
+ dev2->id.bustype = BUS_I8042;
+ dev2->id.vendor = 0x0002;
dev2->id.product = PSMOUSE_ALPS;
dev2->id.version = priv->proto_version;
- } else {
- dev2->name = "PS/2 ALPS Mouse";
- dev2->id.product = PSMOUSE_PS2;
- dev2->id.version = 0x0000;
- }
+ dev2->dev.parent = &psmouse->ps2dev.serio->dev;
- snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys);
- dev2->phys = priv->phys;
- dev2->id.bustype = BUS_I8042;
- dev2->id.vendor = 0x0002;
- dev2->dev.parent = &psmouse->ps2dev.serio->dev;
+ dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
+ dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
+ dev2->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
+ BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
- dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
- dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
- dev2->keybit[BIT_WORD(BTN_LEFT)] =
- BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
-
- __set_bit(INPUT_PROP_POINTER, dev2->propbit);
- if (priv->flags & ALPS_DUALPOINT)
+ __set_bit(INPUT_PROP_POINTER, dev2->propbit);
__set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit);
- if (input_register_device(priv->dev2))
- goto init_fail;
+ if (input_register_device(priv->dev2))
+ goto init_fail;
+ }
+
+ INIT_DELAYED_WORK(&priv->dev3_register_work, alps_register_bare_ps2_mouse);
if (!(priv->flags & ALPS_DUALPOINT))
psmouse->name = "GlidePoint TouchPad";
@@ -2477,7 +2547,8 @@ int alps_init(struct psmouse *psmouse)
init_fail:
psmouse_reset(psmouse);
- input_free_device(dev2);
+ if (dev2)
+ input_free_device(dev2);
kfree(priv);
psmouse->private = NULL;
return -1;
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 66240b4..8d4de04 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -132,8 +132,12 @@ struct alps_fields {
/**
* struct alps_data - private data structure for the ALPS driver
- * @dev2: "Relative" device used to report trackstick or mouse activity.
- * @phys: Physical path for the relative device.
+ * @psmouse: Pointer to parent psmouse device
+ * @dev2: Trackstick device (can be NULL).
+ * @dev3: Generic PS/2 mouse (can be NULL, delayed registering).
+ * @phys2: Physical path for the trackstick device.
+ * @phys3: Physical path for the generic PS/2 mouse.
+ * @dev3_register_work: Delayed work for registering PS/2 mouse.
* @nibble_commands: Command mapping used for touchpad register accesses.
* @addr_command: Command used to tell the touchpad that a register address
* follows.
@@ -160,8 +164,12 @@ struct alps_fields {
* @timer: Timer for flushing out the final report packet in the stream.
*/
struct alps_data {
+ struct psmouse *psmouse;
struct input_dev *dev2;
- char phys[32];
+ struct input_dev *dev3;
+ char phys2[32];
+ char phys3[32];
+ struct delayed_work dev3_register_work;
/* these are autodetected when the device is identified */
const struct alps_nibble_commands *nibble_commands;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/7] Fixes for ALPS trackstick
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
This patch series fix detection and identifying trackstick on machines with
ALPS devices. Last patch split trackstick and bare PS/2 mouse packets between
dev2 and dev3 input devices which make sure that driver will send only trackstick
data to trackstick input device.
Pali Rohár (7):
input: alps: Set correct name of psmouse device in alps_init()
input: alps: Move trackstick detection to alps_hw_init_*
input: alps: Move alps_dolphin_get_device_area into
alps_hw_init_dolphin_v1
input: alps: Use NULL instead dummy argument for alps_identify
input: alps: Fix name, product and version of dev2 input device
input: alps: Add sanity checks for non DualPoint devices
input: alps: Do not report both trackstick and external PS/2 mouse
data to one input device
drivers/input/mouse/alps.c | 361 +++++++++++++++++++++++++++++++-------------
drivers/input/mouse/alps.h | 14 +-
2 files changed, 264 insertions(+), 111 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 1/7] input: alps: Set correct name of psmouse device in alps_init()
From: Pali Rohár @ 2014-11-14 19:38 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede
Cc: Yunkang Tang, Vadim Klishko, linux-input, linux-kernel,
Pali Rohár
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
On some laptops after starting them from off state (not after reboot), function
alps_probe_trackstick_v3() (called from function alps_identify()) does not
detect trackstick. To fix this problem we need to reset device. But function
alps_identify() is called also from alps_detect() and we do not want to reset
device in detect function because it will slow down initialization of all other
non alps devices.
This patch moves code for setting correct device name & protocol from function
alps_detect() to alps_init() which already doing full device reset.
So this patch removes need to do trackstick detection in alps_detect() function.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/input/mouse/alps.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 8d85c79..9ffa98d 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2392,6 +2392,10 @@ int alps_init(struct psmouse *psmouse)
if (input_register_device(priv->dev2))
goto init_fail;
+ if (!(priv->flags & ALPS_DUALPOINT))
+ psmouse->name = "GlidePoint TouchPad";
+ psmouse->model = priv->proto_version;
+
psmouse->protocol_handler = alps_process_byte;
psmouse->poll = alps_poll;
psmouse->disconnect = alps_disconnect;
@@ -2422,11 +2426,18 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
return -1;
if (set_properties) {
+ /*
+ * NOTE: To detect model and trackstick presence we need to do
+ * full device reset. To speed up detection and prevent
+ * calling duplicate initialization sequence (both in
+ * alps_detect() and alps_init()) we set model/protocol
+ * version and correct name in alps_init() (which will
+ * do full device reset). For now set name to DualPoint.
+ */
psmouse->vendor = "ALPS";
- psmouse->name = dummy.flags & ALPS_DUALPOINT ?
- "DualPoint TouchPad" : "GlidePoint";
- psmouse->model = dummy.proto_version << 8;
+ psmouse->name = "DualPoint TouchPad";
}
+
return 0;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH v3 4/4] input: alps: Fix trackstick detection
From: Pali Rohár @ 2014-11-14 19:41 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Hans de Goede, Yunkang Tang, Tommy Will, linux-input,
linux-kernel
In-Reply-To: <201411141222.35319@pali>
[-- Attachment #1: Type: Text/Plain, Size: 2836 bytes --]
On Friday 14 November 2014 12:22:33 Pali Rohár wrote:
> On Sunday 09 November 2014 12:30:03 Pali Rohár wrote:
> > On Sunday 09 November 2014 09:05:04 Dmitry Torokhov wrote:
> > > Hi Pali,
> > >
> > > On Sun, Nov 02, 2014 at 12:25:10AM +0100, Pali Rohár wrote:
> > > > int alps_detect(struct psmouse *psmouse, bool
> > > > set_properties) {
> > > >
> > > > - struct alps_data dummy;
> > > > + unsigned char e6[4];
> > > >
> > > > - if (alps_identify(psmouse, &dummy) < 0)
> > > > - return -1;
> > > > + /*
> > > > + * Try "E6 report".
> > > > + * ALPS should return 0,0,10 or 0,0,100 if no buttons
> > > > are pressed. + * The bits 0-2 of the first byte will be
> > > > 1s if some buttons are + * pressed.
> > > > + */
> > > > + if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES,
> > > > + PSMOUSE_CMD_SETSCALE11, e6))
> > > > + return -EIO;
> > > > +
> > > > + if ((e6[0] & 0xf8) != 0 || e6[1] != 0 || (e6[2] != 10
>
> &&
>
> > > > e6[2] != 100)) + return -EINVAL;
> > > >
> > > > if (set_properties) {
> > > >
> > > > + /*
> > > > + * NOTE: To detect model and trackstick presence we
> >
> > need
> >
> > > > to do + * full device reset. To speed up
> >
> > detection
> >
> > > > and prevent + * calling duplicate
>
> initialization
>
> > > > sequence (both in + * alps_detect() and
> > > > alps_init()) we set model/protocol + * version
>
> and
>
> > > > correct name in alps_init() (which will + *
do
> >
> > full
> >
> > > > device reset). For now set name to DualPoint. + */
> > > >
> > > > psmouse->vendor = "ALPS";
> > > >
> > > > - psmouse->name = dummy.flags & ALPS_DUALPOINT ?
> > > > - "DualPoint TouchPad" : "GlidePoint";
> > > > - psmouse->model = dummy.proto_version << 8;
> > > > + psmouse->name = "DualPoint TouchPad";
> > > >
> > > > }
> > > >
> > > > +
> > > >
> > > > return 0;
> > >
> > > We can't do this; going by e6 only will give us false
> > > positives and alps_detect is supposed to be authoritative.
> > >
> > > Thanks.
> >
> > psmouse-base.c is calling alps_detect() and alps_init()
> > consecutively so it does not matter if code is in _detect or
> > _init function. Just need to make sure that correct order
> > will be used. So this patch could not bring any problems.
> >
> > If psmouse-base.c detect device false-positive as ALPS (with
> > alps_detect()) then it immediately calls alps_init() which
> > fails and psmouse-base.c will try to use another protocol.
>
> Dmitry: PING
> Also see my comment for PATCH v3 3/4.
Dmitry, finally I split this big patch into more smaller and
tried to fix what you did not like. I sent new series of patches,
so drop this one 4/4.
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH 0/7] Fixes for ALPS trackstick
From: Dmitry Torokhov @ 2014-11-14 20:59 UTC (permalink / raw)
To: Pali Rohár
Cc: Hans de Goede, Yunkang Tang, Vadim Klishko, linux-input,
linux-kernel
In-Reply-To: <1415993906-13307-1-git-send-email-pali.rohar@gmail.com>
Hi Pali,
On Friday, November 14, 2014 08:38:19 PM Pali Rohár wrote:
> This patch series fix detection and identifying trackstick on machines with
> ALPS devices. Last patch split trackstick and bare PS/2 mouse packets
> between dev2 and dev3 input devices which make sure that driver will send
> only trackstick data to trackstick input device.
>
Thank you for splitting the change, unfortunately it is now quite big
to apply to 3.18. Any chance you could try implementing what I suggested
in http://www.spinics.net/lists/linux-input/msg34029.html
and then we can do the more comprehensive solution in 3.19.
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [git pull] Input updates for 3.18-rc4
From: Dmitry Torokhov @ 2014-11-14 22:26 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input, Jiri Kosina
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive updates for the input subsystem. Mostly small fixups to PS/2
tochpad drivers (ALPS, Elantech, Synaptics) to better deal with specific
hardware.
Changelog:
---------
NeilBrown (1):
Input: twl4030-pwrbutton - ensure a wakeup event is recorded.
Pali Rohár (3):
Input: alps - ignore potential bare packets when device is out of sync
Input: alps - allow up to 2 invalid packets without resetting device
Input: alps - ignore bad data on Dell Latitudes E6440 and E7440
Takashi Iwai (1):
Input: synaptics - add min/max quirk for Lenovo T440s
Ulrik De Bie (5):
Input: elantech - use elantech_report_trackpoint for hardware v4 too
Input: elantech - fix crc_enabled for Fujitsu H730
Input: elantech - report the middle button of the touchpad
Input: elantech - provide a sysfs knob for crc_enabled
Input: elantech - update the documentation
Diffstat:
--------
Documentation/input/elantech.txt | 81 +++++++++++++++++++++++++++++++---
drivers/input/misc/twl4030-pwrbutton.c | 1 +
drivers/input/mouse/alps.c | 28 +++++++++++-
drivers/input/mouse/elantech.c | 56 +++++++++++++++++++++--
drivers/input/mouse/synaptics.c | 5 ++-
5 files changed, 158 insertions(+), 13 deletions(-)
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* bisected: IR press/release behavior changed in 3.17, repeat events
From: Stephan Raue @ 2014-11-15 17:59 UTC (permalink / raw)
To: linux-input; +Cc: david, m.chehab
Hi
with kernel 3.17 using a RC6 remote with a buildin nuvoton IR receiver
(not tested others, but i think its a common problem) when
pressing/releasing the same button often within 1 second there will no
release event sent. Instead we get repeat events. To get the release
event i must press the same button with a delay of ~ 1sec.
the evtest output for kernel with the difference 3.16 and 3.17 looks like
kernel 3.16
Event: time 1415452412.497503, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1415452412.497503, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452412.497503, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415452412.497503, -------------- SYN_REPORT ------------
Event: time 1415452412.672387, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452412.672387, -------------- SYN_REPORT ------------
Event: time 1415452412.919799, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1415452412.919799, -------------- SYN_REPORT ------------
Event: time 1415452414.363169, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452414.363169, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415452414.363169, -------------- SYN_REPORT ------------
Event: time 1415452414.538010, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452414.538010, -------------- SYN_REPORT ------------
Event: time 1415452414.621916, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1415452414.621916, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452414.621916, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415452414.621916, -------------- SYN_REPORT ------------
Event: time 1415452414.818869, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1415452414.818869, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452414.818869, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415452414.818869, -------------- SYN_REPORT ------------
Event: time 1415452414.994902, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1415452414.994902, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415452414.994902, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415452414.994902, -------------- SYN_REPORT ------------
kernel 3.17
Event: time 1415454057.620687, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454057.620687, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1415454057.620687, -------------- SYN_REPORT ------------
Event: time 1415454057.795567, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454057.795567, -------------- SYN_REPORT ------------
Event: time 1415454057.896636, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454057.896636, -------------- SYN_REPORT ------------
Event: time 1415454058.056369, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.056369, -------------- SYN_REPORT ------------
Event: time 1415454058.210349, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.210349, -------------- SYN_REPORT ------------
Event: time 1415454058.371157, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.371157, -------------- SYN_REPORT ------------
Event: time 1415454058.540551, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.540551, -------------- SYN_REPORT ------------
Event: time 1415454058.622935, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454058.622935, -------------- SYN_REPORT ------------
Event: time 1415454058.696211, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.696211, -------------- SYN_REPORT ------------
Event: time 1415454058.749595, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454058.749595, -------------- SYN_REPORT ------------
Event: time 1415454058.849992, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454058.849992, -------------- SYN_REPORT ------------
Event: time 1415454058.876332, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454058.876332, -------------- SYN_REPORT ------------
Event: time 1415454059.002998, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454059.002998, -------------- SYN_REPORT ------------
Event: time 1415454059.008823, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454059.008823, -------------- SYN_REPORT ------------
Event: time 1415454059.129614, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454059.129614, -------------- SYN_REPORT ------------
Event: time 1415454059.179093, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454059.179093, -------------- SYN_REPORT ------------
Event: time 1415454059.256285, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454059.256285, -------------- SYN_REPORT ------------
Event: time 1415454059.346881, type 4 (EV_MSC), code 4 (MSC_SCAN), value
800f041f
Event: time 1415454059.346881, -------------- SYN_REPORT ------------
Event: time 1415454059.382993, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454059.382993, -------------- SYN_REPORT ------------
Event: time 1415454059.509617, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
Event: time 1415454059.509617, -------------- SYN_REPORT ------------
Event: time 1415454059.596281, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
with irw it looks like:
kernel 3.16
OpenELEC:~ # irw
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
kernel 3.17 (the first 2 presses was pressed with a delay of more then 1
sec:
OpenELEC:~ # irw
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
6c 0 KEY_DOWN devinput
6c 1 KEY_DOWN devinput
6c 2 KEY_DOWN devinput
6c 3 KEY_DOWN devinput
6c 4 KEY_DOWN devinput
6c 5 KEY_DOWN devinput
6c 6 KEY_DOWN devinput
6c 7 KEY_DOWN devinput
6c 8 KEY_DOWN devinput
6c 9 KEY_DOWN devinput
6c a KEY_DOWN devinput
6c b KEY_DOWN devinput
6c c KEY_DOWN devinput
6c d KEY_DOWN devinput
6c e KEY_DOWN devinput
6c f KEY_DOWN devinput
6c 10 KEY_DOWN devinput
6c 11 KEY_DOWN devinput
6c 12 KEY_DOWN devinput
6c 13 KEY_DOWN devinput
6c 14 KEY_DOWN devinput
6c 15 KEY_DOWN devinput
6c 0 KEY_DOWN_UP devinput
i have bisected the issue:
[stephan@buildserver linux-3.17-bisect]$ git bisect good
120703f9eb32033f0e39bdc552c0273c8ab45f33 is the first bad commit
commit 120703f9eb32033f0e39bdc552c0273c8ab45f33
Author: David Härdeman <david@hardeman.nu>
Date: Thu Apr 3 20:31:30 2014 -0300
[media] rc-core: document the protocol type
Right now the protocol information is not preserved, rc-core gets
handed a
scancode but has no idea which protocol it corresponds to.
This patch (which required reading through the source/keymap for
all drivers,
not fun) makes the protocol information explicit which is important
documentation and makes it easier to e.g. support multiple
protocols with one
decoder (think rc5 and rc-streamzap). The information isn't used
yet so there
should be no functional changes.
[m.chehab@samsung.com: rebased, added cxusb and removed bad
whitespacing]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
:040000 040000 3db25c8acb78f27a4c6613e9fddbf9af8d1ea65e
bc5866551b8c1a7dc8d4eaf35def332f20321122 M drivers
:040000 040000 e69773356627779a7cdf905e11619a310fbfaeee
aef9c358ea71385d2b83b498ce1e2c5568f257a7 M include
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: bisected: IR press/release behavior changed in 3.17, repeat events
From: Mauro Carvalho Chehab @ 2014-11-15 18:54 UTC (permalink / raw)
To: Stephan Raue; +Cc: linux-input, david, linux-media
In-Reply-To: <54679469.1010500@openelec.tv>
Hi Stephan,
C/C linux-media, as this is the right ML for IR discussions.
Em Sat, 15 Nov 2014 18:59:05 +0100
Stephan Raue <mailinglists@openelec.tv> escreveu:
> Hi
>
> with kernel 3.17 using a RC6 remote with a buildin nuvoton IR receiver
> (not tested others, but i think its a common problem) when
> pressing/releasing the same button often within 1 second there will no
> release event sent. Instead we get repeat events. To get the release
> event i must press the same button with a delay of ~ 1sec.
>
> the evtest output for kernel with the difference 3.16 and 3.17 looks like
>
> kernel 3.16
>
> Event: time 1415452412.497503, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
> Event: time 1415452412.497503, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452412.497503, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415452412.497503, -------------- SYN_REPORT ------------
> Event: time 1415452412.672387, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452412.672387, -------------- SYN_REPORT ------------
> Event: time 1415452412.919799, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
> Event: time 1415452412.919799, -------------- SYN_REPORT ------------
> Event: time 1415452414.363169, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452414.363169, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415452414.363169, -------------- SYN_REPORT ------------
> Event: time 1415452414.538010, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452414.538010, -------------- SYN_REPORT ------------
> Event: time 1415452414.621916, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
> Event: time 1415452414.621916, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452414.621916, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415452414.621916, -------------- SYN_REPORT ------------
> Event: time 1415452414.818869, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
> Event: time 1415452414.818869, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452414.818869, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415452414.818869, -------------- SYN_REPORT ------------
> Event: time 1415452414.994902, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
> Event: time 1415452414.994902, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415452414.994902, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415452414.994902, -------------- SYN_REPORT ------------
>
>
>
> kernel 3.17
>
> Event: time 1415454057.620687, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454057.620687, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
> Event: time 1415454057.620687, -------------- SYN_REPORT ------------
> Event: time 1415454057.795567, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454057.795567, -------------- SYN_REPORT ------------
> Event: time 1415454057.896636, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454057.896636, -------------- SYN_REPORT ------------
> Event: time 1415454058.056369, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.056369, -------------- SYN_REPORT ------------
> Event: time 1415454058.210349, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.210349, -------------- SYN_REPORT ------------
> Event: time 1415454058.371157, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.371157, -------------- SYN_REPORT ------------
> Event: time 1415454058.540551, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.540551, -------------- SYN_REPORT ------------
> Event: time 1415454058.622935, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454058.622935, -------------- SYN_REPORT ------------
> Event: time 1415454058.696211, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.696211, -------------- SYN_REPORT ------------
> Event: time 1415454058.749595, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454058.749595, -------------- SYN_REPORT ------------
> Event: time 1415454058.849992, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454058.849992, -------------- SYN_REPORT ------------
> Event: time 1415454058.876332, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454058.876332, -------------- SYN_REPORT ------------
> Event: time 1415454059.002998, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454059.002998, -------------- SYN_REPORT ------------
> Event: time 1415454059.008823, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454059.008823, -------------- SYN_REPORT ------------
> Event: time 1415454059.129614, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454059.129614, -------------- SYN_REPORT ------------
> Event: time 1415454059.179093, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454059.179093, -------------- SYN_REPORT ------------
> Event: time 1415454059.256285, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454059.256285, -------------- SYN_REPORT ------------
> Event: time 1415454059.346881, type 4 (EV_MSC), code 4 (MSC_SCAN), value
> 800f041f
> Event: time 1415454059.346881, -------------- SYN_REPORT ------------
> Event: time 1415454059.382993, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454059.382993, -------------- SYN_REPORT ------------
> Event: time 1415454059.509617, type 1 (EV_KEY), code 108 (KEY_DOWN), value 2
> Event: time 1415454059.509617, -------------- SYN_REPORT ------------
> Event: time 1415454059.596281, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
>
> with irw it looks like:
>
> kernel 3.16
> OpenELEC:~ # irw
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
>
> kernel 3.17 (the first 2 presses was pressed with a delay of more then 1
> sec:
> OpenELEC:~ # irw
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
> 6c 0 KEY_DOWN devinput
> 6c 1 KEY_DOWN devinput
> 6c 2 KEY_DOWN devinput
> 6c 3 KEY_DOWN devinput
> 6c 4 KEY_DOWN devinput
> 6c 5 KEY_DOWN devinput
> 6c 6 KEY_DOWN devinput
> 6c 7 KEY_DOWN devinput
> 6c 8 KEY_DOWN devinput
> 6c 9 KEY_DOWN devinput
> 6c a KEY_DOWN devinput
> 6c b KEY_DOWN devinput
> 6c c KEY_DOWN devinput
> 6c d KEY_DOWN devinput
> 6c e KEY_DOWN devinput
> 6c f KEY_DOWN devinput
> 6c 10 KEY_DOWN devinput
> 6c 11 KEY_DOWN devinput
> 6c 12 KEY_DOWN devinput
> 6c 13 KEY_DOWN devinput
> 6c 14 KEY_DOWN devinput
> 6c 15 KEY_DOWN devinput
> 6c 0 KEY_DOWN_UP devinput
>
>
> i have bisected the issue:
>
> [stephan@buildserver linux-3.17-bisect]$ git bisect good
> 120703f9eb32033f0e39bdc552c0273c8ab45f33 is the first bad commit
> commit 120703f9eb32033f0e39bdc552c0273c8ab45f33
> Author: David Härdeman <david@hardeman.nu>
> Date: Thu Apr 3 20:31:30 2014 -0300
>
> [media] rc-core: document the protocol type
>
> Right now the protocol information is not preserved, rc-core gets
> handed a
> scancode but has no idea which protocol it corresponds to.
>
> This patch (which required reading through the source/keymap for
> all drivers,
> not fun) makes the protocol information explicit which is important
> documentation and makes it easier to e.g. support multiple
> protocols with one
> decoder (think rc5 and rc-streamzap). The information isn't used
> yet so there
> should be no functional changes.
>
> [m.chehab@samsung.com: rebased, added cxusb and removed bad
> whitespacing]
> Signed-off-by: David Härdeman <david@hardeman.nu>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
>
> :040000 040000 3db25c8acb78f27a4c6613e9fddbf9af8d1ea65e
> bc5866551b8c1a7dc8d4eaf35def332f20321122 M drivers
> :040000 040000 e69773356627779a7cdf905e11619a310fbfaeee
> aef9c358ea71385d2b83b498ce1e2c5568f257a7 M include
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v4 2/6] input: touchscreen: ti_am335x_tsc: Remove udelay in interrupt handler
From: Richard Cochran @ 2014-11-15 19:27 UTC (permalink / raw)
To: Vignesh R
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
Benoit Cousson, Tony Lindgren, Russell King, Jonathan Cameron,
Hartmut Knaack, Dmitry Torokhov, Lee Jones,
Sebastian Andrzej Siewior, Lars-Peter Clausen, Peter Meerwald,
Samuel Ortiz, Felipe Balbi, Brad Griffis, Sanjeev Sharma,
Paul Gortmaker, Jan Kardell, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap
In-Reply-To: <1415941651-28962-3-git-send-email-vigneshr-l0cyMroinI0@public.gmane.org>
On Fri, Nov 14, 2014 at 10:37:27AM +0530, Vignesh R wrote:
> From: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
>
> TSC interrupt handler had udelay to avoid reporting of false pen-up
> interrupt to user space. This patch implements workaround suggesting in
> Advisory 1.0.31 of silicon errata for am335x, thus eliminating udelay
> and touchscreen lag. This also improves performance of touchscreen and
> eliminates sudden jump of cursor at touch release.
I back ported this series onto v3.15.1 in order to try this out on a
custom, beaglebone-like board. With this series, the touch is really
broken. (I had fixed the pen up problem in a totally different way for
a customer, and so I wanted to try out your solution.)
I will try to port the board code to a more recent kernel to try your
series again. With which kernel version did you test your patches?
And which board?
Thanks,
Richard
^ permalink raw reply
* LEN2006 Synaptics touchpad min max fix
From: Ben Sagal @ 2014-11-15 21:09 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov
RE bug: https://bugzilla.kernel.org/show_bug.cgi?id=88211
The LEN2006 Synaptics touchpad (as found in my thinkpad E540) returns
wrong min max values.
touchpad-edge-detector output:
> Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event6
> Move one finger around the touchpad to detect the actual edges
> Kernel says: x [1472..5674], y [1408..4684]
> Touchpad sends: x [1264..5675], y [1171..4688]
the patch is against 3.17.2
Signed-off-by: Binyamin Sagal <bensagal@gmail.com>
---
diff -uNr linux.org/drivers/input/mouse/synaptics.c
linux/drivers/input/mouse/synaptics.c
--- linux.org/drivers/input/mouse/synaptics.c 2014-11-14
12:18:39.000000000 +0200
+++ linux/drivers/input/mouse/synaptics.c 2014-11-14 08:25:05.963395004 +0200
@@ -143,6 +143,10 @@
(const char * const []){"LEN2001", NULL},
1024, 5022, 2508, 4832
},
+ {
+ (const char * const []){"LEN2006", NULL},
+ 1264, 5675, 1171, 4688
+ },
{ }
};
^ permalink raw reply
* [PATCH] HID: i2c-hid: fix race condition reading reports
From: Antonio Borneo @ 2014-11-16 14:44 UTC (permalink / raw)
To: Jiri Kosina, linux-input, Benjamin Tissoires
Cc: linux-kernel, Jean-Baptiste Maneyrol, Antonio Borneo, stable
From: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
From: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Current driver uses a common buffer for reading reports either
synchronously in i2c_hid_get_raw_report() and asynchronously in
the interrupt handler.
There is race condition if an interrupt arrives immediately after
the report is received in i2c_hid_get_raw_report(); the common
buffer is modified by the interrupt handler with the new report
and then i2c_hid_get_raw_report() proceed using wrong data.
Fix it by using a separate buffers for asynchronous reports.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
[Antonio Borneo: cleanup and rebase to v3.17]
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Cc: stable@vger.kernel.org
---
Hi Jiri, Benjamin,
I think this patch should also go through linux-stable.
Confirmation from our side is welcome.
Regards,
Antonio
drivers/hid/i2c-hid/i2c-hid.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 933bf10..7c80e96 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -136,6 +136,7 @@ struct i2c_hid {
* register of the HID
* descriptor. */
unsigned int bufsize; /* i2c buffer size */
+ char *irqinbuf; /* Asynchronous Input buffer */
char *inbuf; /* Input buffer */
char *cmdbuf; /* Command buffer */
char *argsbuf; /* Command arguments buffer */
@@ -371,7 +372,7 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
int ret, ret_size;
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
- ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
+ ret = i2c_master_recv(ihid->client, ihid->irqinbuf, size);
if (ret != size) {
if (ret < 0)
return;
@@ -381,7 +382,7 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
return;
}
- ret_size = ihid->inbuf[0] | ihid->inbuf[1] << 8;
+ ret_size = ihid->irqinbuf[0] | ihid->irqinbuf[1] << 8;
if (!ret_size) {
/* host or device initiated RESET completed */
@@ -396,11 +397,11 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
return;
}
- i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
+ i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->irqinbuf);
if (test_bit(I2C_HID_STARTED, &ihid->flags))
- hid_input_report(ihid->hid, HID_INPUT_REPORT, ihid->inbuf + 2,
- ret_size - 2, 1);
+ hid_input_report(ihid->hid, HID_INPUT_REPORT,
+ ihid->irqinbuf + 2, ret_size - 2, 1);
return;
}
@@ -503,9 +504,11 @@ static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type,
static void i2c_hid_free_buffers(struct i2c_hid *ihid)
{
+ kfree(ihid->irqinbuf);
kfree(ihid->inbuf);
kfree(ihid->argsbuf);
kfree(ihid->cmdbuf);
+ ihid->irqinbuf = NULL;
ihid->inbuf = NULL;
ihid->cmdbuf = NULL;
ihid->argsbuf = NULL;
@@ -521,11 +524,13 @@ static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size)
sizeof(__u16) + /* size of the report */
report_size; /* report */
+ ihid->irqinbuf = kzalloc(report_size, GFP_KERNEL);
ihid->inbuf = kzalloc(report_size, GFP_KERNEL);
ihid->argsbuf = kzalloc(args_len, GFP_KERNEL);
ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL);
- if (!ihid->inbuf || !ihid->argsbuf || !ihid->cmdbuf) {
+ if (!ihid->irqinbuf || !ihid->inbuf ||
+ !ihid->argsbuf || !ihid->cmdbuf) {
i2c_hid_free_buffers(ihid);
return -ENOMEM;
}
--
2.1.3
^ permalink raw reply related
* [PATCH] HID: i2c-hid: print the correct data in dbg msg
From: Antonio Borneo @ 2014-11-16 14:45 UTC (permalink / raw)
To: Jiri Kosina, linux-input, Benjamin Tissoires
Cc: linux-kernel, Jean-Baptiste Maneyrol, Antonio Borneo
From: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
From: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Report is received in "buffer"; fix the following i2c_hid_dbg()
to dump data from the correct pointer.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
[Antonio Borneo: cleanup and rebase to v3.17]
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
---
drivers/hid/i2c-hid/i2c-hid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 747d544..933bf10 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -437,7 +437,7 @@ static void i2c_hid_init_report(struct hid_report *report, u8 *buffer,
report->id, buffer, size))
return;
- i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, ihid->inbuf);
+ i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, buffer);
ret_size = buffer[0] | (buffer[1] << 8);
--
2.1.3
^ permalink raw reply related
* [PATCH] Input: atkbd - correct MSC_SCAN events for force_release keys
From: Stefan Brüns @ 2014-11-16 22:18 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov
Without the change either no scancode would be reported on release
of force_release keys, or - if the key is marked as force_release
erroneously - the release event and the scancode would be reported
in separate reports to the input layer.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---
Originally sent on 28.9.2014, but somehow got lost.
Resending as per Dmitrys request from 24.10.2014
drivers/input/keyboard/atkbd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 2dd1d0d..6375ae6 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -456,8 +456,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio,
unsigned char data,
keycode = atkbd->keycode[code];
- if (keycode != ATKBD_KEY_NULL)
- input_event(dev, EV_MSC, MSC_SCAN, code);
+ if (!(atkbd->release && test_bit(code, atkbd->force_release_mask)))
+ if (keycode != ATKBD_KEY_NULL)
+ input_event(dev, EV_MSC, MSC_SCAN, code);
switch (keycode) {
case ATKBD_KEY_NULL:
@@ -511,6 +512,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio,
unsigned char data,
input_sync(dev);
if (value && test_bit(code, atkbd->force_release_mask)) {
+ input_event(dev, EV_MSC, MSC_SCAN, code);
input_report_key(dev, keycode, 0);
input_sync(dev);
}
--
1.8.4.5
--
Stefan Brüns / Bergstraße 21 / 52062 Aachen
home: +49 241 53809034 mobile: +49 151 50412019
work: +49 2405 49936-424
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 001/001] hid-sony.c: add sysfs provisioning
From: bri @ 2014-11-16 18:18 UTC (permalink / raw)
To: Frank Praznik, Jiri Kosina, Henrik Rydberg
Cc: open list:HID CORE LAYER, open list, Michael Kerrisk
Add some sysfs interfaces to cover some corner use cases when provisioning:
1) Allow read access to the IDA index through device/gamepad_number. The
IDA index is used to identify the device to the user as the "controller number"
and is reflected via the initial LED states when plugged in. This sysfs
attribute could be used by userspace for a more seamless transition to
userspace drivers without controller numbers changing. Write access is not
addressed as it raises the issue of a global IDA that works across different
gamepad drivers. Internally, remove the use of the term "device_id" for
the gamepad number for code grepability purposes.
2) Allow manual provisioning of the Sixaxis/Dualshock3 USB "pairing" process
through device/master_bdaddr. The bluez plugin has removed the need for
sixpair.c or other such utilities for the common use case of autoprovisioning.
Under less usual situations, the bluez behavior may not be desired, e.g.
if you need to pair a gamepad with a different machine, see what machine
a pad is paired to, or restore old pairings after use. This removes
the need to use sixpair.c or roll-your-own libusb code for that sort
of thing.
Signed-off-by: Brian S. Julin <bri@abrij.org>
Tested-by: Brian S. Julin <bri@abrij.org>
---
I've tested with both SixAxis and Dualshock 3 on stock Debian kernel 3.16.5.
I've also tested a copy of the 3.18 git version inserted into the 3.16.5
kernel. The patch should apply to both (with fuzz on the newer version.)
Tests are still needed on pure 3.18.
I do not have access to the non-Sony pads handled by this driver, but did
test the with a Dualshock4 to ensure that the sysfs files are harmless
vestigials for such devices.
It has been a long time since I popped the hood on the kernel and much
has changed. I'm unclear as to under what conditions hid-core relieves
the need to lock. Some review is definitely needed there.
General comment on the driver: when a gamepad being used over
BT is plugged back in to USB, it continues to use BT rather than
switching to USB. This has both benefits and disadvantages.
On the bright side, this prevents the evdev and js devices from being
destroyed and recreated. Some applications, many closed-source, may
not respond well to that even when udev rules are used to pin the
device names.
On the other hand this is not the behavior gamers expect and will not
help matters if the reason for plugging the pad in was to decrease
latency due to RF contention.
I notice that sysfs-rules.txt mentions that a device's parentage in
the tree may change, and teaching the hid core to allow graceful
takeover of a device by a different host/bus driver for these
devices might be a use case for that.
--- drivers/hid/hid-sony.c.orig 2014-11-05 20:32:47.387599486 -0500
+++ drivers/hid/hid-sony.c 2014-11-14 20:35:28.327053036 -0500
@@ -8,6 +8,7 @@
* Copyright (c) 2012 David Dillow <dave@thedillows.org>
* Copyright (c) 2006-2013 Jiri Kosina
* Copyright (c) 2013 Colin Leitner <colin.leitner@gmail.com>
+ * Copyright (c) 2014 Brian S. Julin <bri@abrij.org>
*/
/*
@@ -35,6 +36,9 @@
#include <linux/list.h>
#include <linux/idr.h>
#include <linux/input/mt.h>
+#include <linux/ctype.h>
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
#include "hid-ids.h"
@@ -750,7 +754,7 @@ union sixaxis_output_report_01 {
static spinlock_t sony_dev_list_lock;
static LIST_HEAD(sony_device_list);
-static DEFINE_IDA(sony_device_id_allocator);
+static DEFINE_IDA(sony_gamepad_number_allocator);
struct sony_sc {
spinlock_t lock;
@@ -760,7 +764,7 @@ struct sony_sc {
unsigned long quirks;
struct work_struct state_worker;
struct power_supply battery;
- int device_id;
+ int gamepad_number;
#ifdef CONFIG_SONY_FF
__u8 left;
@@ -1321,7 +1325,8 @@ static int sony_leds_init(struct sony_sc
if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
return -ENODEV;
} else if (sc->quirks & DUALSHOCK4_CONTROLLER) {
- dualshock4_set_leds_from_id(sc->device_id, initial_values);
+ dualshock4_set_leds_from_id(sc->gamepad_number,
+ initial_values);
initial_values[3] = 1;
sc->led_count = 4;
memset(max_brightness, 255, 3);
@@ -1330,7 +1335,7 @@ static int sony_leds_init(struct sony_sc
name_len = 0;
name_fmt = "%s:%s";
} else {
- sixaxis_set_leds_from_id(sc->device_id, initial_values);
+ sixaxis_set_leds_from_id(sc->gamepad_number, initial_values);
sc->led_count = 4;
memset(use_hw_blink, 1, 4);
use_ds4_names = 0;
@@ -1758,38 +1763,209 @@ static int sony_check_add(struct sony_sc
return sony_check_add_dev_list(sc);
}
-static int sony_set_device_id(struct sony_sc *sc)
+/* PS3 pads do not pair over bluetooth; Instead a USB handshake is used. */
+static ssize_t sony_master_bdaddr_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct sony_sc *sc = hid_get_drvdata(hdev);
+ size_t count;
+ unsigned char msg[8];
+ int ret;
+
+ if (!sc) {
+ hid_err(hdev, "No device data\n");
+ return 0;
+ }
+
+ if (sc->quirks & SIXAXIS_CONTROLLER_BT) {
+ struct device *parent;
+
+ parent = dev->parent;
+ if (!parent)
+ return 0;
+ parent = parent->parent;
+ if (!parent || !parent->type
+ || strcmp(parent->type->name, "host"))
+ return 0;
+
+ count = scnprintf(buf, PAGE_SIZE, "%pMR\n",
+ &(to_hci_dev(parent)->bdaddr));
+ return count;
+ }
+
+ if (!(sc->quirks & SIXAXIS_CONTROLLER_USB))
+ return 0;
+
+ ret = hid_hw_raw_request(hdev, 0xf5, msg, sizeof(msg),
+ HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
+ if (ret < 0) {
+ /* This matches bluez error message */
+ hid_err(hdev, "failed to read master address\n");
+ return 0;
+ }
+
+ count = scnprintf(buf, PAGE_SIZE, "%pM\n", msg + 2);
+ return count;
+}
+
+/*
+ * This could probably be useful in lib/.
+ *
+ * Convert a string to a MAC address, accepting multiple formats.
+ *
+ * Will take most commonly cut-and-pasted formats without being too liberal.
+ * Accepts any hex with delims [-:.] between any octets, no mixing delims,
+ * no splitting octets.
+ *
+ * *buf should have at least 6 bytes of space and will not be altered on fail
+ * Will halt at null terminator or before reading more than lim chars from *c
+ * Return code is sscanf-style: number of non-null bytes read, or 0 on failure
+ */
+static int sony_kstrntomac(const char *c, u8 *buf, size_t lim)
+{
+ int cnt = 0;
+ int dcnt = 0;
+ char delim = '\0';
+ u8 octet[6];
+
+ while (cnt < 6) {
+ if (lim < 2 || !isxdigit(*c) || !isxdigit(*(c+1)))
+ return 0;
+
+ lim -= 2;
+
+ if (isdigit(*c))
+ octet[cnt] = (*c - '0') << 4;
+ else
+ octet[cnt] = (tolower(*c) - 'a' + 10) << 4;
+ c++;
+
+ if (isdigit(*c))
+ octet[cnt] |= *c - '0';
+ else
+ octet[cnt] |= tolower(*c) - 'a' + 10;
+ c++;
+
+ if (cnt < 5) {
+ if (!lim)
+ return 0;
+ if (!delim && (*c == '-' || *c == ':' || *c == '.'))
+ delim = *c;
+ if (delim && *c == delim) {
+ dcnt++;
+ c++;
+ lim--;
+ }
+ }
+ cnt++;
+ }
+
+ memcpy(buf, octet, 6);
+
+ return cnt * 2 + dcnt;
+}
+
+static ssize_t sony_master_bdaddr_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct sony_sc *sc = hid_get_drvdata(hdev);
+ u8 msg[8];
+ int ret;
+
+ if (!sc) {
+ hid_err(hdev, "No device data\n");
+ return -EBADFD;
+ }
+
+ if (!(sc->quirks & SIXAXIS_CONTROLLER_USB)) {
+ if (sc->quirks & SIXAXIS_CONTROLLER_BT) {
+ hid_err(hdev,
+ "To set master disconnect BT then use USB\n");
+ return -EOPNOTSUPP;
+ }
+ return -ENOTSUPP;
+ }
+
+ msg[0] = 0x01;
+ msg[1] = 0x00;
+
+ if (!sony_kstrntomac(buf, msg + 2, count))
+ return -EINVAL;
+
+ ret = hid_hw_raw_request(hdev, 0xf5, msg, sizeof(msg),
+ HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+ if (ret < 0) {
+ /* This matches bluez error message */
+ hid_err(hdev, "failed to write master address\n");
+ return count;
+ }
+
+ return count;
+}
+
+static DEVICE_ATTR(master_bdaddr, S_IRUGO | S_IWUSR,
+ sony_master_bdaddr_show, sony_master_bdaddr_store);
+
+static int sony_set_gamepad_number(struct sony_sc *sc)
{
int ret;
/*
- * Only DualShock 4 or Sixaxis controllers get an id.
+ * Only DualShock 4 or Sixaxis controllers get a number.
* All others are set to -1.
*/
if ((sc->quirks & SIXAXIS_CONTROLLER) ||
(sc->quirks & DUALSHOCK4_CONTROLLER)) {
- ret = ida_simple_get(&sony_device_id_allocator, 0, 0,
- GFP_KERNEL);
+ ret = ida_simple_get(&sony_gamepad_number_allocator, 0, 0,
+ GFP_KERNEL);
if (ret < 0) {
- sc->device_id = -1;
+ sc->gamepad_number = -1;
return ret;
}
- sc->device_id = ret;
+ sc->gamepad_number = ret;
} else {
- sc->device_id = -1;
+ sc->gamepad_number = -1;
}
return 0;
}
-static void sony_release_device_id(struct sony_sc *sc)
+static void sony_release_gamepad_number(struct sony_sc *sc)
{
- if (sc->device_id >= 0) {
- ida_simple_remove(&sony_device_id_allocator, sc->device_id);
- sc->device_id = -1;
+ if (sc->gamepad_number >= 0) {
+ ida_simple_remove(&sony_gamepad_number_allocator,
+ sc->gamepad_number);
+ sc->gamepad_number = -1;
}
}
+static ssize_t sony_gamepad_number_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+ struct sony_sc *sc = hid_get_drvdata(hdev);
+ size_t count;
+
+ if (!sc) {
+ hid_err(hdev, "No device data\n");
+ return 0;
+ }
+
+ if (sc->gamepad_number < 0)
+ return 0;
+
+ /* Add one to match console user expectations */
+ count = scnprintf(buf, PAGE_SIZE, "%i\n", sc->gamepad_number + 1);
+ return count;
+}
+
+static DEVICE_ATTR(gamepad_number, S_IRUGO, sony_gamepad_number_show, NULL);
+
static inline void sony_init_work(struct sony_sc *sc,
void (*worker)(struct work_struct *))
{
@@ -1841,10 +2017,22 @@ static int sony_probe(struct hid_device
return ret;
}
- ret = sony_set_device_id(sc);
+ ret = sony_set_gamepad_number(sc);
if (ret < 0) {
- hid_err(hdev, "failed to allocate the device id\n");
- goto err_stop;
+ hid_err(hdev, "failed to allocate the gamepad number\n");
+ goto err_nosysfs2;
+ }
+
+ ret = device_create_file(&hdev->dev, &dev_attr_gamepad_number);
+ if (ret) {
+ hid_err(hdev, "failed to create gamepad_number sysfs file\n");
+ goto err_nosysfs2;
+ }
+
+ ret = device_create_file(&hdev->dev, &dev_attr_master_bdaddr);
+ if (ret) {
+ hid_err(hdev, "failed to create master_bdaddr sysfs file\n");
+ goto err_nosysfs1;
}
if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
@@ -1932,13 +2120,17 @@ static int sony_probe(struct hid_device
err_close:
hid_hw_close(hdev);
err_stop:
+ device_remove_file(&hdev->dev, &dev_attr_master_bdaddr);
+err_nosysfs1:
+ device_remove_file(&hdev->dev, &dev_attr_gamepad_number);
+err_nosysfs2:
if (sc->quirks & SONY_LED_SUPPORT)
sony_leds_remove(sc);
if (sc->quirks & SONY_BATTERY_SUPPORT)
sony_battery_remove(sc);
sony_cancel_work_sync(sc);
sony_remove_dev_list(sc);
- sony_release_device_id(sc);
+ sony_release_gamepad_number(sc);
hid_hw_stop(hdev);
return ret;
}
@@ -1959,7 +2151,11 @@ static void sony_remove(struct hid_devic
sony_remove_dev_list(sc);
- sony_release_device_id(sc);
+ device_remove_file(&hdev->dev, &dev_attr_master_bdaddr);
+
+ device_remove_file(&hdev->dev, &dev_attr_gamepad_number);
+
+ sony_release_gamepad_number(sc);
hid_hw_stop(hdev);
}
@@ -2017,7 +2213,7 @@ static void __exit sony_exit(void)
{
dbg_hid("Sony:%s\n", __func__);
- ida_destroy(&sony_device_id_allocator);
+ ida_destroy(&sony_gamepad_number_allocator);
hid_unregister_driver(&sony_driver);
}
module_init(sony_init);
^ permalink raw reply
* Re: [PATCH] Input: atkbd - correct MSC_SCAN events for force_release keys
From: Dmitry Torokhov @ 2014-11-17 2:25 UTC (permalink / raw)
To: Stefan Brüns; +Cc: linux-input
In-Reply-To: <45706882.ZrxtpIdaNX@pebbles.site>
On Sun, Nov 16, 2014 at 11:18:31PM +0100, Stefan Brüns wrote:
> Without the change either no scancode would be reported on release
> of force_release keys, or - if the key is marked as force_release
> erroneously - the release event and the scancode would be reported
> in separate reports to the input layer.
>
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
> ---
>
> Originally sent on 28.9.2014, but somehow got lost.
> Resending as per Dmitrys request from 24.10.2014
Applied, thank you, but please next time don't use Kmail for patches -
it line-wrapped the patch and encoded it as quoted-printable.
Thanks!
>
> drivers/input/keyboard/atkbd.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
> index 2dd1d0d..6375ae6 100644
> --- a/drivers/input/keyboard/atkbd.c
> +++ b/drivers/input/keyboard/atkbd.c
> @@ -456,8 +456,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio,
> unsigned char data,
>
> keycode = atkbd->keycode[code];
>
> - if (keycode != ATKBD_KEY_NULL)
> - input_event(dev, EV_MSC, MSC_SCAN, code);
> + if (!(atkbd->release && test_bit(code, atkbd->force_release_mask)))
> + if (keycode != ATKBD_KEY_NULL)
> + input_event(dev, EV_MSC, MSC_SCAN, code);
>
> switch (keycode) {
> case ATKBD_KEY_NULL:
> @@ -511,6 +512,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio,
> unsigned char data,
> input_sync(dev);
>
> if (value && test_bit(code, atkbd->force_release_mask)) {
> + input_event(dev, EV_MSC, MSC_SCAN, code);
> input_report_key(dev, keycode, 0);
> input_sync(dev);
> }
> --
> 1.8.4.5
>
>
> --
> Stefan Brüns / Bergstraße 21 / 52062 Aachen
> home: +49 241 53809034 mobile: +49 151 50412019
> work: +49 2405 49936-424
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox