Problem with ioctl call

pehr anderson pehr at alum.mit.edu
Fri Jul 20 01:34:01 EDT 2001


Dear Isaac, 

After spending an hour pawing through previous python serial drivers
I haven't found any that "peek" how many unread received bytes,  
rather than simply reading the bytes, with a non-blocking call,
and seeing how many you got.
Can I ask why you are needing to peek without reading?
Please forgive me if you have already answered this in a previous post.

I have included the Mail after my message.
Other interesting pages are listed below.
You have probably already mined this similar project for ideas,
but I included them for anyone else who'd like to reference the
previous work and help you get this fixed.

http://dbforums.com/t61191/s34ae7b096d9b79a383f028f83165cc31.html

xio -- cross platform serial IO for python
xio is a cross platform python module for serial IO. It is currently
implemented for Win32 and POSIX systems, under the native Win API and
the termios interface, respectively.
http://ecl.embedded.cl/xio

I would be very excited to see cross-platform device code included 
in the standard python distributions. 

	-pehr



http://mail.python.org/pipermail/python-list/2001-January/026295.html
serial i/o under linux?
Grant Edwards grante at visi.com
Tue, 23 Jan 2001 15:47:25 GMT

    * Previous message: serial i/o under linux?
    * Next message: How do I know all thrown exceptions of a function?
    * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

In article <94igau$h6i$1 at nnrp1.deja.com>, henry_crun3583 at my-deja.com
wrote:

>Can anyone give an example of simple serial port ops under linux?

I wrapped it up in the simplest way I could at

  ftp://ftp.visi.com/users/grante/python/PosixSerial.py

There is no documentation other than example usage in a dumb
little GTK based terminal emulator:

  ftp://ftp.visi.com/users/grante/python/lcom.py

>ie I want to write a string, and readlines until done or timeout....

You can do the timout using select or by using the serial
driver timout funcitonality (man termios).

-- 
Grant Edwards           grante             Yow!  Why don't you
                          at               ever enter and CONTESTS,
                       visi.com            Marvin?? Don't you know
                                           your own ZIPCODE?




Isaac Barona wrote:
> 
> Hi all,
> 
> I am trying to do a multi-platform serial port library in python
> (linux and win95 at the moment) that I hope to release next week.
> 
> In linux, I get the following error when using an ioctl call to get
> then number of bytes waiting to be read:
> 
> >>> tty.inWaiting()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "SerialPort_linux.py", line 179, in inWaiting
>     n=fcntl.ioctl(self.__handle, TERMIOS.TIOCINQ)
> IOError: [Errno 14] Bad address
> 
> Any help???
> 
> This happend with python 2.0.1 and python 1.5.2 over linux 2.0.34.



More information about the Python-list mailing list