mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Dmitry Torokhov <dtor@mail.ru>
Subject: [054/143] Input: elantech - use all 3 bytes when checking version
Date: Thu, 05 May 2011 17:20:39 -0700	[thread overview]
Message-ID: <20110506002210.506130982@clark.kroah.org> (raw)
In-Reply-To: <20110506002311.GA15354@kroah.com>

2.6.32-longterm review patch.  If anyone has any objections, please let us know.

------------------

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

commit 504e8beed161bd11a2c6cbb8aaf352c14d39b5bb upstream.

Apparently all 3 bytes returned by ETP_FW_VERSION_QUERY are significant
and should be taken into account when matching hardware version/features.

Tested-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/input/mouse/elantech.c |   24 ++++++++++++------------
 drivers/input/mouse/elantech.h |    5 ++---
 2 files changed, 14 insertions(+), 15 deletions(-)

--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -184,7 +184,7 @@ static void elantech_report_absolute_v1(
 	int fingers;
 	static int old_fingers;
 
-	if (etd->fw_version_maj == 0x01) {
+	if (etd->fw_version < 0x020000) {
 		/*
 		 * byte 0:  D   U  p1  p2   1  p3   R   L
 		 * byte 1:  f   0  th  tw  x9  x8  y9  y8
@@ -226,7 +226,7 @@ static void elantech_report_absolute_v1(
 	input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
 	input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
 
-	if ((etd->fw_version_maj == 0x01) &&
+	if (etd->fw_version < 0x020000 &&
 	    (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
 		/* rocker up */
 		input_report_key(dev, BTN_FORWARD, packet[0] & 0x40);
@@ -320,7 +320,7 @@ static int elantech_check_parity_v1(stru
 	unsigned char p1, p2, p3;
 
 	/* Parity bits are placed differently */
-	if (etd->fw_version_maj == 0x01) {
+	if (etd->fw_version < 0x020000) {
 		/* byte 0:  D   U  p1  p2   1  p3   R   L */
 		p1 = (packet[0] & 0x20) >> 5;
 		p2 = (packet[0] & 0x10) >> 4;
@@ -456,7 +456,7 @@ static void elantech_set_input_params(st
 	switch (etd->hw_version) {
 	case 1:
 		/* Rocker button */
-		if ((etd->fw_version_maj == 0x01) &&
+		if (etd->fw_version < 0x020000 &&
 		    (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
 			__set_bit(BTN_FORWARD, dev->keybit);
 			__set_bit(BTN_BACK, dev->keybit);
@@ -685,15 +685,14 @@ int elantech_init(struct psmouse *psmous
 		pr_err("elantech.c: failed to query firmware version.\n");
 		goto init_fail;
 	}
-	etd->fw_version_maj = param[0];
-	etd->fw_version_min = param[2];
+
+	etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
 
 	/*
 	 * Assume every version greater than this is new EeePC style
 	 * hardware with 6 byte packets
 	 */
-	if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) ||
-	    etd->fw_version_maj > 0x02) {
+	if (etd->fw_version >= 0x020030) {
 		etd->hw_version = 2;
 		/* For now show extra debug information */
 		etd->debug = 1;
@@ -703,8 +702,9 @@ int elantech_init(struct psmouse *psmous
 		etd->hw_version = 1;
 		etd->paritycheck = 1;
 	}
-	pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n",
-		etd->hw_version, etd->fw_version_maj, etd->fw_version_min);
+
+	pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n",
+		etd->hw_version, param[0], param[1], param[2]);
 
 	if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) {
 		pr_err("elantech.c: failed to query capabilities.\n");
@@ -719,8 +719,8 @@ int elantech_init(struct psmouse *psmous
 	 * a touch action starts causing the mouse cursor or scrolled page
 	 * to jump. Enable a workaround.
 	 */
-	if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) {
-		pr_info("elantech.c: firmware version 2.34 detected, "
+	if (etd->fw_version == 0x020022) {
+		pr_info("elantech.c: firmware version 2.0.34 detected, "
 			"enabling jumpy cursor workaround\n");
 		etd->jumpy_cursor = 1;
 	}
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -100,11 +100,10 @@ struct elantech_data {
 	unsigned char reg_26;
 	unsigned char debug;
 	unsigned char capabilities;
-	unsigned char fw_version_maj;
-	unsigned char fw_version_min;
-	unsigned char hw_version;
 	unsigned char paritycheck;
 	unsigned char jumpy_cursor;
+	unsigned char hw_version;
+	unsigned int  fw_version;
 	unsigned char parity[256];
 };
 



  parent reply	other threads:[~2011-05-06  0:54 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  0:23 [000/143] 2.6.32.40-longterm review Greg KH
2011-05-06  0:19 ` [001/143] ath: add missing regdomain pair 0x5c mapping Greg KH
2011-05-06  0:19 ` [002/143] block, blk-sysfs: Fix an err return path in blk_register_queue() Greg KH
2011-05-06  0:19 ` [003/143] p54: Initialize extra_len in p54_tx_80211 Greg KH
2011-05-06  0:19 ` [004/143] intel-iommu: Unlink domain from iommu Greg KH
2011-05-06  0:19 ` [005/143] intel-iommu: Fix get_domain_for_dev() error path Greg KH
2011-05-06  0:19 ` [006/143] drm/radeon/kms: fix bad shift in atom iio table parser Greg KH
2011-05-06  0:19 ` [007/143] NFS: nfs_wcc_update_inode() should set nfsi->attr_gencount Greg KH
2011-05-06  0:19 ` [008/143] serial/imx: read cts state only after acking cts change irq Greg KH
2011-05-06  0:19 ` [009/143] ASoC: Fix output PGA enabling in wm_hubs CODECs Greg KH
2011-05-06  0:19 ` [010/143] kconfig: Avoid buffer underrun in choice input Greg KH
2011-05-06  0:19 ` [011/143] UBIFS: fix master node recovery Greg KH
2011-05-06  0:19 ` [012/143] Remove extra struct page member from the buffer info structure Greg KH
2011-05-06  0:19 ` [013/143] [S390] dasd: correct device table Greg KH
2011-05-06  0:19 ` [014/143] iwlagn: Support new 5000 microcode Greg KH
2011-05-06  0:20 ` [015/143] atl1c: duplicate atl1c_get_tpd Greg KH
2011-05-06  0:20 ` [016/143] udp: Fix bogus UFO packet generation Greg KH
2011-05-06  0:20 ` [017/143] [PARISC] slub: fix panic with DISCONTIGMEM Greg KH
2011-05-06  0:20 ` [018/143] [PARISC] set memory ranges in N_NORMAL_MEMORY when onlined Greg KH
2011-05-06  0:20 ` [019/143] [media] FLEXCOP-PCI: fix __xlate_proc_name-warning for flexcop-pci Greg KH
2011-05-06  0:20 ` [020/143] m68k/mm: Set all online nodes in N_NORMAL_MEMORY Greg KH
2011-05-06  0:20 ` [021/143] nfs: dont lose MS_SYNCHRONOUS on remount of noac mount Greg KH
2011-05-06  0:20 ` [022/143] NFSv4.1: Ensure state manager thread dies on last umount Greg KH
2011-05-06  0:20 ` [023/143] agp: fix arbitrary kernel memory writes Greg KH
2011-05-06  0:20 ` [024/143] agp: fix OOM and buffer overflow Greg KH
2011-05-06  0:20 ` [025/143] Input: xen-kbdfront - fix mouse getting stuck after save/restore Greg KH
2011-05-06  0:20 ` [026/143] [SCSI] pmcraid: reject negative request size Greg KH
2011-05-06  0:20 ` [027/143] [SCSI] mpt2sas: prevent heap overflows and unchecked reads Greg KH
2011-05-06  0:20 ` [028/143] [SCSI] put stricter guards on queue dead checks Greg KH
2011-05-06  0:20 ` [029/143] mmc: sdhci-pci: Fix error case in sdhci_pci_probe_slot() Greg KH
2011-05-06  0:20 ` [030/143] mmc: sdhci: Check mrq->cmd in sdhci_tasklet_finish Greg KH
2011-05-06  0:20 ` [031/143] mmc: sdhci: Check mrq != NULL " Greg KH
2011-05-06  0:20 ` [032/143] USB: fix regression in usbip by setting has_tt flag Greg KH
2011-05-06  0:20 ` [033/143] x86, AMD: Fix APIC timer erratum 400 affecting K8 Rev.A-E processors Greg KH
2011-05-06  0:20 ` [034/143] af_unix: Only allow recv on connected seqpacket sockets Greg KH
2011-05-06  0:20 ` [035/143] ARM: 6891/1: prevent heap corruption in OABI semtimedop Greg KH
2011-05-06  0:20 ` [036/143] i8k: Tell gcc that *regs gets clobbered Greg KH
2011-05-06  0:20 ` [037/143] Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again) Greg KH
2011-05-06  0:20 ` [038/143] Open with O_CREAT flag set fails to open existing files on non writable directories Greg KH
2011-05-06  0:20 ` [039/143] can: Add missing socket check in can/bcm release Greg KH
2011-05-06  0:20 ` [040/143] fs/partitions/ldm.c: fix oops caused by corrupted partition table Greg KH
2011-05-06  0:20 ` [041/143] netxen: module firmware hints Greg KH
2011-05-06  0:20 ` [042/143] bnx2x: declare MODULE_FIRMWARE Greg KH
2011-05-06  0:20 ` [043/143] cxgb3: " Greg KH
2011-05-06  0:20 ` [044/143] myri10ge: " Greg KH
2011-05-06  0:20 ` [045/143] netx: " Greg KH
2011-05-06  0:20 ` [046/143] pcnet-cs: " Greg KH
2011-05-06  0:20 ` [047/143] spider-net: " Greg KH
2011-05-06  0:20 ` [048/143] tms380tr: " Greg KH
2011-05-06  0:20 ` [049/143] Input: Add support of Synaptics Clickpad device Greg KH
2011-05-06  0:20 ` [050/143] Input: elantech - do not advertise relative events Greg KH
2011-05-06  0:20 ` [051/143] Input: elantech - fix firmware version check Greg KH
2011-05-06  0:20 ` [052/143] Input: elantech - allow forcing Elantech protocol Greg KH
2011-05-06  0:20 ` [053/143] Input: elantech - ignore high bits in the position coordinates Greg KH
2011-05-06  0:20 ` Greg KH [this message]
2011-05-06  0:20 ` [055/143] Input: elantech - relax signature checks Greg KH
2011-05-06  0:20 ` [056/143] Input: elantech - discard the first 2 positions on some firmwares Greg KH
2011-05-06  0:20 ` [057/143] Staging: rtl8192su: check for skb == NULL Greg KH
2011-05-06  0:20 ` [058/143] Staging: rtl8192su: Clean up in case of an error in module initialisation Greg KH
2011-05-06  0:20 ` [059/143] Staging: rtl8192su: Fix procfs code for interfaces not named wlan0 Greg KH
2011-05-06  0:20 ` [060/143] Staging: rtl8192su: remove device ids Greg KH
2011-05-06  0:20 ` [061/143] Staging: rtl8192su: add " Greg KH
2011-05-06  0:20 ` [062/143] USB: retain USB device power/wakeup setting across reconfiguration Greg KH
2011-05-06  0:20 ` [063/143] USB: dont enable remote wakeup by default Greg KH
2011-05-06  0:20 ` [064/143] USB: teach "devices" file about Wireless and SuperSpeed USB Greg KH
2011-05-06  0:20 ` [065/143] GFS2: Clean up gfs2_adjust_quota() and do_glock() Greg KH
2011-05-06  0:20 ` [066/143] GFS2: Fix writing to non-page aligned gfs2_quota structures Greg KH
2011-05-06  0:20 ` [067/143] GFS2: BUG in gfs2_adjust_quota Greg KH
2011-05-06  0:20 ` [068/143] SUNRPC: fix NFS client over TCP hangs due to packet loss (Bug 16494) Greg KH
2011-05-06  0:20 ` [069/143] nfs4: Ensure that ACL pages sent over NFS were not allocated from the slab (v3) Greg KH
2011-05-06  0:20 ` [070/143] nfs: fix compilation warning Greg KH
2011-05-06  0:20 ` [071/143] Fix corrupted OSF partition table parsing Greg KH
2011-05-06  0:20 ` [072/143] Increase OSF partition limit from 8 to 18 Greg KH
2011-05-06  0:20 ` [073/143] Please add support for Microsoft MN-120 PCMCIA network card Greg KH
2011-05-06  0:20 ` [074/143] hwmon: (applesmc) Add iMac9,1 and MacBookPro2,2 support Greg KH
2011-05-06  0:21 ` [075/143] hwmon: (applesmc) Add support for MacBook Pro 5,3 and 5,4 Greg KH
2011-05-06  0:21 ` [076/143] hwmon: (applesmc) Add generic support for MacBook Pro 6 Greg KH
2011-05-06  0:21 ` [077/143] hwmon: (applesmc) Add generic support for MacBook Pro 7 Greg KH
2011-05-06  0:21 ` [078/143] hwmon: (applesmc) Add MacBookAir3,1(3,2) support Greg KH
2011-05-06  0:21 ` [079/143] ALSA: emux: Add trivial compat ioctl handler Greg KH
2011-05-06  0:21 ` [080/143] ALSA: powermac - Reverse HP detection on G4 DA Greg KH
2011-05-06  0:21 ` [081/143] ALSA: powermac - Lineout " Greg KH
2011-05-06  0:21 ` [082/143] ALSA: hda - Add support for the new 27 inch IMacs Greg KH
2011-05-06  0:21 ` [083/143] ALSA: hda - MacBookPro 5,3 line-in support Greg KH
2011-05-06  0:21 ` [084/143] ALSA: hda - Add model=mbp55 entry for MacBookPro 7,1 Greg KH
2011-05-06  0:21 ` [085/143] ALSA: hda - MacBookAir3,1(3,2) alsa support Greg KH
2011-05-06  0:21 ` [086/143] virtio_net: Add schedule check to napi_enable call Greg KH
2011-05-06  0:21 ` [087/143] virtio_net: fix oom handling on tx Greg KH
2011-05-06  0:21 ` [088/143] mac80211: Add define for TX headroom reserved by mac80211 itself Greg KH
2011-05-06  0:21 ` [089/143] rt2x00: Centralize setting of extra TX headroom requested by rt2x00 Greg KH
2011-05-06  0:21 ` [090/143] rt2x00: Properly request tx headroom for alignment operations Greg KH
2011-05-06  0:21 ` [091/143] rt2x00: use correct headroom for transmission Greg KH
2011-05-06  0:21 ` [092/143] Bluetooth: Add support Bluetooth controller of MacbookPro 6,2 Greg KH
2011-05-06  0:21 ` [093/143] Bluetooth: Add support Bluetooth controller of MacbookPro 7,1 Greg KH
2011-05-06  0:21 ` [094/143] Bluetooth: Add MacBookAir3,1(2) support Greg KH
2011-05-06  0:21 ` [095/143] perf tools: Display better error messages on missing packages Greg KH
2011-05-06  0:21 ` [096/143] perf tools: Add make DEBUG=1 to remove the -O6 cflag Greg KH
2011-05-06  0:21 ` [097/143] perf tools: Test -fstack-protector-all compiler option for inclusion in CFLAGS Greg KH
2011-05-06  0:21 ` [098/143] perf tools: Support static build Greg KH
2011-05-06  0:21 ` [099/143] perf tools: Add V=2 option to help debug config issues Greg KH
2011-05-06  0:21 ` [100/143] perf tools: Suggest static libraries as well Greg KH
2011-05-06  0:21 ` [101/143] perf: Use default compiler mode by default Greg KH
2011-05-06  0:21 ` [102/143] perf tools: Move QUIET_STDERR def to before first use Greg KH
2011-05-06  0:21 ` [103/143] perf tools: Check if /dev/null can be used as the -o gcc argument Greg KH
2011-05-06  0:21 ` [104/143] perf symbols: allow forcing use of cplus_demangle Greg KH
2011-05-06  0:21 ` [105/143] V4L/DVB: Add Elgato EyeTV Diversity to dibcom driver Greg KH
2011-05-06  0:21 ` [106/143] mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume Greg KH
2011-05-06  0:21 ` [107/143] mmc: build fix: mmc_pm_notify is only available with CONFIG_PM=y Greg KH
2011-05-06  0:21 ` [108/143] b43: Fix warning at drivers/mmc/core/core.c:237 in mmc_wait_for_cmd Greg KH
2011-05-06  0:21 ` [109/143] econet: Fix redeclaration of symbol len Greg KH
2011-05-06  0:21 ` [110/143] econet: fix CVE-2010-3848 Greg KH
2011-05-06  0:21 ` [111/143] dell-laptop: Add another Dell laptop to the DMI whitelist Greg KH
2011-05-06  0:21 ` [112/143] dell-laptop: Add another Dell laptop family " Greg KH
2011-05-06  0:21 ` [113/143] scsi_dh_emc: fix mode select request setup Greg KH
2011-05-06  0:21 ` [114/143] scsi_dh_emc: request flag cleanup Greg KH
2011-05-06  0:21 ` [115/143] cifs: fix another memleak, in cifs_root_iget Greg KH
2011-05-06  0:21 ` [116/143] e1000e: Reset 82577/82578 PHY before first PHY register read Greg KH
2011-05-06  0:21 ` [117/143] e1000: fix Tx hangs by disabling 64-bit DMA Greg KH
2011-05-06  0:21 ` [118/143] btrfs: Require CAP_SYS_ADMIN for filesystem rebalance Greg KH
2011-05-06  0:21 ` [119/143] af_unix: limit recursion level Greg KH
2011-05-06  0:21 ` [120/143] af_unix: limit unix_tot_inflight Greg KH
2011-05-06  0:21 ` [121/143] init, sched: Fix race between init and kthreadd Greg KH
2011-05-06  0:21 ` [122/143] backlight: MacBookAir3,1(3,2) mbp-nvidia-bl support Greg KH
2011-05-06  0:21 ` [123/143] bonding: Ensure that we unshare skbs prior to calling pskb_may_pull Greg KH
2011-05-06  0:21 ` [124/143] HID: add MacBookAir 3,1 and 3,2 support Greg KH
2011-05-06  0:21 ` [125/143] intel-iommu: Force-disable IOMMU for iGFX on broken Cantiga revisions Greg KH
2011-05-06  0:21 ` [126/143] ipg: Remove device claimed by dl2k from pci id table Greg KH
2011-05-06  0:21 ` [127/143] ipv6: Silence privacy extensions initialization Greg KH
2011-05-06  0:21 ` [128/143] l2tp: Fix UDP socket reference count bugs in the pppol2tp driver Greg KH
2011-05-06  0:21 ` [129/143] MIPS: DMA: Fix computation of DMA flags from devices coherent_dma_mask Greg KH
2011-05-06  0:21 ` [130/143] mpt2sas: fix the incorrect scsi_dma_map error checking Greg KH
2011-05-06  0:21 ` [131/143] niu: Fix kernel buffer overflow for ETHTOOL_GRXCLSRLALL Greg KH
2011-05-06  0:21 ` [132/143] Phonet: device notifier only runs on initial namespace Greg KH
2011-05-06  0:21 ` [133/143] powerpc/boot/dts: Install dts from the right directory Greg KH
2011-05-06  0:21 ` [134/143] rt2500usb: fallback to SW encryption for TKIP+AES Greg KH
2011-05-06  0:22 ` [135/143] sata_via: Delay on vt6420 when starting ATAPI DMA write Greg KH
2011-05-06  0:22 ` [136/143] tehuti: Firmware filename is tehuti/bdx.bin Greg KH
2011-05-06  0:22 ` [137/143] wireless: b43: fix error path in SDIO Greg KH
2011-05-06  0:22 ` [138/143] libata: set queue DMA alignment to sector size for ATAPI too Greg KH
2011-05-06  0:22 ` [139/143] usb: musb: core: set has_tt flag Greg KH
2011-05-06  0:22 ` [140/143] iwlwifi: fix skb usage after free Greg KH
2011-05-06  0:22 ` [141/143] x86: pvclock: Move scale_delta into common header Greg KH
2011-05-06  0:22 ` [142/143] KVM: x86: Fix a possible backwards warp of kvmclock Greg KH
2011-05-06  0:22 ` [143/143] KVM: x86: Fix kvmclock bug Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110506002210.506130982@clark.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dtor@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®