delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/11/18:00:26

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=BAYES_00,J_CHICKENPOX_18,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Bert <dsboiz AT gmail DOT com>
Subject: IOCTL using <ddk/ntddser.h>
Date: Wed, 11 Mar 2009 22:57:05 +0000 (UTC)
Lines: 31
Message-ID: <loom.20090311T224103-693@post.gmane.org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

When compiled on Cygwin's gcc the code below (which asks the baud rate of a
serial port) shows the error "Funtion Not Implemented".

I tried several serial port ioctl functions in <ddk/ntddser.h> - all gave the
same error.  


I hope I'm doing something really dumb, any tips?


#include <stdio.h>	
#include <fcntl.h>  		
#include <sys/ioctl.h>			
#include <ddk/ntddser.h>	

int main() {

  int fd, result; 
  SERIAL_BAUD_RATE x; /* baud rate structure in ntddser.h */

  fd = open ( "/dev/com4" , O_RDWR | O_NOCTTY | O_NDELAY);
  if ( fd<0 ) { perror ("Can't open port - "); exit(-1); }

  result=ioctl(fd,IOCTL_SERIAL_GET_BAUD_RATE,&x,sizeof(x));

  if(result<0){perror("IOCTL failed because "); exit(-1);}

  else printf ( "Baud rate is %d.\n", result, x.BaudRate );
}




--
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