From patchwork Tue Mar 10 20:12:31 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: 5980381 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 A79B4BF440 for ; Tue, 10 Mar 2015 20:12:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDFC42024D for ; Tue, 10 Mar 2015 20:12:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E75E12022A for ; Tue, 10 Mar 2015 20:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753132AbbCJUMr (ORCPT ); Tue, 10 Mar 2015 16:12:47 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:37726 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752806AbbCJUMo (ORCPT ); Tue, 10 Mar 2015 16:12:44 -0400 Received: by widem10 with SMTP id em10so18598388wid.2; Tue, 10 Mar 2015 13:12:42 -0700 (PDT) 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=7xcF1IeKI7ISLORu/7r8hwcrMWhu+zM50wtzWTVX+m8=; b=AkesHGTyAaGAwWer1N10c+j3kTRoo7HLv5PPHPY2vKiIgW9OAyjicOF+rHFdls4Bfv 7lTee4jXCbnQN9P/taL6IpiuNRJkQ/dyL5R1Bxo+z2PpiiQOnLtnuR+lSqKFonk1gwhg gL8mVivd/Hi6T+yhCuXNrtA74OzluhAyA14zZx3slpqkXfwkiAj4OVdJ98ddxy0BXgGF NShpcsWNvSCO2T1DJiHLPAI9fhBS3Dr3Qje2vp2FWvNgPTrwobj5qIEpKeeC6LMToVuC q+VM3Rr06ntsiUTKFiu9FFd4z6vmPDGE/KgCAdfT9RhZnBvl8C1JBdPSv7NmkswJJAhg UGoQ== X-Received: by 10.180.39.139 with SMTP id p11mr22230459wik.61.1426018362515; Tue, 10 Mar 2015 13:12:42 -0700 (PDT) Received: from debian.fh-joanneum.at (fh.fh-joanneum.at. [91.229.57.240]) by mx.google.com with ESMTPSA id b4sm21758630wic.2.2015.03.10.13.12.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2015 13:12:41 -0700 (PDT) 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: [PATCHv2 2/4] Added verbose output Date: Tue, 10 Mar 2015 16:12:31 -0400 Message-Id: <1426018353-13442-3-git-send-email-adrianremonda@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1426018353-13442-2-git-send-email-adrianremonda@gmail.com> References: <1426018353-13442-1-git-send-email-adrianremonda@gmail.com> <1426018353-13442-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=ham 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c index 9cb09184a3d6..4b6a3803638b 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 hex_dump(const void *src, size_t length, size_t line_size, char *prefix) { @@ -104,6 +105,8 @@ static void transfer(int fd) if (ret < 1) pabort("can't send spi message"); + if (verbose) + hex_dump(tx, ARRAY_SIZE(tx), 32, "TX"); hex_dump(rx, ARRAY_SIZE(rx), 32, "RX"); } @@ -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;