Talking to a usb device (serial terminal)
blaine
frikker at gmail.com
Tue Mar 4 09:40:18 EST 2008
>
> It looks like the fastest speed supported by python termios on
> Linux is B460800 (uses a constant of 0x1004). If you look in
> /usr/include/..., baud rates do go up to 921600 (which uses a
> constant of 0x1007).
>
> Try using the appropriate constant from /usr/include/... (for
> the target platform, of course).
>
> --
> Grant Edwards grante Yow! Please come home with
> at me ... I have Tylenol!!
> visi.com
Thank you for your response. I can't seem to find what you're
referencing in /usr/include. I found termios.h - but it does not
define any constants (I can include it if you wish). I did find
termios.c in the Python module file, which only defines constants up
to :
[...]
{"B2400", B2400},
{"B4800", B4800},
{"B9600", B9600},
{"B19200", B19200},
{"B38400", B38400},
#ifdef B57600
{"B57600", B57600},
#endif
#ifdef B115200
{"B115200", B115200},
#endif
#ifdef B230400
{"B230400", B230400},
I could recompile python, I imagine, with additional constants but
this wouldn't be ideal - although it is a possible solution.
the only reference to a baud rate in termios.h is here:
/* Return the output baud rate stored in *TERMIOS_P. */
extern speed_t cfgetospeed (__const struct termios *__termios_p)
__THROW;
/* Return the input baud rate stored in *TERMIOS_P. */
extern speed_t cfgetispeed (__const struct termios *__termios_p)
__THROW;
/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetospeed (struct termios *__termios_p, speed_t __speed)
__THROW;
/* Set the input baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetispeed (struct termios *__termios_p, speed_t __speed)
__THROW;
the termios.h and const.h in the linux/ folder aren't much help. I'm
sure I'm just looking at the wrong file.
Thank you again for all your help!
Blaine
More information about the Python-list
mailing list