hamedalfahad / php-serial

Automatically exported from code.google.com/p/php-serial
0 stars 0 forks source link

Windows : must specify all com port settings with one command #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Call multiple "confxxx" functions in script
2. Run script on command line
3. run "mode COM1" on command line

What is the expected output? What do you see instead?
I'm doing this

$baud_rate = 9600;
$serial->confBaudRate($baud_rate); 
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("rts/cts");

However, I found out only last call takes effect, and verified on command line 
that when calling mode, it only puts into effect flags specified with that 
command, all other settings put back to default.

I had too collect the settings and specify them with single mode command "mode 
COM1 BAUD=96 parity=n stop=1 data=8 xon=off octs=on rts=hs"

You wouldnt notice this if your default settings where what you wanted.  I only 
noticed because for some reason it kept defaulting to even parity and 7 data 
bits.

What version of the product are you using? On what operating system?
Latest from svn read only, Win7 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by cnm3...@gmail.com on 20 Apr 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Attaching version of code I'm currently using, which has mostly untested code 
for windows mode fix, but it should work.  I have array of all mode settings 
with default values.  On each configuration function, i change value of 
respective value in array, then generate mode string from array, and use it.

This code also has other changes, not entirely sure how much it differs from 
base code.  I have function in there for use in non windows OS for setting some 
serial flags for ascii vs binary communication(things like ignbrk icrnl, etc).  
It also supports lockdev for serial port locking under linux.

I mainly use this in linux environment, but windows support is must.

Original comment by cnm3...@gmail.com on 8 Dec 2011 at 4:42

Attachments: