* Opening COM2
@ 1997-04-03 13:20 Bob Wilson
1997-04-03 22:44 ` Jim Balter
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Bob Wilson @ 1997-04-03 13:20 UTC (permalink / raw)
To: gnu-win32
I have a program which ran correctly when compiled on a gnu-win32
package from about a year ago, but is failing when compiled with 17.1
beta. The machine is running NT 3.51 and COM2 is connected to a
microprocessor with only td, rd and ground connected. The open:
if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
fprintf(stderr, "Cmd: Unable to open terminal\n");
exit(1);
}
hangs. It doesn't help to tie the modem control lines high, but if I
generate a few characters on the rd line, the open completes. In no
case is there an error return.
I have looked for this problem in the FAQ and looked for archives of
this mailing list, but both searches failed.
Can anyone help?
Thanks,
Bob Wilson
rwilson@cfa.harvard.edu
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Opening COM2
1997-04-03 13:20 Opening COM2 Bob Wilson
@ 1997-04-03 22:44 ` Jim Balter
1997-04-03 23:05 ` Fergus Henderson
1997-04-07 15:27 ` Geoffrey Noer
2 siblings, 0 replies; 8+ messages in thread
From: Jim Balter @ 1997-04-03 22:44 UTC (permalink / raw)
To: Bob Wilson; +Cc: gnu-win32
Bob Wilson wrote:
>
> I have a program which ran correctly when compiled on a gnu-win32
> package from about a year ago, but is failing when compiled with 17.1
> beta. The machine is running NT 3.51 and COM2 is connected to a
> microprocessor with only td, rd and ground connected. The open:
>
> if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
> fprintf(stderr, "Cmd: Unable to open terminal\n");
> exit(1);
> }
>
> hangs. It doesn't help to tie the modem control lines high, but if I
> generate a few characters on the rd line, the open completes. In no
> case is there an error return.
>
> I have looked for this problem in the FAQ and looked for archives of
> this mailing list, but both searches failed.
>
> Can anyone help?
Marko Kohtala posted this patch to fix the problem the other day
(I haven't tried it and am not vouching for it):
diff -up b17.1/winsup/path.cc\~ b17.1/winsup/path.cc
--- b17.1/winsup/path.cc~ Wed Dec 4 05:23:01 1996
+++ b17.1/winsup/path.cc Tue Apr 1 17:14:21 1997
@@ -1056,7 +1056,14 @@ symlink_check (const char *path, char *b
char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
DWORD done;
- if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &done, 0))
+ if ((GetFileType (h) & ~FILE_TYPE_REMOVE) != FILE_TYPE_DISK)
+ {
+ /* It is not a disk file, can not be a symlink */
+ *syml = 0;
+ *exec = 0;
+ res = 0;
+ }
+ else if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &done,
0))
{
set_errno (EIO);
}
--
<J Q B>
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Opening COM2
1997-04-03 13:20 Opening COM2 Bob Wilson
1997-04-03 22:44 ` Jim Balter
@ 1997-04-03 23:05 ` Fergus Henderson
1997-04-07 15:27 ` Geoffrey Noer
2 siblings, 0 replies; 8+ messages in thread
From: Fergus Henderson @ 1997-04-03 23:05 UTC (permalink / raw)
To: Bob Wilson; +Cc: gnu-win32
Bob Wilson, you wrote:
>
> I have a program which ran correctly when compiled on a gnu-win32
> package from about a year ago, but is failing when compiled with 17.1
> beta. The machine is running NT 3.51 and COM2 is connected to a
> microprocessor with only td, rd and ground connected. The open:
>
> if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
> fprintf(stderr, "Cmd: Unable to open terminal\n");
> exit(1);
> }
>
> hangs. It doesn't help to tie the modem control lines high, but if I
> generate a few characters on the rd line, the open completes. In no
> case is there an error return.
My guess is that this is due to the symbolic link handling.
When you open a file, cygwin will read the first few bytes
of the file to see if it has the special marker that is used
to indicate a symbolic link; if so, then cygwin will open the
file that the link points to. Obviously this won't work
correctly in the case of device files such as `com2'...
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh > | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Opening COM2
1997-04-03 13:20 Opening COM2 Bob Wilson
1997-04-03 22:44 ` Jim Balter
1997-04-03 23:05 ` Fergus Henderson
@ 1997-04-07 15:27 ` Geoffrey Noer
2 siblings, 0 replies; 8+ messages in thread
From: Geoffrey Noer @ 1997-04-07 15:27 UTC (permalink / raw)
To: Bob Wilson; +Cc: gnu-win32
Bob Wilson wrote:
>
> I have a program which ran correctly when compiled on a gnu-win32
> package from about a year ago, but is failing when compiled with 17.1
> beta. The machine is running NT 3.51 and COM2 is connected to a
> microprocessor with only td, rd and ground connected. The open:
>
> if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
> fprintf(stderr, "Cmd: Unable to open terminal\n");
> exit(1);
> }
>
> hangs.
This should be fixed in beta 18. I encountered similar problems trying to
talk to a serial port in a cygwin32-based gdb a little while ago. The
solution was to rewrite some of the fhandler.cc code in the cygwin.dll
such that the classes make a little more sense.
The bottom line is that fhandler_base::open should not be checking
symlink/executable status of files, instead that code should be in
fhandler_disk_file::open which also does everything that
fhandler_base::open does. Opening a com port is a fhandler_tty::open which
just defaults to the fhandler_base::open behavior. This did the trick
for me.
--
Geoffrey Noer
noer@cygnus.com
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Opening COM2
@ 1997-05-15 23:48 Markus Maeder
0 siblings, 0 replies; 8+ messages in thread
From: Markus Maeder @ 1997-05-15 23:48 UTC (permalink / raw)
To: gnu-win32
Sorry, it seems to work on another Computer.
I have to check configurations....
Bye,
Markus Maeder
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Opening COM2
@ 1997-05-15 14:19 Gary Liddle
0 siblings, 0 replies; 8+ messages in thread
From: Gary Liddle @ 1997-05-15 14:19 UTC (permalink / raw)
To: gnu-win32, Markus.Maeder
the way to do it is
to
fp = fopen("com2", "whatever");
comfd = fileno(fp);
>
> Bob Wilson posted a message some time ago with some C source lines:
>
> if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
> fprintf(stderr, "Cmd: Unable to open terminal\n");
> exit(1);
> }
>
> He stated, this doesnt function under b17. open hangs...
>
> It seems, that this doesn't work under b18 either. Is there a patch?
>
> Regards,
> Markus
>
>
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Opening COM2
@ 1997-05-14 22:52 Markus Maeder
0 siblings, 0 replies; 8+ messages in thread
From: Markus Maeder @ 1997-05-14 22:52 UTC (permalink / raw)
To: gnu-win32
Bob Wilson posted a message some time ago with some C source lines:
if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
fprintf(stderr, "Cmd: Unable to open terminal\n");
exit(1);
}
He stated, this doesnt function under b17. open hangs...
It seems, that this doesn't work under b18 either. Is there a patch?
Regards,
Markus
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Opening COM2
@ 1997-04-07 8:52 David Fiddes
0 siblings, 0 replies; 8+ messages in thread
From: David Fiddes @ 1997-04-07 8:52 UTC (permalink / raw)
To: gnu-win32
> My guess is that this is due to the symbolic link handling.
> When you open a file, cygwin will read the first few bytes
> of the file to see if it has the special marker that is used
> to indicate a symbolic link; if so, then cygwin will open the
> file that the link points to. Obviously this won't work
> correctly in the case of device files such as `com2'...
>
Would this cause GDB to hang when trying to connect to a target "monitor"
on a development board. GDB seems to support(from it's list of targets and
the source) my monitor(dBUG for ColdFire) but it hangs when I type "target
dbug com2" (the default port settings for COM2 are OK). I haven't stuck a
terminal or a protocol analyser on it yet.....
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~1997-05-15 23:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-03 13:20 Opening COM2 Bob Wilson
1997-04-03 22:44 ` Jim Balter
1997-04-03 23:05 ` Fergus Henderson
1997-04-07 15:27 ` Geoffrey Noer
1997-04-07 8:52 David Fiddes
1997-05-14 22:52 Markus Maeder
1997-05-15 14:19 Gary Liddle
1997-05-15 23:48 Markus Maeder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).