我想在装有WINUSB驱动程序的Windows10-PC上使用iMX7-SOM作为特定于供应商的设备(小工具)。我在Kernel v4.9.166中使用了一个基于Angstrom的Yocto制作的镜像。
我用libusbgx配置了这个小工具,在/ffs上挂载了函数ffs,并将解析器写到了/ff/ep0。设备按照预期被枚举,我在端点0上得到了命令(如"BIND","ENABLE","DISABLE“等)。
太久太好了..。
在端点0处收到"ENABLE“时,我希望打开/ff/ep1并使用poll()读取传入数据。但是poll()会立即返回,而read()永远不会返回(仅当我拔出设备时)。在主机端,没有应用程序在运行。
我使用select()代替,但结果完全相同。
当我使用ioctl(fd_of_ep_1,FUNCTIONFS_FIFO_STATUS)时,我得到错误消息“不支持操作”。
int fd = open("/ffs/ep1", O_RDWR);
fd_set read_set;
FD_ZERO(&read_set);
FD_SET(fd, &read_set);
int ret = select(fd + 1, &read_set, NULL, NULL, NULL);
if (ret < 0)
{
perror("select");
}
else if (FD_ISSET(fd, &read_set))
{
int foo = ioctl(fd, FUNCTIONFS_FIFO_STATUS);
if (foo < 0) perror("ioctl");
else fprintf(stdout, "%i\n", foo);
char buffer[1024];
if (read(fd, buffer, sizeof(buffer)) < 0)
{
perror("ep read");
}
}我期望当我打开我的应用程序时,select/poll函数将返回,并且端点将由主机编写。
https://stackoverflow.com/questions/56754470
复制相似问题