tech-kern archive

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

Re: Potential problem with reading data from usb devices with ugen(4)



On 05/11/2015 18:53, Brian Buhrow wrote:
	Hello.  I've been making progress on this issue and have now run into
another issue which folks may be able to shed some light on.

First, where I am.

	I've modified the ugen(4) driver to read from devices asynchronously
using a callout, allowing me to issue non-blocking read requests and fixing
poll(9) so it actually works as expected. This gets me a lot closer to what
I need, and I'm now able to do an initial exchange with several Apple
devices to the point of having the libimobilidevice library try to pair
with the units.

You shouldn't need this. Adjust the code to keep a read transfer alive at all times.


   However, see below.

My new problem.

	Apparently, the data exchange protocol the iDevices use requires that
data packets that happen to be a multiple of the transfer size be followed
by zero length packets.  Re-reading what Nick wrote on this thread about
USB writes consisting of USB transactions on the bus, I think this means you
just initiate a transfer to the device in question with no payload.  I
believe I know how to do this from within the ugen(4) driver itself, and I
have a test patch that tries to do this in ugen_do_write().  However, if I
call write(2) against the file descriptor for the bulk write endpoint of my
device with a zero length write request, the call never gets down as far as
the ugen(4) driver before the system decides the work is done.  In general,
that's probably a good thing and I'm not trying to change that behavior.
However, I am wondering how folks feel the best way to generate zero length
packets would be.  My initial thought is to implement an additional ioctl that
the usb libraries could call if they notice that they want to generate a
zero length packet.  Is there a better or different way to do this?  Maybe
someone has already solved this problem and I just don't see it?

See USBD_FORCE_SHORT_XFER - ugen needs to be taught about it.

-thanks
-Brian



Nick


Home | Main Index | Thread Index | Old Index