Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,053 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,577 people online right now. Registration is fast and FREE... Join Now!




Reading from a usb device

 
Reply to this topicStart new topic

Reading from a usb device, in c++ on linux

okasa
3 Aug, 2008 - 10:45 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 1

Language: c++
Platform: Linux (debian specifically but i want it to work on any linux system)

So i have a device, specifically a GPS reciever: USGlobalSat BU-353. It connects to the computer using USB, constantly sending current GPS coordinates. I simply want to read in this data, no writing at all (hoping it will make this simpler). I can find the device when i run lsusb in the terminal:

okasa@okasa-1:~$ lsusb
Bus 002 Device 008: ID 046d:c51a Logitech, Inc.
Bus 002 Device 007: ID 05ac:0220 Apple Computer, Inc. Apple Aluminum Keyboard
Bus 002 Device 006: ID 05ac:1006 Apple Computer, Inc. Hub in Apple Aluminum Keyboard
Bus 002 Device 005: ID 0424:2228 Standard Microsystems Corp. 9-in-2 Card Reader
Bus 002 Device 004: ID 0424:2602 Standard Microsystems Corp.
Bus 002 Device 002: ID 0424:2512 Standard Microsystems Corp.
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port <<<------ITS THIS ONE
Bus 001 Device 001: ID 0000:0000

Is there a simple way to do this? A more complex way? i'm open to any ideas as ive looked all over for an answer to this question.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Reading From A Usb Device
5 Aug, 2008 - 06:57 PM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,435



Thanked: 64 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(okasa @ 4 Aug, 2008 - 02:45 AM) *

Is there a simple way to do this?

Usually when attaching a storage device to Linux, I check the dmesg to see which drive it has. Usually /dev/sda or the partitions will be /dev/sda1, /dev/sda2, ect. Then you mount these to a familiar mount point. I have both /mnt/flash & /mnt/hd that I use for external hard drives, but you can really make them whatever you want.

I know this isn't C/C++ exactly, but you could use system() calls to get this done simply.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 05:46PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month