'ioctl ' call in python (serial port reading)

Markus Schaber use-net at schabi.de
Tue Dec 4 05:06:57 EST 2001


Hi,

On Tue, 04 Dec 2001 10:57:23 +0200
mixo <mixo at beth.uniforum.org.za> wrote:

> I am current trying to drop 'RTS' (Request To Send)
> on a serial port. In 'c' I do the following :
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++
> .
> .
> 
> int fd, mdlns;//fd is a  file discriptor
> .
> .
> 
> ioctl (fd, TIOCMGET, &mdlns);
> mdlns &= ~TIOCM_RTS;
> ioctl (fd, TIOCMSET, &mdlns);
> .
> .
> .
> +++++++++++++++++++++++++++++++++++++++++++++++
> 
> What would the equivilent code in 'python' be?
> How can I disable 'RTS' on a serial port?

Usually, on unixoid Python incarnations, you have the fcntl module which provides an ioctl call. The os module allows you to work with fd filedescriptors.

With those, you should be able to translate your example 1:1 to python.
Just look into the documentation for the os and fnctl module.

markus
-- 
"GPL software is not free - the cost is cooperation"



More information about the Python-list mailing list