1

I have a problem for read/write data to USB mass storage device, with 'Device or resource busy' error for below command:

ioctl(usbFD, USBDEVFS_CLAIMINTERFACE, &interface_num) 

So i need to release interface before. But i don't know How can i pass interface_num correctly to this command:

ioctl(usbFD, USBDEVFS_RELEASEINTERFACE, &interface_num), 

If it's not defined, is there any function to found this interface number. Please help me! Thanks.

4

1 回答 1

0

该文档指出:

USBDEVFS_RELEASEINTERFACE

这用于在USBDEVFS_CLAIMINTERFACE关闭文件描述符之前释放 usbfs 在接口上所做的声明,无论是隐式还是由于调用。ioctl 参数是一个整数,保存接口的编号(bInterfaceNumber来自描述符);此请求不会更新文件修改时间。

但似乎这里的“参数是一个整数”仍然意味着应该传递一个指向整数的指针,就像你展示的那样。如果你有描述符,你可以找到接口号。

于 2015-10-22T12:59:51.000 回答