我有一个嵌入式 Linux ARM 板,其中一个应用程序打开/dev/spidev1.0设备并不断与另一个 MCU 对话。现在,如果我尝试查看哪些交换(这是我需要的),执行 hexdump/dev/spidev1.0会在开始时显示一些内容,但会导致应用程序崩溃。该应用程序非常敏感,我认为它会崩溃,因为该应用程序使用并且不能同时用于查看。
如果我编写一些额外的代码/驱动程序,有没有办法创建别名,或者像这个设备的镜像之类的东西?或者我没有机会像那样嗅探流量(在软件中)?
改写:
int ioctl(int fd, unsigned long request, struct spi_ioc_transfer *xfer)
但是,gcc输出以下错误:
myioctl.c:6:5: error: conflicting types for ‘ioctl’ In file included from myioctl.c:1:0: /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/include/sys/ioctl.h:41:12: note: previous declaration of ‘ioctl’ was here
任何帮助如何原始定义:
/* Perform the I/O control operation specified by REQUEST on FD.
One argument may follow; its presence and type depend on REQUEST.
Return value depends on REQUEST. Usually -1 indicates error. */
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
可以被覆盖。