This is the mail archive of the
cygwin
mailing list for the Cygwin project.
IOCTL using <ddk/ntddser.h>
- From: Bert <dsboiz at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 11 Mar 2009 22:57:05 +0000 (UTC)
- Subject: IOCTL using <ddk/ntddser.h>
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/