Ahoj,

když v Pythonu napíšu tohle,

import tty, os, fcntl
fd = os.open('/dev/ttyS0', os.O_RDWR | os.O_SYNC)
fcntl.ioctl(fd, tty.TIOCMBIC, tty.TIOCM_DTR)

tak to vyvolá výjimku
IOError: [Errno 14] Bad address

zatímco ekvivalentní program v C (puštěný na stejném stroji pod stejným 
uživatelem)

#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char **argv) {
   int fd, r;
   int iFlags = TIOCM_DTR;

   fd = open("/dev/ttyS0",  O_RDWR | O_SYNC);
   if (fd == -1){
     perror("Failed to open port");
     return -1;
   }
   r = ioctl(fd, TIOCMBIC, &iFlags); /* Vynuluje DTR */
   if (r == -1){
     perror("TIOCMBIC failed");
     return -1;
   }
   close(fd);
   return 0;
}

funguje a žádnou chybu nevyhodí. Netušíte, v čem může být rozdíl?

Díky
johny
_______________________________________________
Python mailing list
[email protected]
http://www.py.cz/mailman/listinfo/python

Odpovedet emailem