public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* Setting PL2303 baud rate
@ 2013-05-06 20:27 Fernando Di Nucci
  2013-05-06 20:42 ` Grant Edwards
  2013-05-06 20:43 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Fernando Di Nucci @ 2013-05-06 20:27 UTC (permalink / raw)
  To: linux-serial

I have a PL2303HX adapter and I need to set up its baud rate to 1228800 
or 2457600

(openwrt, linux kernel 3.3.8, coreutils 8.16 and ubuntu quantal 
3.5.0-28, same coreutils).

I tried stty -F /dev/ttyUSB0 baudrate

Well, when baudrate is 921600 or 3000000 everything is fine, but when I 
try 1228800 or 2457600 stty complaints:
stty: invalid argument '2457600'.

I searched stty source and added:

#ifdef B1228800
   {"1228800", B1228800, 1228800},
#endif
#ifdef B2457600
   {"2457600", B2457600, 2457600},
#endif

and compiled but no luck. I don't know where else those values need also 
to be modified.

Can you please point me to the right direction?

Or there is another way to set pl2303 baud rate passing some information 
on the command line of kernel module?

I searched the web but didn't find any clue.

Any help appreciated, thank you very much anyway.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Setting PL2303 baud rate
  2013-05-06 20:27 Setting PL2303 baud rate Fernando Di Nucci
@ 2013-05-06 20:42 ` Grant Edwards
  2013-05-06 20:43 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Edwards @ 2013-05-06 20:42 UTC (permalink / raw)
  To: linux-serial

On 2013-05-06, Fernando Di Nucci <f.dinucci@alice.it> wrote:
> I have a PL2303HX adapter and I need to set up its baud rate to 1228800 
> or 2457600
>
> (openwrt, linux kernel 3.3.8, coreutils 8.16 and ubuntu quantal 
> 3.5.0-28, same coreutils).
>
> I tried stty -F /dev/ttyUSB0 baudrate
>
> Well, when baudrate is 921600 or 3000000 everything is fine, but when I 
> try 1228800 or 2457600 stty complaints:
> stty: invalid argument '2457600'.
>
> I searched stty source and added:
>
> #ifdef B1228800
>    {"1228800", B1228800, 1228800},
> #endif
> #ifdef B2457600
>    {"2457600", B2457600, 2457600},
> #endif
>
> and compiled but no luck. I don't know where else those values need also 
> to be modified.
>
> Can you please point me to the right direction?
>
> Or there is another way to set pl2303 baud rate passing some
> information on the command line of kernel module?
>

I would _guess_ that the PL2303 driver is modern enough that it
supports termios interface that allows application code to specify
arbitrary baud rates -- so you could try that:

http://www.gossamer-threads.com/lists/python/python/1019389?do=post_view_threaded

-- 
Grant Edwards               grant.b.edwards        Yow! Should I get locked
                                  at               in the PRINCICAL'S
                              gmail.com            OFFICE today -- or have
                                                   a VASECTOMY??


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Setting PL2303 baud rate
  2013-05-06 20:27 Setting PL2303 baud rate Fernando Di Nucci
  2013-05-06 20:42 ` Grant Edwards
@ 2013-05-06 20:43 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2013-05-06 20:43 UTC (permalink / raw)
  To: Fernando Di Nucci; +Cc: linux-serial

On Mon, May 06, 2013 at 10:27:51PM +0200, Fernando Di Nucci wrote:
> I have a PL2303HX adapter and I need to set up its baud rate to
> 1228800 or 2457600
> 
> (openwrt, linux kernel 3.3.8, coreutils 8.16 and ubuntu quantal
> 3.5.0-28, same coreutils).
> 
> I tried stty -F /dev/ttyUSB0 baudrate
> 
> Well, when baudrate is 921600 or 3000000 everything is fine, but
> when I try 1228800 or 2457600 stty complaints:
> stty: invalid argument '2457600'.
> 
> I searched stty source and added:
> 
> #ifdef B1228800
>   {"1228800", B1228800, 1228800},
> #endif
> #ifdef B2457600
>   {"2457600", B2457600, 2457600},
> #endif
> 
> and compiled but no luck. I don't know where else those values need
> also to be modified.
> 
> Can you please point me to the right direction?

I don't think stty can handle the higher baud rates, you are going to
have to do the tty ioctl commands yourself in your program.

Take a look at the cfsetospeed() man page for details.

Hope this helps,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-06 20:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 20:27 Setting PL2303 baud rate Fernando Di Nucci
2013-05-06 20:42 ` Grant Edwards
2013-05-06 20:43 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox