Commit Graph

17 Commits

Author SHA1 Message Date
Andy Shevchenko
e9d4650dcc spi: tools: add install section
Allow user to call install target.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-26 12:25:28 +01:00
Andy Shevchenko
f325b73dc4 spi: tools: move to tools buildsystem
There is a nice buildsystem dedicated for userspace tools in Linux kernel tree.
Switch spi target to be built by it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-26 12:25:23 +01:00
Frode Isaksen
9006a7b322 spi: spidev_test: add option to continuously transfer data
Add option to send+recv <size> bytes with <iter> iterations
and show the transfer rate every 5 seconds.
Example:
rate: tx 4235.2kbps, rx 4235.2kbps
total: tx 4882.8KB, rx 4882.8KB

Signed-off-by: Frode Isaksen <fisaksen@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-21 18:44:40 +00:00
Michal Vokáč
e634b76caf spi: spidev_test: Fix input file check when transferring file
Check the input file fd instead of spidev fd.
The spidev fd is supposed to be OK otherwise the transfer_file() function
would not be called at all.

Signed-off-by: Michal Vokáč <vokac.m@gmail.com>
Reviewed-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04 09:56:09 -06:00
Mark Brown
2ce0468433 Merge remote-tracking branches 'spi/topic/ti-qspi', 'spi/topic/tools', 'spi/topic/txx9' and 'spi/topic/xlp' into spi-next 2016-09-30 09:14:22 -07:00
Mark Brown
3424ff29a0 Merge remote-tracking branches 'spi/topic/rspi', 'spi/topic/sc18is602', 'spi/topic/sh-msiof', 'spi/topic/spidev-test' and 'spi/topic/st-ssc4' into spi-next 2016-09-30 09:14:18 -07:00
Geert Uytterhoeven
0278b34bf1 spi: spidev_test: Fix buffer overflow in unescape()
Sometimes spidev_test crashes with:

    *** Error in `spidev_test': munmap_chunk(): invalid pointer: 0x00022020 ***
    Aborted

or just

    Segmentation fault

This is due to transfer_escaped_string() miscalculating the required
size of the buffer by one byte, causing a buffer overflow in unescape().

Drop the bogus "+ 1" in the strlen() parameter to fix this.

Note that unescape() never copies the zero-terminator of the source
string, so it writes at most as many bytes as the length of the source
string.

Fixes: 30061915be (spi: spidev_test: Added input buffer from the terminal)
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # v4.5+
2016-09-14 16:22:43 +01:00
Jorge Ramirez-Ortiz
2a4635ea1d spi: tools: enable CROSS_COMPILE in Makefile
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12 20:02:25 +01:00
Baruch Siach
8736f8022e spi: spidev_test: fix build with musl libc
spidev.h uses _IOC_SIZEBITS directly. musl libc does not provide this macro
unless linux/ioctl.h is included explicitly. Fixes build failures like:

In file included from .../host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/sys/ioctl.h:7:0,
                 from .../build/spidev_test-v3.15/spidev_test.c:20:
.../build/spidev_test-v3.15/spidev_test.c: In function ‘transfer’:
.../build/spidev_test-v3.15/spidev_test.c:75:18: error: ‘_IOC_SIZEBITS’ undeclared (first use in this function)
  ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
                  ^

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-15 14:23:55 +01:00
Fabio Estevam
edd3899c8c spi: spidev_test: Fix typo in error message
Fix the spelling of 'output' in the error message.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 17:58:56 +00:00
Joshua Clayton
de2c6e5855 spi: tools: move spidev_test metadata
Now that spidev_test and spidev_fdx have been moved, remove them
from the Documentation index and move their .gitignore file.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-30 12:14:12 +00:00
Joshua Clayton
b2cfc90428 spi: spidev_test: fix whitespace
Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00
Joshua Clayton
a20874f78b spi: spidev_test: check error
Check the result of sscanf to verify a result was found.
report and error and abort if pattern was not found.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00
Joshua Clayton
983b27886a spi: spidev_test: output to a file
For testing of larger data transfers, output unmodified data
directly to a file.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00
Joshua Clayton
7af475a5b5 spi: spidev_test: accept input from a file
Add input file support to facilitate testing larger data.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00
Joshua Clayton
5c437a401b spi: spidev_test: transfer_escaped_string function
Move the input_tx code into its own small function.
This cleans up some variables from main() that are used only here.
While we are at it, check malloc calls instead of assuming they succeed.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00
Joshua Clayton
5eca4d843f spi: Move spi code from Documentation to tools
Jon Corbet requested this code moved with the last changeset,
https://lkml.org/lkml/2015/3/1/144,
but the patch was not applied because it missed the Makefile.
Moved spidev_test, spidev_fdx and their Makefile infrastructure.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-23 14:54:01 +00:00