LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2017, 09:13 PM   #1
wm1ke
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Rep: Reputation: Disabled
USB RS-232 Serial Port monitoring/sniffing


I have a radio connected via a USB serial port to my Ubuntu box. Software on the Linux box manipulates the radio and the raio sends back lots of information like signal strength.

I need to capture the traffic going in anf out of the USB port. I can get lots of statistics using the "cat usbmon" approach but I have not discovered any way to capture the actual data.

Any Suggestions?
Thanks, Mike
 
Old 03-03-2017, 01:53 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Welcome.

Does it show up as something like /dev/ttyUSB0 on your system? If so, then it can be treated like a regular serial port. Then you could whip up something easy with perl using Device::SerialPort, though I expect that there is probably something similar for Python if that is more familiar to you.
 
Old 03-03-2017, 06:30 PM   #3
wm1ke
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks!

The Unix device is /dev/usbtty0
Perhaps I did not make the problem clear:
The port is connected to an RS-232 cable which is connected to the radio at the other end. I can not use a simple Perl script because the the port is already mounted by the radio's software running on the computer.

What I need is a peice of code that will report back to me what is going up and down that rs232 cable.
I think of it like a Tee where the data goes up and down the cable but I need to tap/sniff the data.
Mike
 
Old 03-03-2017, 07:39 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Nothing as simple as tee, but I was recently at a conference where a new (as in kernel 4.9+ only) kernel probing framework was demonstrated. The presenter has for example a tool that is used to snoop another tty. Everything displayed on the target was replicated on the snooper.
Used eBPF to inject a kprobe - needs pyhon/lua code to inject c code for the intercept and knowledge of the (kernel) function being probed and its parameters. Not simple, but probably a template for what you are planning.

The video of the presentation is here. He should have links at the end, but this is the home page of bcc, the userspace compiler collection that takes that python/lua and generates the probe for you.
Have fun - I have.
 
Old 03-03-2017, 10:00 PM   #5
wm1ke
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
@syg00:
Thanks. Yes, that is what I am looking for but I guess I don't understand why such a tool does not already exist. Huh...
Mike
 
Old 03-03-2017, 10:52 PM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
There is apparently jpnevulator in the repositories of at least the Debian-based distros which might do the job, but I haven't tried that yet. There are also some tricks you can do with socat but I've gotten mixed results from that route.
 
1 members found this post helpful.
Old 03-04-2017, 01:29 PM   #7
wm1ke
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
@Turbocapitalist:
That's it! it took me a while to get it running, anf I have not totally certified the output, but it does appear that this is giving me access to the serial ports.
Thanks.
I do not know how to give you credit or points on thos forum but I am happy to.
Mike
 
  


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
Antique, 9 pin, serial trackball - thru' Plugable USB to RS-232 DB9 Serial Adapter TheBigMing Linux - Newbie 10 07-31-2014 06:57 AM
Serial communication problem RS-232 - USB(FTDI-chip) fenomax Programming 3 11-26-2011 05:57 PM
Experience with 8 bit serial AND parity with HL-420 USB-RS-232 converter? cordata Linux - Hardware 4 06-22-2009 08:47 AM
Serial Port (RS-232) programming on a Linux Machine tmclint Linux - Software 2 03-26-2008 08:36 PM
I want to sent string out to serial port com1 (RS-232) lek171 Programming 1 12-25-2005 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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