I’m facing a problem where I’m unable to reliably read data from my usb endpoints. My ffs defines the following eps:
Ep0 = control
Ep1 = in
Ep2 = out
I have a simple ::read()
call that is blocked on int fd = ::open(ep1, O_RDONLY). Problem is that executing ::close()
on Ep1 has no effect on the ::read call and I’m pretty much blocked forever. I tried to apply select and poll Ep1 but these returned immediately even though no actual data was present on the end point, I later on also tried to apply the poll() and select()
methods on Ep0 but those hanged indefinitely even though I tried to submit data with WinUSB which also hanged up. I must be missing something… not sure what
Edit:
int fd_control_ = ::open("/dev/usb-ffs/ABC/ep0", O_RDWR);
int fd_read = ::open("/dev/usb-ffs/ABC/ep1", O_RDWR);
pollfd fd;
fd.events = POLLIN|POLLOUT;
fd.fd = fd_control_;
int ret = poll(&fd, 1, -1) // this never returns
return ::read(fd_read_, buffer, bufferSize); // without the poll, ::close never release ::read()