This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Nonblocking serial ports


On Jun 14 00:59, Yaakov S wrote:
> I came across this while working on getting my Palm to hook up to
> gnome-pilot over Bluetooth.  COM3 is an incoming COM Port created within
> Bluetooth Settings, although the STC has the same results on COM1 (a
> standard serial port).
> 
> Unlike pilot-link's tools and jpilot (all three use pilot-link's
> libpisock under the hood), gnome-pilot open()s a serial port with
> O_NONBLOCK when first started in order to initialize a GIOChannel, then
> later pi_bind()s a different fd pointing to the same port.  Works great
> on Linux, but on Cygwin the latter call fails, as the serial port is
> already blocked by the first open() call.  FWIW, both pilot-xfer and
> friends and jpilot work fine over the Bluetooth serial port, and all
> three work over the network.
> 
> Attached is a STC.  On Linux, this succeeds, but on Cygwin (both 1.7.5
> and latest snapshot), it fails:
> 
> second open(/dev/ttyS2) failed: Permission denied

That's apparently a Windows restriction.  Communication devices like
serial or parallel ports can only be opened exclusively on the API
level.  It does not matter what sharing flags have been set when opening
the file for the first time.  Actually MSDN requies to set the sharing
flags to 0 when opening comm devices, but Cygwi opens them with all
sharing flags set, to no avail.

Allowing to open a comm device more than once at a time would require
some redesign in Cygwin, along the lines of what's done to propagate
the pipe handles used for ttys to other processes.  That would be a
nice case of http://cygwin.com/acronyms/#PTC ...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]