ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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
(real COM1 serial port) files. You have to find program which know about protocol used in connection if there is no special driver.
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
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.
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?
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
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.
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.
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:
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).
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.
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.