[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using serial port read and write



Howdy,

    I haven't written serial code since the days of DOS and never under
Linux so take what I have to say with a grain of salt. That being said
as a hardware tech I've debugged many broken serial connections.

On Thu, Jul 26, 2012 at 01:22:11PM +0100, abdelkader belahcene wrote:

<snip> 

> On one machine the programs ran perfectly,
> when I tried  them on another machine, exactly same machine running same
> system ( linuxMint), in same conditions,  they didn't.

    I've no experience with Mint but with Debian, RedHat and Slakware it's
very easy to answer one question differently during the install and come
up with a much different system so I'd suggest you question your assumption
that the systems are identical and try to verify it. For a simple package
comparison in Debian pipe the output of this "dpkg --list | grep '^ii'"
to a file on the 2 systems and compare the files. On RedHat this
"rpm -qa | sort" used to give similar information.
    This still doesn't mean the systems are the same but a comparison of
the contents of /etc/ will bring you closer.

    Compare the outputs of setserial and statserial for the serial ports of
both machines. 'dmesg | grep serial' should tell you that the kernel has
recognized both serial ports and neither is disabled in BIOS.

    Physically a serial port is comprised of a transmitter and a receiver,
either can have a blown gate and be non functional.

    I'd suggest you combine your 2 programs with subroutines for serial_send
and serial_receive that accept parameters for which port and the string sent/
received which will allow you to readily reverse the direction of communication.
It might be that having a blown transmitter or receiver on one port of the 2nd
machine it could still communicate in the other direction.

    If the 2 machines are close enough to each other you can test further by
running comm from each port of each machine giving you 8 combinations to narrow
down the problem.

    Lastly, while the process is still fresh in your mind comment your code
liberally and re-examine your choice of variable names trying to think if
they are descriptive enough that you won't puzzle over them 2 years from now.

HTH,
Mike

-- 
Satisfied user of Linux since 1997.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


Reply to: