Am Donnerstag, 7. August 2003 21:37 schrieb David Brownell:
> Oliver Neukum wrote:
> >>>>Halt endpoints by doing a "wrong direction" I/O ... read from an IN endpoint
> >>>>(instead of writing to the host), or write to an OUT endpoint (instead of
> >>>>reading what it wrote).  ...
> > 
> > That depends on whether you want to design a clean API, or you are
> > driven by avoiding ioctl, which is a valid part of the Unix API, at all cost
> > and your overriding concern are shell scripts.
> 
> Think of it instead as portability.  The main barrier to being
> able to use this should be knowing USB -- not whether your
> chosen programming environment supports POSIX-specific APIs.
> 
> Remember that _today_ you can write fully realistic user mode
> gadget drivers in C, C++, Python, Java, and other languages
> (including BASH!).  Not all of those have, or want, ioctl().

Firstly, you are unlikely to see gadgetfs ported to anything that
doesn't have ioctl.

Secondly, remembering to write/read in the wrong direction to halt
an endpoint requires as much knowledge not about USB than an
ioctl. In fact a little more as you have to know about data direction
which is immaterial to halting as such.

Thirdly and most importantly, kernel code shall be designed
independently of user space language. It is designed to meet
SuS and more importantely, the spirit of Unix, in which the io
primitives have clear meaning. Read & write do the obvious things
their names suggest. And for manipulation of io devices as such,
not involving data transfers, there is ioctl.
Read & write are not supposed to have side effects as the only
effect. Such effects are supposed to be only secondary effects of
processing data read or written, like a device becoming busy.

A portable API is an API that uses POSIX like it is intended to be
used. Not abusing ioctl to do things that read or write should do,
but neither pushing the semantics of ioctl onto read and write.
What do you do if the next special operation needs to be accomodated?

Kernel interfaces are supposed to follow Unix, not some language's
castrated oppinion of how io shall be performed. If you want more
portability write a shared library to make available a function like
gadget_halt_endpoint(). But that doesn't change the need of having
a cleanly designed kernel interface.

        Sorry for being so long
                Oliver



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to