On 2010-04-07, Max Kotasek <mawr...@gmail.com> wrote: > I'm trying to figure out how to parse the responses from fcntl.ioctl() > calls that modify the serial lines in a way that asserts that the line > is now changed.
Two comments: 1) None of the Linux serial drivers I've worked on return line states except when you call TIOCMGET. 2) If the TIOCMBI[S|C] call returned a 'success' value, then the line was set to what you requested. If you want to read back the state that you just wrote, you can call TIOCMGET, but for the "output" pins it's always going to return the last value that was written. > For example I may want to drop RTS explicitly, and > assert that the line has been dropped before returning. Call TIOCMSET. If it doesn't return an error, then you're done. > Here is a brief snippet of code that I've been using to do that, but > not sure what to do with the returned response: What returned response? The only thing that is returned by TIOCMBIS/TIOCMBIC is a status value of 0 for success and <0 for failure. IIRC, that value is checked by Python's fcntl.ioctl wrapper and it will raise an exception on failure. > Is someone familiar with manipulating serial signals like this in > python? Yes. > Am I even taking the right approach by using the fcntl.ioctl call? Yes. When you set/clear RTS or DTR do they not go up/down? Even if you can't use pyserial, it's a good source for example code. -- Grant Edwards grant.b.edwards Yow! TONY RANDALL! Is YOUR at life a PATIO of FUN?? gmail.com -- http://mail.python.org/mailman/listinfo/python-list