将参数传递给 USB ioctl

Pass param to USB ioctl

我有 read/write 数据到 USB 大容量存储设备的问题,以下命令有 'Device or resource busy' 错误:

ioctl(usbFD, USBDEVFS_CLAIMINTERFACE, &interface_num) 

所以我需要先发布接口。但我不知道 如何将 interface_num 正确传递给此命令:

ioctl(usbFD, USBDEVFS_RELEASEINTERFACE, &interface_num), 

如果没有定义,有没有找到这个接口号的函数。 请帮我!谢谢

文档指出:

USBDEVFS_RELEASEINTERFACE

This is used to release the claim usbfs made on interface, either implicitly or because of a USBDEVFS_CLAIMINTERFACE call, before the file descriptor is closed. The ioctl parameter is an integer holding the number of the interface (bInterfaceNumber from descriptor); File modification time is not updated by this request.

但这里 "parameter is an integer" 似乎仍然意味着应该传递指向整数的指针,就像您所展示的那样。如果你有描述符,你可以找到接口号。