delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/03/03:54:45

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <6.0.1.1.0.20050203091915.02128f78@192.168.2.1>
X-Sender: r&d2%dave-tech DOT it AT 192 DOT 168 DOT 2 DOT 1
Date: Thu, 03 Feb 2005 09:52:47 +0100
To: cygwin AT cygwin DOT com
From: llandre <r&d2 AT dave-tech DOT it>
Subject: Re: Help about serial programming: manipulating DTR
In-Reply-To: <20050202180929.GQ31117@cygbert.vinschen.de>
References: <6 DOT 0 DOT 1 DOT 1 DOT 0 DOT 20050202171834 DOT 01fcf4f8 AT 192 DOT 168 DOT 2 DOT 1> <20050202180929 DOT GQ31117 AT cygbert DOT vinschen DOT de>
Mime-Version: 1.0
X-IsSubscribed: yes

> > I'm trying to manipulate the DTR signal of the serial port.
> > As an example I used this code snippet:
> > http://lists.exploits.org/upsdev/Feb2004/00013.html.
> > I can open the com1, I can send and receive data but the ioctl I use
> > to read the status of the signals returns -1:
> >
> >     int status;
> >     ioctl(upsfd, TIOCMGET, &status);
> >
> > Anybody can help me? I have no idea about what's wrong with this code.
>
>strace would give a hint.  TIOCMGET should only fail because a call to
>GetCommModemStatus fails.  If so, the strace would contain a line which
>talks about setting errno in fhandler_serial::ioctl.

Corinna,

thanks a lot for your advice.
I tried to use strace. Here is what I see:

...
Attached to pid 3260 (windows pid 3252)
     4       4 [main] test 3260 nanosleep: 0 = nanosleep (2000, 0)
   149     153 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    34     187 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    28     215 [main] test 3260 writev: writev (1, 0x22D840, 1)
    25     240 [main] test 3260 fhandler_console::write: A0503C0, 17
    21     261 [main] test 3260 fhandler_console::write: at 67(C) state is 0
   645     906 [main] test 3260 fhandler_console::write: 17 = write_console 
(,..17)
    67     973 [main] test 3260 writev: 17 = write (1, 0x22D840, 1), errno 22
    26     999 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    21    1020 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    25    1045 [main] test 3260 ioctl: fd 3, cmd 5415
    23    1068 [main] test 3260 fhandler_base::ioctl: -1 = ioctl (5415, 
0x22EE24)
    21    1089 [main] test 3260 ioctl: returning -1
    22    1111 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    27    1138 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    23    1161 [main] test 3260 writev: writev (1, 0x22D840, 1)
    22    1183 [main] test 3260 fhandler_console::write: A0503C0, 20
    20    1203 [main] test 3260 fhandler_console::write: at 115(s) state is 0
    92    1295 [main] test 3260 fhandler_console::write: 20 = write_console 
(,..20)
    26    1321 [main] test 3260 writev: 20 = write (1, 0x22D840, 1), errno 22
    21    1342 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    20    1362 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    21    1383 [main] test 3260 ioctl: fd 3, cmd 5418
    20    1403 [main] test 3260 fhandler_base::ioctl: -1 = ioctl (5418, 
0x22EE24)
    20    1423 [main] test 3260 ioctl: returning -1
    25    1448 [main] test 3260 nanosleep: nanosleep (2000)
1999523 2000971 [main] test 3260 nanosleep: 0 = nanosleep (2000, 0)
   122 2001093 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
  3405 2004498 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    71 2004569 [main] test 3260 writev: writev (1, 0x22D840, 1)
    25 2004594 [main] test 3260 fhandler_console::write: A0503C0, 17
    21 2004615 [main] test 3260 fhandler_console::write: at 67(C) state is 0
   145 2004760 [main] test 3260 fhandler_console::write: 17 = write_console 
(,..17)
   100 2004860 [main] test 3260 writev: 17 = write (1, 0x22D840, 1), errno 22
   160 2005020 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    28 2005048 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    25 2005073 [main] test 3260 ioctl: fd 3, cmd 5415
    23 2005096 [main] test 3260 fhandler_base::ioctl: -1 = ioctl (5415, 
0x22EE24)
    20 2005116 [main] test 3260 ioctl: returning -1
    20 2005136 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
24093 2029229 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    67 2029296 [main] test 3260 writev: writev (1, 0x22D840, 1)
    25 2029321 [main] test 3260 fhandler_console::write: A0503C0, 20
    20 2029341 [main] test 3260 fhandler_console::write: at 115(s) state is 0
22715 2052056 [main] test 3260 fhandler_console::write: 20 = write_console 
(,..20)
    88 2052144 [main] test 3260 writev: 20 = write (1, 0x22D840, 1), errno 22
16903 2069047 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    90 2069137 [main] test 3260 __cygwin_lock_unlock: threadcount 1.  not 
unlocking
    30 2069167 [main] test 3260 ioctl: fd 3, cmd 5418
    26 2069193 [main] test 3260 fhandler_base::ioctl: -1 = ioctl (5418, 
0x22EE24)
    22 2069215 [main] test 3260 ioctl: returning -1
    30 2069245 [main] test 3260 nanosleep: nanosleep (2000)
1999103 4068348 [main] test 3260 nanosleep: 0 = nanosleep (2000, 0)
   122 4068470 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    33 4068503 [main] test 3260 __cygwin_lock_lock: threadcount 1.  not locking
    29 4068532 [main] test 3260 writev: writev (1, 0x22D840, 1)



I can't see any ioctl call to GetCommModemStatus :(
Am I missing something?


llandre

DAVE Electronics System House - R&D Department
web:   http://www.dave-tech.it
email: r&d2 AT dave-tech DOT it


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019