jcurl / RJCP.DLL.SerialPortStream

SerialPortStream is an independent implementation of System.IO.Ports.SerialPort and SerialStream for better reliability and maintainability. Default branch is 2.x and now has support for Mono with help of a C library.
Microsoft Public License
639 stars 199 forks source link

Custom baud rates #19

Open jorisvergeer opened 7 years ago

jorisvergeer commented 7 years ago

Hi,

I saw some todos regarding custom baud rates in your code.

I needed baud rate 345600 which is not a supported baud rate.

Here is a pull request with code for custom baud rates. I using information from: http://www.home.unix-ag.org/simon/files/serial-linux.c and https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ftdi_sio.c

It runs now for 5 minutes on my machine using a FTDI chip.

jcurl commented 7 years ago

Cool! Be patient while I get around to testing it with the serial devices I have. I'm hoping over the Easter break.

jorisvergeer commented 7 years ago

I might need to add some cleanup code around the close event

jorisvergeer commented 7 years ago

Also I was a bit lazy with returned errors

jcurl commented 7 years ago

I was also thinking, because the custom baudrate is OS specific, it might make sense to put it in its own file, and have the CMakeLists.txt compile the file depending on the OS it detects.

jcurl commented 7 years ago

What chipsets have you already tested with, and what OS are you using?

jorisvergeer commented 7 years ago

There might only be a handful of drivers that support the custom_divisor stuff although I am not sure.

jorisvergeer commented 7 years ago

I only tested with FTDI. Windows uses its own implementation. I only touched the linux part. It works on Windows and Linux in my machine ;)

jcurl commented 7 years ago

I have PL2303, an original 16550A in my laptop docking station and another USB (SCM2xxx) that I'll test with.