LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-17-2010, 04:44 PM   #1
baran_cz
LQ Newbie
 
Registered: Jan 2010
Location: Czech Republic - Europe
Distribution: CentOS
Posts: 3

Rep: Reputation: 0
Serial / USBSERIAL communication with BASH


Hi,

can you help me, please? I did probe to send command to the USB modem Axesstel (connected via usbserial in my NTB) and then read answer. It doesn't work :-( Can you help me, please, where can be error? I did probe it under CentOS 5.4. Modem works OK, I am using it for connection. I was using this modem only like example for testing communication between NTB and other HW.


#!/bin/sh
stty -F /dev/ttyUSB0 min 0 time 0 -icanon speed 115200 cs8 -echo
eval POKUS=`cat /dev/ttyUSB0`
echo "ATZ" >/dev/ttyUSB0
echo $POKUS



Thank you

Rene
 
Old 01-17-2010, 08:24 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You may need to use an 'expect' script or if you can write perl - Device::Modem

cheers
 
Old 01-18-2010, 12:31 AM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by baran_cz View Post
Hi,

can you help me, please? I did probe to send command to the USB modem Axesstel (connected via usbserial in my NTB) and then read answer. It doesn't work :-( Can you help me, please, where can be error? I did probe it under CentOS 5.4. Modem works OK, I am using it for connection. I was using this modem only like example for testing communication between NTB and other HW.


#!/bin/sh
stty -F /dev/ttyUSB0 min 0 time 0 -icanon speed 115200 cs8 -echo
eval POKUS=`cat /dev/ttyUSB0`
echo "ATZ" >/dev/ttyUSB0
echo $POKUS



Thank you

Rene
What does it do wrong?
 
Old 01-18-2010, 10:00 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Using a shell to test functionality of a serial device is a recipe for frustration. Use minicom or C-Kermit, both of which are tools intended specifically for the purpose of serial communications.
--- rod.
 
Old 01-18-2010, 10:20 AM   #5
baran_cz
LQ Newbie
 
Registered: Jan 2010
Location: Czech Republic - Europe
Distribution: CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

I did probe minicom (Linux), terminal (Windows). It works. I did probe modem only for test communication via Serial or USB port (curiosity) :-)

My test script answer me speed of my setting "115200" and not answer "OK".

R.
 
Old 01-22-2010, 05:44 AM   #6
baran_cz
LQ Newbie
 
Registered: Jan 2010
Location: Czech Republic - Europe
Distribution: CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

thank you for all infos and help. I did use other technology ... python and pyserial modul (http://pyserial.sourceforge.net/). It works ;-) When I use USB cable and set it via usbserial (ex. /dev/ttyUSB0), I can use it too. THNX.


Rene
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Communication Suraj Swami Linux - Newbie 1 06-25-2009 07:25 AM
Serial Communication Suraj Swami Linux - Newbie 3 06-23-2009 11:22 AM
Serial Communication help mitchell2345 Linux - Software 2 03-20-2009 08:41 PM
Serial Communication freeindy Programming 2 04-04-2007 08:24 AM
Serial port communication.. brianbek Linux - Software 2 01-23-2006 12:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration