[prog] Do I need to write a kernel module?

softwaregurl l_chix at softwaregurl.com
Mon Dec 28 09:40:24 UTC 2009


Ok, I think I got it now.  In Qbasic I was opening the port near the beginning of the program and leaving it open.  the delay happened without ever closing it.  the sh script is open-write-close-delay-open-write-close.  Sounds like as good of an excuse as any to get back into C/C++.

I was using stty to set up the serial port.  Something like Tuzemi's examples with many variations.  And somehow the part in the quotes in the echos did not make it back and forth.  Now sylpheed shows a UTF character and part missing instead of the hex notation.

Thanks both of you.
-SG

On Mon, 28 Dec 2009 07:32:01 +0000
"Far Jump" <far.jmp at gmail.com> wrote:

> Well... if I remember my Qbasic you had to open the serial port and specify baud rate, parity, stop bit, etc... then you read/write and finally close the port.  MSDos and Qbasic knew they were dealing with a serial port and did some housekeeping to manage the I/O.  (BTW how are you setting baud, parity, size, stop in BASH ?)
> 
> Now, using the pipe to dump data to a file/device is very simple and really based on file I/O.  Which opens, writes and closes the device (hence the buffering).  Depending on how this device communicates, you might need a higher level of sophisticated control.
> 
> Look at these links:
> 
> http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.system/2009-04/msg00082.html
> 
> http://www.linuxjournal.com/article/6908
> 
> http://tldp.org/HOWTO/Serial-Programming-HOWTO/
> 
> jan
> ______________________________________________________________________
>  Black Holes are where God divided by Zero.
>    -- Steven Wright
> 
> ---------------------- Reply to Message Below ----------------------
> I am trying to interface with a relay board originaly used by Walmart to switch car radios into different speakers.  They have since been obsoleted and replaced, but I have one.  They were designed to be controled by a touch screen but that was never implimented and there is no info available except for a pin marked 'data'.
> I have been controling it with MSdos and Qbasic (yes I know).  I found with a recording scope that I can duplicate the signal on a com port and convert to the level on the input by a 3 component resistor/capacitor/transistor circuit using (don't quote me..pulling specs from memory) 4800bps 5 data bits 1 stop bit and no parity but there is a non-standard delay between the 2 bytes it needs.  In Qbasic I just did a for next loop.
> I tryed using something like this in sh
> 
> echo -ne "1" >/dev/ttyS2
> usleep "$SLP"
> echo -ne "" >/dev/ttyS2
> 
> and starting it with different nice values and $SLP as root but it looks on the scope like the output is still getting buffered and is inconsistant.  This was just a shot in the dark first try.
> Could I write the same thing in C/C++ or would it have the same sort of problem? I see Kernel land and User land modules but am not sure where to start.  Maybe just hack the existing module?
> I am 2 years into Linux at home but experience writing web server apps in Perl and some hardware and software experience back as far as the AppleII series.  Still pretty inexperienced at bash (sh) and have only dabbled in hacking C under Linux so far.
> If there are any questions or could be stated more clearly, please ask.  Some of my terminology can be old or use the wrong term or acronym.
> 
> System specs:
> Dell PII 233
> Tiny Core Linux with custom compiled 2.6.26 kernel.
> 
> ty
> -SG
> -- 
> softwaregurl <l_chix at softwaregurl.com>
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming
> 
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming


-- 
softwaregurl <l_chix at softwaregurl.com>


More information about the Programming mailing list