Welcome, Guest. Please login or register.

Author Topic: Connecting Ethernet device to serial port  (Read 19126 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #14 on: May 25, 2008, 01:46:46 PM »
Quote
bloodline wrote:
When I started University, I decided that I had two options...

1. Spend a year Learning and cram an entire year's worth of Drinking into a single night...
2. Spend a year Drinking and cram an entire year's worth of Learning into a single night...

I decided that option 2 was much safer... ;-)

Well I don't really drink, so my options are:

1. Spend a year learning
2. Spend a year doing nothing and cram an entire year's worth of learning into a single night

I've got an exam on Tuesday on the auditory system, genetic inheritance and embryological development of the head and neck. The first two I think I'm ok on, as I know the auditory system very well and genetics is all very logical anyway. Development of the head and neck is really dull, so I'm thinking of just winging it. I just feel guilty because I used revision as an excuse to get out of a tedious family event, so I feel like I really should be revising :lol:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #15 on: May 25, 2008, 01:49:46 PM »
Quote
bloodline wrote:
Ok.. so what is really missing is basically the device driver software for the device... regardless of the fact that it's implemented as a virtual com port... this is simply the interface that is exposed to the controlling software....

Yes, I suppose so.

Quote
bloodline wrote:
No... you are screwed, and not in the good way :-)

You could capture the TCP/IP packets sent when issuing command and then disassemble them... but I fear that is more work than worth it...

I agree, and it would be way above my head and too much trouble to learn if I'm honest. That's why I wanted to reproduce the Windows setup on the Mac - so I don't have to analyse what it's actually doing, just interface with it in the same way I did under Windows.

Quote
bloodline wrote:
says the man who tried to run a PowerMac with no way to interface with it :-D

I sometimes wonder what people who aren't geeks actually *do* with their lives... ;-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #16 on: May 25, 2008, 02:58:27 PM »
Quote
Speelgoedmannetje wrote:
Ah, if the device actually has an ethernet port, this'd make things more easy. You only need to know the protocol of that device, then.

I will try to run a packet sniffer on the Ethernet port and have a look at the traffic. Might give some clue.

Quote
Speelgoedmannetje wrote:
But it sounds strange to me that you can do so little with telnet :-? You must be able to do everything with telnet, because telnet is dedicated to do everything; including scripts, running programs, etcetera.

Ok, well I'll have another look at the telnet services on the device just in case I missed something.

Quote
Speelgoedmannetje wrote:
If you plug this converter to your Apple's com-port, you can attach it directly using a cross-link cable. Still, you need the protocol. But all this fuss is not necessary.
-edit-Oh, ehm and the device needs to be able to interact with the  ethernet-to-comport adapter, and since it doesn't know the protocol of that adapter, so, that's a no-go anyway.

Shame - that would have made things a LOT easier.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #17 on: May 25, 2008, 03:02:32 PM »
Quote
bloodline wrote:
Suffice to say... I like a drink...

So I can see! I would probably drink a lot more if I wasn't painfully obvious of its effects...

Quote
bloodline wrote:
Waste of time... I've spent over 6 months learning German... and yet I'm still crap... I say learning is pointless.

Well, 6 months isn't enough time to learn a language, and I bet you have improved. So it's not pointless, it just takes time. But, of course you know that really ;-)

Quote
bloodline wrote:
Quote

2. Spend a year doing nothing and cram an entire year's worth of learning into a single night

Sounds like a good plan... and since you learned just before the Exam... you're less likely to forget it... makes sense really!! Lets crack open a beer and celebrate!

I can afford to forget it TBH - it's superfluous. Which makes it even more frustrating having to learn it just to get through the exam :roll:

Quote
bloodline wrote:
It's not that dull... you just need to find what bit is the most interesting and focus on that...

Well the process as a whole is fascinating, and so complex it is both beautiful and terrifying. But learning by rote which pharyngeal arches develop in to which structures and how they are innervated *is* pretty dull.

Quote
bloodline wrote:
Never feel guilty about avoiding your family... you owe them nothing!!! :madashell:

They're not even my family - they're the in-laws!

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #18 on: May 25, 2008, 03:05:08 PM »
Quote
bloodline wrote:
I don't believe the device is actually being controlled via the Serial interface.
The virtual com device, is probably not just encapsulating the commands issued via serial... I expect it's is interpreting the serial commands and then issuing proprietary control packets... that would mean Telnet would not control the device.

The fact that it is controlled via virtual com device is a red herring...

Then for now I will disregard the serial aspect and concentrate on working out what is happening post-encapsulation. If I can work that out, maybe I can start thinking about a way to create those data myself. Presumably that would require low-level access to the TCP/IP stack? ("Here is a packet of data I have manually created. Send it please...")

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #19 on: May 25, 2008, 03:46:43 PM »
Quote
bloodline wrote:
Remember, this is just my theory... If you can Telent, that make sure you explore that avenue FULLY!!

Have just checked, and it's definitely a config interface only. After outputting the current config, the telnet interface gives you the following options, none of which allow any control or monitoring of what is happening in the device.

Change Setup:
  0 Server
  1 Channel 1
  2 Channel 2
  3 E-mail
  5 Expert
  6 Security
  7 Defaults
  8 Exit without save
  9 Save and exit            Your choice ?

Quote
bloodline wrote:
But yes... I think the solution... if there is one, will come from examining the packets.

It should be fairly easy to have a look at the packets. But I have no idea how I would go about writing an app to custom make a packet and shove it in to the TCP/IP stack. Furthermore, the app would have to monitor traffic coming from the device to detect state changes. I'm losing enthusiasm for this now...

Quote
bloodline wrote:
Well, if it is a fixed function device... then you could easily build a library of packets that correspond to the commands you issue...

Yes, there will be only a limited number of commands I will ever need to send to it, so once the I/O was working I could easily tweak the data it sends to make it do different things. That's the easy part...

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #20 on: May 26, 2008, 02:54:42 PM »
Right, we're going to have a look at the packets going to the RFXCOM's IP address so we can see what is being sent. Then I'm going to try hacking up a socket application in OS X. Shouldn't be a mammoth task to write a small console app which will take the RFXCOM command and IP address as arguments and then transmit the command to the correct IP.

Where this will get more difficult will be receiving data from the RFXCOM. Apparently the software is configured with the RFXCOM's IP address so it knows where to send data. But it also listens for events coming from the RFXCOM so it can act upon them. How would this work? Would I have to maintain an open socket with the RFXCOM's IP address? If I do this, will packets coming from the RFXCOM automatically be delivered via the Mac's TCP/IP stack to my application?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #21 on: May 26, 2008, 05:03:24 PM »
Do I need to open a socket specifically between the application and the software on the RFXCOM? Or do I just open a socket to the Mac's TCP/IP stack and send a packet addressed with the RFXCOM's IP address?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #22 on: May 26, 2008, 06:36:38 PM »
I'm in way over my head here. I found some examples of BSD sockets, one of which "calls" a socket. The main function of it seems to call socket() and connect(). But I don't know whether this is as a client or a server :crazy:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #23 on: May 26, 2008, 09:19:57 PM »
Ok, just need to figure out whether the code I have written is for a client or server. Ugh, I need to put this away until after my exam...

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #24 on: May 26, 2008, 09:29:41 PM »
Hmm Wikipedia actually helped :-)

http://en.wikipedia.org/wiki/Berkeley_sockets#TCP

Explains how to set up a client and a server. I guess the RFXCOM is doing all the server business, so I'll have a look at the client setup tomorrow after the Exam Of Doom.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #25 on: May 26, 2008, 10:13:26 PM »
Thanks :-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #26 on: May 26, 2008, 10:26:32 PM »
I know. Up at 06:30 tomorrow to get to Brum in time. Can't sleep though :crazy:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #27 on: May 26, 2008, 10:48:44 PM »
Thanks :-D And I can stop thinking about this little project now I have had a small success. I compiled the example code from Wikipedia and got it working. It connects and disconnects a socket to my MacBook's IP address on port 80. I know it's working because if I specify a bogus IP it hangs (no intelligence to time-out) and if I turn off the web server it errors that the connection failed.

So now I just need to work out reading and writing, but that can wait until after 12:00 tomorrow when I can remove embryology from my brainbox.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #28 on: May 27, 2008, 07:26:04 PM »
Quote
odin wrote:
Ah...the joy of last minute studying and the relief of forgetting it all instantly the moment you walk out of the room where the exam was =).

The exam was actually quite fun :crazy:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #29 from previous page: May 27, 2008, 07:28:22 PM »
Ok here's a packet being sent to the RFXCOM, sniffed from the Ethernet port of the computer, when it turns on a power socket:


00000000 21 70 00 00 12 04

3



So I'm guessing if I just write that to the socket from my test app, it should have the same effect as the original Windows app sending it? :-?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10