Talking to a usb device (serial terminal)

Grant Edwards grante at visi.com
Tue Mar 4 23:13:15 EST 2008


On 2008-03-04, blaine <frikker at gmail.com> wrote:

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

> I want to thank you SO MUCH for all your help.  Here are my issues
> that I overcame (sanity check):

> 1. Why did we have to use 0x1007, instead of 0x10007 that our grep
>    command returns?

The number might be different for the host where you did the
grep that it is for the target machine (IIRC, you said it was
an ARM, right?).  Did you do the grep on the include files for
the ARM target or on a host of some other architecture?

The actual numbers might also be different in different
versions of the kernel.

> 2.  PySerial works beautifully.  Thank you for the suggestion.
>     What I had to do was add this to the PySerial source root
>     in serialpostix.py, after the import termios:
>
> termios.B921600 = 0x1007

[...]

> ... so now I can pass 921600 as a parameter to PySerial! :)
>
> So my next question is - I would like to contribute to the
> python source tree by updating termios.h to handle the higher
> baud rates by default.  Is this a good opportunity for me to
> submit a patch? I've never done this before but have always
> been interested in doing so.

Sure!  It's been a while since I submitted a patch, and I don't
remember what the process is, but hopefully somebody reading
the thread does.  It could be that the change is already in the
development branch...

-- 
Grant Edwards                   grante             Yow!  Two LITTLE black
                                  at               dots and one BIG black
                               visi.com            dot...nice 'n' FLUFFY!!



More information about the Python-list mailing list