LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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


Closed Thread
  Search this Thread
Old 01-30-2012, 09:37 AM   #1
Ninaeve
LQ Newbie
 
Registered: Jan 2012
Posts: 21

Rep: Reputation: Disabled
Question Retrieve data from a USB port


Hi everybody.
I'm using uClinux and compiling with arm-linux-gcc.
I would like to connect to a USB GPS and retrieve its data saving them in a file.
The USB GPS is seen as a common read-only tty port .
I think I setted properly the \dev\ttyUSB0 port using the
struct termios options
and I can open it, but I can't manage to successfully retrieve data from it, it gives me blank spaces or unreadable characters.....
I tried with cat but it works only in the bash and like above.
If someone can give me any hint it would be very kind of him/her and I would be gratefull.
Thanks in advance and
1) Please I'm sorry for my English
2) Sorry I'm a Linux newby
 
Old 01-30-2012, 11:40 AM   #2
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
Okay, first, lets clarify some jargonolgy. You aren't reading from a USB port, you're reading from a device. The device happens to be connected via a USB interface, however that is probably irrelevant. You seem to have found that the device is /dev/ttyUSB0 (but not \dev\ttyUSB0).
Since you've stated that you've used a struct termios to configure the communications with the device, I conclude that you are using your own C code to talk to the device. You should post here, in [CODE] [/CODE] tags, the relevant code fragments.
If the device can be expected to communicate using ASCII string data, you should be able to use a serial communications tool such as C-Kermit to communicate with the device. If that works, then you can conclude that the device and related cabling and configuration is correct, and that you should focus on your code.
Using bash to do serial communications is a recipe for frustration.

--- rod.
 
Old 01-30-2012, 12:30 PM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Duplicate post, follow discussion here:
http://www.linuxquestions.org/questi...9/#post4588381
 
  


Closed Thread



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
[SOLVED] how to retrieve lost data on a usb stick zenofronia Linux - General 14 07-28-2013 08:49 PM
USB data got corrupt- How to retrieve? babi Linux - Newbie 3 01-09-2012 07:54 AM
Best way to retrieve data baldurpet Linux - Software 3 12-25-2008 12:48 AM
retrieve data from old (working) hd with lvm JohnLocke Linux - General 2 07-03-2006 09:47 PM
Very urgent! Need to retrieve some data! Help bikov_k General 2 10-16-2004 06:51 AM

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

All times are GMT -5. The time now is 05:28 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