Re: gadgetfs: poll on a bulk-out ep returns POLLIN, but read blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 8 Jan 2009, Guennadi Liakhovetski wrote:

> Hi,
> 
> I'm using gadgetfs on an i.MX31 platform, and I took the example from 
> http://www.linux-usb.org/gadget/ as basis, but put all threads in one, and 
> I use poll to identify when to read / write from / to an endpoint 
> descriptor. Then, after I get USB_REQ_SET_CONFIGURATION I open bulk-in and 
> -out endpoints, on the next poll I add the bulk-out endpoint to the poll 
> array, get a POLLIN event, do a read(), and it blocks. Here is an excerpt 
> from strace output:
> 
> poll([{fd=3, events=POLLIN|POLLHUP, revents=POLLIN}], 1, -1) = 1
> read(3, "\x00\x09\x03\x00\x00\x00\x00\x00\x03\x00\x00\x00", 60) = 12
> write(2, "SETUP 00.09 v0003 i0000 0\n", 26) = 26
> write(2, "CONFIG #3\n", 10)             = 10
> write(2, "Start bulk EPs\n", 15)        = 15
> open("ep1in", O_RDWR)                   = 4
> write(4, "\x01\x00\x00\x00\x07\x05\x81\x02\x40\x00\x00\x07\x05\x81\x02\x40\x00\x00", 18) = 18
> write(2, "ep1in start fd 4\n", 17)      = 17
> open("ep1out", O_RDWR)                  = 5
> write(5, "\x01\x00\x00\x00\x07\x05\x01\x02\x40\x00\x00\x07\x05\x01\x02\x40\x00\x00", 18) = 18
> write(2, "ep1out start fd 5\n", 18)     = 18
> read(3, "", 0)                          = 0
> write(2, "(1): 2 descriptors: 3, 5\n", 25) = 25
> poll([{fd=3, events=POLLIN|POLLHUP}, {fd=5, events=POLLIN|POLLHUP, revents=POLLIN}], 2, -1) = 1
> read(5, 
> 
> This looks to me like a bug in gadgetfs, or am I doing anything wrong? Or 
> can it be a bug in i.MX31 gadget driver?

Ouch, just verified - ep_io_operations doesn't have a poll method at 
all:-( And O_NONBLOCK doesn't check for actual data availability either:-( 
Would AIO work?...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux