From patchwork Thu Apr 12 13:58:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Miao X-Patchwork-Id: 152079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 3F3D0B704F for ; Thu, 12 Apr 2012 23:59:00 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SIKY1-0003tV-Tw; Thu, 12 Apr 2012 13:58:54 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SIKXx-0003he-Cu for kernel-team@lists.ubuntu.com; Thu, 12 Apr 2012 13:58:49 +0000 Received: by mail-pb0-f49.google.com with SMTP id un4so2584226pbc.8 for ; Thu, 12 Apr 2012 06:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ySWbpa0rU/wTkP5gB56KSa9gv4ywXDE33vUu1XVj9G4=; b=LpvJJROtuNe+//ChXCAVO1XnkGJBtZt0njM/slZJAHNXgX1qOnPKoSFnP+pE34n6zH gavnT03a868Wew/lZ6o0dEjgGFMK1i1C7arYfmXpVW/LLDBjggoP+PeiTNdoB2H2jqA7 d6Thp1rosAliJfE8NKWb/lTZl27CiMi4xP4eV0Cz0a0SlukIkLtwYd/7TQ7/MdglWldo XTf9VEhCVzSMLh2vassmkdxKiXJ45PCP+3+Is/nr9GFQsEC0KsgEDMTpe10czdX0VPey auabTyzWycCR+EXFZsC/1R/z83b9bzG89WQ1uhOrDoHP6PdN74tYev5qSkh4dC/OPd1V ToWA== Received: by 10.68.213.41 with SMTP id np9mr3059307pbc.85.1334239128959; Thu, 12 Apr 2012 06:58:48 -0700 (PDT) Received: from ycmiao-macbookpro.ericsmarthome.org ([112.65.50.137]) by mx.google.com with ESMTPS id or6sm5763752pbc.43.2012.04.12.06.58.46 (version=SSLv3 cipher=OTHER); Thu, 12 Apr 2012 06:58:48 -0700 (PDT) From: Eric Miao To: kernel-team@lists.ubuntu.com Subject: [Precise PATCH 6/6] Input: sentelic - improve packet debugging information Date: Thu, 12 Apr 2012 21:58:19 +0800 Message-Id: <1334239099-3502-7-git-send-email-eric.miao@canonical.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1334239099-3502-1-git-send-email-eric.miao@canonical.com> References: <1334239099-3502-1-git-send-email-eric.miao@canonical.com> Cc: Oskari Saarenmaa , Dmitry Torokhov , Tai-hwa Liang X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Oskari Saarenmaa Signed-off-by: Oskari Saarenmaa Signed-off-by: Tai-hwa Liang Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/sentelic.c | 43 +++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index 63b55b4..869efb3 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c @@ -37,6 +37,9 @@ #define FSP_CMD_TIMEOUT 200 #define FSP_CMD_TIMEOUT2 30 +#define GET_ABS_X(packet) ((packet[1] << 2) | ((packet[3] >> 2) & 0x03)) +#define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) + /** Driver version. */ static const char fsp_drv_ver[] = "1.0.0-K"; @@ -598,18 +601,40 @@ static struct attribute_group fsp_attribute_group = { .attrs = fsp_attributes, }; -#ifdef FSP_DEBUG -static void fsp_packet_debug(unsigned char packet[]) +#ifdef FSP_DEBUG +static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) { static unsigned int ps2_packet_cnt; static unsigned int ps2_last_second; unsigned int jiffies_msec; + const char *packet_type = "UNKNOWN"; + unsigned short abs_x = 0, abs_y = 0; + + /* Interpret & dump the packet data. */ + switch (packet[0] >> FSP_PKT_TYPE_SHIFT) { + case FSP_PKT_TYPE_ABS: + packet_type = "Absolute"; + abs_x = GET_ABS_X(packet); + abs_y = GET_ABS_Y(packet); + break; + case FSP_PKT_TYPE_NORMAL: + packet_type = "Normal"; + break; + case FSP_PKT_TYPE_NOTIFY: + packet_type = "Notify"; + break; + case FSP_PKT_TYPE_NORMAL_OPC: + packet_type = "Normal-OPC"; + break; + } ps2_packet_cnt++; jiffies_msec = jiffies_to_msecs(jiffies); psmouse_dbg(psmouse, - "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n", - jiffies_msec, packet[0], packet[1], packet[2], packet[3]); + "%08dms %s packets: %02x, %02x, %02x, %02x; " + "abs_x: %d, abs_y: %d\n", + jiffies_msec, packet_type, + packet[0], packet[1], packet[2], packet[3], abs_x, abs_y); if (jiffies_msec - ps2_last_second > 1000) { psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt); @@ -618,7 +643,7 @@ static void fsp_packet_debug(unsigned char packet[]) } } #else -static void fsp_packet_debug(unsigned char packet[]) +static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) { } #endif @@ -650,10 +675,12 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) * Full packet accumulated, process it */ + fsp_packet_debug(psmouse, packet); + switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { case FSP_PKT_TYPE_ABS: - abs_x = (packet[1] << 2) | ((packet[3] >> 2) & 0x03); - abs_y = (packet[2] << 2) | (packet[3] & 0x03); + abs_x = GET_ABS_X(packet); + abs_y = GET_ABS_Y(packet); if (packet[0] & FSP_PB0_MFMC) { /* @@ -764,8 +791,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) input_sync(dev); - fsp_packet_debug(packet); - return PSMOUSE_FULL_PACKET; }