lock access to serial port

taco tralalal at joepie.nl
Wed Mar 19 05:00:32 EDT 2008


kkadrese at gmail.com wrote:

> hello group,
> 
> how to get ttyS0 serial port for exclusive access? I have a python
> script that uses this device with AT commands. I need that two
> instances can call simultaneosuly this python script but only one of
> them gets the device. I tried fcntl.flock, it was just ignored, put
> writtable file LCK..ttyS0 in /var/lock, tried ioctl (but I may not
> know what are appropriate arguments), googled half a day for various
> phrases, error messages etc....without success.
> 
> please help,
> 
> Andra
not sure if I understand you well, but how about a server application which
accepts 2 clients which can send messages which are output on the serial
device? The serial device access protected with a mutex while receiving
messages done in 2 threads or something.
taco



More information about the Python-list mailing list