Re: [opensuse] howto - Read Data from Serial Port?
Banning someone out of personal spite is uncalled for fascism wrote:
David C. Rankin wrote:
Listmates,
A linux question. I have a phone system that will output call logs through an rs-232 cable. I would like to write a script that will read the data from the serial port and input it into a mysql table.
cat /dev/ttyS_ | data_storing_program
Thanks Theo, and Mr. fascism, I will look at the python interface and definitely see if I can make the cat script work. Another question, If I write a small script and "sleep" for 30 seconds or so during the loop to cut down on racing the loop, will that have any unintended consequences I should look out for? -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Banning someone out of personal spite is uncalled for fascism wrote:
David C. Rankin wrote:
Listmates,
A linux question. I have a phone system that will output call logs through an rs-232 cable. I would like to write a script that will read the data from the serial port and input it into a mysql table.
cat /dev/ttyS_ | data_storing_program
Thanks Theo, and Mr. fascism,
I will look at the python interface and definitely see if I can make the cat script work.
Another question, If I write a small script and "sleep" for 30 seconds or so during the loop to cut down on racing the loop, will that have any unintended consequences I should look out for?
Only if the pipe fills up REALLY quickly. If I remember correctly, it can hold a few kilobytes. The size of the pipe can be determined this way: $ echo "`ulimit -p` 512 * p" | dc For most serial communications, you won't have to worry about the pipe overflowing, because serial ports are slow in comparison to processor speed. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Banning someone out of personal spite is uncalled for fascism wrote:
David C. Rankin wrote:
Listmates,
A linux question. I have a phone system that will output call logs through an rs-232 cable. I would like to write a script that will read the data from the serial port and input it into a mysql table.
cat /dev/ttyS_ | data_storing_program
Thanks Theo, and Mr. fascism,
I will look at the python interface and definitely see if I can make the cat script work.
Another question, If I write a small script and "sleep" for 30 seconds or so during the loop to cut down on racing the loop, will that have any unintended consequences I should look out for?
You might want to drop that down to 10 seconds. On the other hand, if you just write the program as if it's taking input from the keyboard, the process will automatically "block on I/O" and go to sleep until there is data ready for it to read. Try both with and without explicit sleep statements. I'm pretty sure that I/O blocking will prevent the sort of problem that you're anticipating. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Banning someone out of personal spite is uncalled for fascism wrote:
David C. Rankin wrote:
Listmates,
A linux question. I have a phone system that will output call logs through an rs-232 cable. I would like to write a script that will read the data from the serial port and input it into a mysql table.
cat /dev/ttyS_ | data_storing_program
You might check out the program called "minicom". It can handle the port initialization for you. Also, it can write out to a file - just make that a named pipe and you can run your mysql or whatever script to load your data. Curt -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Banning someone out of personal spite is uncalled for fascism
-
Curt Grimley
-
David C. Rankin