LinuxQuestions.org
Register a domain and help support LQ
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 07-16-2006, 10:55 PM   #1
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Rep: Reputation: 30
Interfacing with devices


I'm trying to interface with several devices such as an IR dongle and a serial/usb connection, and I was wondering how I would to that. Basically, I have two medical devices that store data, and I need to get the data out. Is there some way I could connect, and then blindly plod along to get it to release the data, or is there some standard communication language that I could use. Basically, any way to get the data that's stored in the device out would be very, very helpful.

Thanks,
-Peter
 
Old 07-16-2006, 11:36 PM   #2
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 640

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Hi, worldgnat.

What says `dmesg' about your device ( `dmesg|tail' ) ? What type of device you try to connect? Which cable you use (for example Profilic PL2303 USB/Serial converter)?
Provide more information please.

In general, if driver for your device is correctly installed, then your device represented in your system as "/dev/something" file.
The second case is serial devices. In this case you could connect with device via
Code:
/dev/ttyUSB0
(usb/serial) or
Code:
/dev/ttyS0
(real COM1 serial port) files. You have to find program which know about protocol used in connection if there is no special driver.
 
Old 07-16-2006, 11:41 PM   #3
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
minicom is a nice little app for communicating over serial connections, might be worth having a look at that rather than have a tail -f /dev/ttyS0 in one window and echo'ing commands to the device in another
 
Old 07-17-2006, 03:44 PM   #4
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
Ok, I've ordered an rs-232 to usb converter that I'll need, and once I get it (in a day or two with any luck), Edit: I'm going to try an IR dongle via serial on a desktop (I was waiting because my computer doesn't have a serial port.) By the way, the device is an Animas IR 1000 insulin pump. Another is a blood glucose testor. Please let me know if you have any insite.

Thanks,
-Peter

Last edited by worldgnat; 07-17-2006 at 05:20 PM.
 
Old 07-17-2006, 07:23 PM   #5
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
Ok, I tried the tail -f /dev/ttyS0 and echo method, and I got something to work. now when I echo to /dev/ttyS0 the little red LED on top of the dongle flashes. No change in the insulin pump or the out of tail -f /dev/ttyS0 though. I guess we're just not speaking the same language. I tried "help", "command", and "commands". No output what so ever. Minicom seemed to only want to initiate the modem, and not connect via serial port. It's a step in the right direction. Any ideas?

Thanks,
-Peter
 
Old 07-17-2006, 09:44 PM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,168

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
worldgnat,

Devices like this use a protocol. It means that you have to ask something in a specific way, and you get an answer in a specific format.

There are a million standard formats (http, ftp, telnet, something to talk with the computer in your car) and a zillion proprietary formats.

A number of formats is binary and they use special codes like DLE, STX and other codes < 0x20. Some other formats are pure ASCII so it is easy to recognize the messages using an analyzer. Then other formats use binary control characters, but ASCII as message body.

If you have something standardized, sometimes you can issue a command, like "help". Sometimes devices (like routers) can speak http over serial so you can connect a web browser.

Summarizing, if you have a device of brand X, you really need to know the protocol that is being used. Only then you can do meaningful requests, and interpret the results accordingly.

jlinkels
 
Old 07-17-2006, 09:46 PM   #7
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
Makes sense. I was just hoping it would be something easy . I'm going to try to contact my local sales rep tomorrow and see if he can get someone to talk to me about how to communicate with the device.

Thanks,
-Peter
 
Old 07-17-2006, 10:02 PM   #8
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
I was thinking: is there any way to hack this? I guess not, but how do people discover the protocol that each device uses?

Thanks,
-Peter
 
Old 07-17-2006, 11:23 PM   #9
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
You need a working system to 'hack' the protocol. If your device e.g. comes with windows drivers and software, you can setup a windows box. Next you can 'snif' the communication using one of the following methods:
1)
Hook an oscilloscope on the relevant lines (data/clock; not sure which lines there are for USB) and see what goes over the lines when you press buttons etc. This is definitely the hard way but somtimes the only one).
2)
You can look for some sniffer-software on the internet that will display the data on the relevenat lines. Do a search for 'USB sniffer' or 'USB monitor' on the internet.

In both cases, you need to analyze what you see and get the protocol out that way.
 
Old 07-17-2006, 11:35 PM   #10
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
I'll try the company first, but then I'll probably try to figure out the protocol via the method you mentioned just to learn how to do it. It sounds complicated, but it sounds like it would be a good skill to learn.

Thanks,
-Peter
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Interfacing IPTABLES with PHP atomicfire Programming 1 07-05-2006 11:50 AM
interfacing using parallel port divu Programming 1 04-13-2006 08:39 AM
Glade tool interfacing with C santhosh.linux Programming 0 11-22-2005 03:46 AM
interfacing TI-83 1337 Twinkie Programming 2 10-15-2004 07:09 PM
Interfacing with websites in C smackboy Programming 2 01-29-2004 03:38 AM


All times are GMT -5. The time now is 12:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration