From patchwork Sat Mar 7 17:56:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: adrianremonda@gmail.com X-Patchwork-Id: 5959961 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 70E44BF440 for ; Sat, 7 Mar 2015 17:58:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2769202FF for ; Sat, 7 Mar 2015 17:58:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B57B6200C6 for ; Sat, 7 Mar 2015 17:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752406AbbCGR57 (ORCPT ); Sat, 7 Mar 2015 12:57:59 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:42527 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556AbbCGR5M (ORCPT ); Sat, 7 Mar 2015 12:57:12 -0500 Received: by wggy19 with SMTP id y19so2414276wgg.9; Sat, 07 Mar 2015 09:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8SNJXwthDcBr7AL8K75Uv4xaWL0gEsY2y7zM33jiVvA=; b=UafsbCaedc07mnbOqWrfwNZ7/UHyp96COFwr4ZJb23yZAjaelFjb52UGAZtL8WmlKm lpXq9nyTmlrI/9zH5ZQ+5yMKb+9C3VY8tB/mOLdxjIkj/OtqItM8WoQvJ/mgu/A62ude KAap7hQiGyKPLTEw4NeJwWtEPj61PhjoTf+dfAwqt0Gmoz0VShKJ1NcnVQerxVngXXdY ZoU1vWFGBdJJavCl0XbV/XXQ8sHvsUaEUhT8O5lvVtiGDyp9kT6x+ENYCFwFUOmllA47 2iLe5k7m3hz3BZLZsodJahM+MBfvAK+a6AbpOz+jFpicVtQAbVkx6RENljZG8ZwpYdRQ IafQ== X-Received: by 10.180.86.227 with SMTP id s3mr87959338wiz.58.1425751030471; Sat, 07 Mar 2015 09:57:10 -0800 (PST) Received: from debian.fh-joanneum.at (fh.fh-joanneum.at. [91.229.57.240]) by mx.google.com with ESMTPSA id lj13sm7559769wic.9.2015.03.07.09.57.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Mar 2015 09:57:09 -0800 (PST) From: Adrian Remonda Cc: adrianremonda@gmail.com, broonie@kernel.org, corbet@lwn.net, linux-spi@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] Added verbose output Date: Sat, 7 Mar 2015 12:56:33 -0500 Message-Id: <1425750995-18176-3-git-send-email-adrianremonda@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1425750995-18176-2-git-send-email-adrianremonda@gmail.com> References: <1425750995-18176-1-git-send-email-adrianremonda@gmail.com> <1425750995-18176-2-git-send-email-adrianremonda@gmail.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Adrian Remonda --- Documentation/spi/spidev_test.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c index 533050ced9f1..a247b3dbf65a 100644 --- a/Documentation/spi/spidev_test.c +++ b/Documentation/spi/spidev_test.c @@ -35,6 +35,7 @@ static uint32_t mode; static uint8_t bits = 8; static uint32_t speed = 500000; static uint16_t delay; +static int verbose; static void hexDump(const void *src, size_t length, size_t bLine, char *prefix) { @@ -104,7 +105,9 @@ static void transfer(int fd) if (ret < 1) pabort("can't send spi message"); - hexDump(rx, ARRAY_SIZE(tx), 32, "RX"); + if (verbose) + hexDump(tx, ARRAY_SIZE(tx), 32, "TX"); + hexDump(rx, ARRAY_SIZE(rx), 32, "RX"); } static void print_usage(const char *prog) @@ -120,6 +123,7 @@ static void print_usage(const char *prog) " -L --lsb least significant bit first\n" " -C --cs-high chip select active high\n" " -3 --3wire SI/SO signals shared\n" + " -v --verbose Verbose (show tx buffer)\n" " -N --no-cs no chip select\n" " -R --ready slave pulls low to pause\n" " -2 --dual dual transfer\n" @@ -144,12 +148,13 @@ static void parse_opts(int argc, char *argv[]) { "no-cs", 0, 0, 'N' }, { "ready", 0, 0, 'R' }, { "dual", 0, 0, '2' }, + { "verbose", 0, 0, 'v' }, { "quad", 0, 0, '4' }, { NULL, 0, 0, 0 }, }; int c; - c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24", lopts, NULL); + c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24:v", lopts, NULL); if (c == -1) break; @@ -188,6 +193,9 @@ static void parse_opts(int argc, char *argv[]) case 'N': mode |= SPI_NO_CS; break; + case 'v': + verbose = 1; + break; case 'R': mode |= SPI_READY; break;