'ioctl ' call in python (serial port reading)

mixo mixo at beth.uniforum.org.za
Tue Dec 4 05:36:29 EST 2001


Markus Schaber wrote:

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

Yes, "unixoid Python incarnations" have the functions. But, here is the 
thing, in the above code, the variable "mdlns" is an integer, but 
"&mdlns" is an address. How do I get around that?





More information about the Python-list mailing list