Dag Brattli wrote:
> 
> So I think that I will do it the Windows way instead, and let open() be a
> call that just allocates the resources and always returns success (if the
> alloc went OK ;-). It could initiate a discovery as well, so this
> information would be "ready" if the process immediately tries to write to
> the device.
> 
> So I think that a write() will then initiate a connection attempt instead (so
> I'll need to buffer that first frame (since I do not buffer any data in my
> IrCOMM layer).

You probably should just block on the read/write, until it's connected,
or timeouts.  (unless the program is written to use non-blocking I/O;
then simply return -ewouldblock)

That way, you don't have to buffer data..

> That way it should be possible to "only" have /dev/ircomm0,
> /dev/ircomm1 etc. I will then also have a better "feeling" of which
> service-type the "user" is actually wanting to use (3-wire or
> 9-wire). Anyway Linux IrCOMM should just support all service types, and let
> the peer device limit which service type is actually used.

Don't you know what type of service the user wants by the minor device #
via the open call? Or, are you thinking by default, you try to open a
9-wire connection, and then if the remote peer can't do it, try 3-wire?

Really, if I'm talking to a printer, do you really want the open to try
first 3 wire-raw, then 9-wire, and then 3-wire, if it fails?  Or
vice-a-versa?  Or is it better to have several devices, one being a 3
wire-raw connect only, another being 3-wire, and the other being a
9-wire type device only?

Doing that should simplify the code a _lot_.

> 
> I will however keep separate irlpt devices. I have allocated a major number
> for ircomm (161) so I have currently ircomm0-ircomm15 and irlpt0-irlpt15
> where ircomm starts at minor 0 and irlpt starts at minor 16.
> 

You probably also want allocate the minors for centronics too then. 
(you could just stub out that portion, returning a ENODEV or something
like that..)

-- 
-------------------+--------------------------------------------------------
Thomas Davis       | Supernova's are industrial accidents.
[EMAIL PROTECTED]    | One of the Linux/IrDA guys. 
http://www.jps.net/tadavis

Reply via email to