#60542 - 18/01/2002 05:30
TCP/IP over Infra-red on the Empeg: A HOWTO
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
Greetings folks
Here's a note on how to get Empeg talking to another box using TCP/IP over IR.
Regards
Amit
TCP/IP over Infra-red on the Empeg
When you think about it, there are so many strings attached to infra-red data transfer. It must be short range, must be line-of-sight, and so on. However, there are numerous benefits as well: it is reasonably high speed (up to 4 Mbps for what is called fast infra-red), it is cordless, it is not exactly limited to line of sight, there is a plethora of devices that support IR out there, and so on. Oh, and it is cool in general. With an increasing number of computers (particularly laptops) including infra-red ports today, support for IrDA has been gaining momentum. In particular, open source IrDA support for Linux is eminently usable already. The IrDA stack is depicted diagrammatically here.
Making two Linuces talk TCP/IP over IR
Linux 1: Sony VAIO
I have a Sony VAIO PCG-Z505 JE laptop, on which IrDA works well. The IrDA specific contents of my /etc/modules.conf are as follows (please note that your configuration will very likely differ):
Sony VAIO PCG-Z505 JE (Linux 2.4.9, irda-utils-0.9.14) |
pre-install nsc-ircc setserial /dev/ttyS2 port 0 irq0
alias irda0 nsc-ircc
options nsc-ircc io=0x3e8 dma=0 irq=10 dongle_id=0x09
alias tty-ldisc-11 irtty
alias char-major-161 ircomm-tty
alias char-major-10-187 irnet
|
Linux 2: The Empeg
I am running the Debian potato distribution on the Empeg, as described in this HOWTO. In order to use IrDA as we are going to, the following are required on the Empeg:
- A development kernel with IrDA and PPP support. I compiled my own kernel (unchanged 2.2.14 sources as provided by Rio), but I believe any appropriate kernel will do.
- The PPP package (ppp_2.3.11-1.4.deb currently for Debian-potato).
- The irda-tools package (irda-tools_0.9.5-2.deb currently).
- The irda-common package (irda-common_0.9.5-2.deb currently).
It is easiest to use SIR to get started with IrDA (which I reckon is the only way that will work on the Empeg because of its IR hardware). We shall use PPP over SIR to get TCP/IP working. Communication speed will be limited to 115200 bps. The following steps should allow you to get a minimal connection working, which you can tailor to suit your needs thereafter:
- Let us treat the "other" (Linux 1) machine as a PPP server. It is assumed that your IR hardware is identified by the kernel and is working. The system service "irda" must also be started (in other words, an "irattach" must be performed, like "irattach /dev/ttyS2 -s 1" - please refer to IR documentation). Moreover, the relevant devices must exist (/dev/ircomm0, ...)
- Start up irda on Linux 1, if it is not already started.
- Execute "echo 1 > /proc/sys/net/irda/discovery" on Linux 1.
- Execute "pppd /dev/ircomm0 115200 noauth x.x.x.x:y.y.y.y" on Linux 1, where x.x.x.x and y.y.y.y are two appropriate IP addresses to be used for the Point-to-Point link that would be established (hopefully!)
- Make sure that a ppp device comes up. It is useful to have a "tail -f" running on /var/log/messages all this while as a debugging aid.
- Drop to the shell on the Empeg (either through a serial connection, or by logging in if your Empeg is configured for remote logins).
- Make sure the appropriate ir devices (/dev/ircomm0, ...) exist in /dev. If they don't, you need to create them. One way is to do a "tar -cpf" on Linux 1 and "tar -xpf" it on the Empeg.
- Run "irattach /dev/ttyS2 -s 1" on the Empeg. If things are fine, the irda0 device should come up.
- Execute "pppd /dev/ircomm0" on the Empeg.
- Count from 1 to 5. Do an "ifconfig -a" on the Empeg. If all went well, you should see the Point-to-Point link established and the IP addresses assigned.
- If everything is working, you can disconnect the Ethernet cable (if connected) and enjoy talking to the Empeg only over IR.
- Note that if the player software is restarted at this point, it should (can be made to) bind to the appropriate port (I think it is 8300) and listen on the newly found address. In other words, emplode/emptool should work over IR. [NB: I am yet to verify this.]
Please note that IrComm is not the only way to connect the Empeg to an IR-enabled computer, but it is the simplest. IrLAN in ad-hoc mode might be another option.
Amit Singh (amit_s@acm.org)
|
Top
|
|
|
|
#60543 - 19/01/2002 10:36
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
This is a nice tutorial. I don't have any interesting uses for this just yet, but my Casio PDA has an IrDA port and that could have some interesting uses in the future... I'm going to put this up on RioCar.org. Thanks again for a nice contribution, Amit.
|
Top
|
|
|
|
#60544 - 19/01/2002 18:42
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Hey Amit, what would be required to do the opposite (use the Empeg as the PPP daemon and the other machine as a client)? I am interested in running pppd on my Empeg and having my PDA try to connect to that PPPD via the IrDA link. I didn't have much success getting anything working. When I run pppd it says "pppd: Couldn't determine if PPP is supported (no free ptys)". Did you do any experimenting with the Empeg as the pppd instead of the client?
Thanks.
|
Top
|
|
|
|
#60545 - 19/01/2002 21:31
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
Tony
The concept of client-server in case of PPP is very much nominal (the end initiating the connection is the client). Therefore, it doesn't matter which end is the "server".
I did successfully make the Empeg the server (pppd running there first and waiting for a client connection). It should work. The pppd command line on the Empeg should look something like the following (x.x.x.x and y.y.y.y are the local and remote IP addresses to be assigned to the end-points):
pppd /dev/ircomm0 57600 x.x.x.x:y.y.y.y noauth debug
Which PDA is it, BTW?
Make sure you enable discovery on the Empeg side:
echo 1 > /proc/sys/net/irda/discovery
After some beaming attempts, check in "/proc/net/irda/discovery" (the discovery log) to see if the Empeg can detect the PDA's presence.
Assuming you installed irda-utils on the Empeg, run "irdadump" which will show you any packets the Empeg is receiving on the Infra-red port.
Hope this helps.
Regards
Amit
|
Top
|
|
|
|
#60546 - 19/01/2002 21:38
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
I still get:
pppd: Couldn't determine if PPP is supported (no free ptys)
I tried creating a /dev/ptyp0 with major 2, minor 0 thinking it needed a pty to be available, but this did nothing. I did create the ircomm0 devices based on the ones on my RedHat box.
It should be noted that I didn't install from debian packages because I don't have a debian environment set up. What I did was extracted the files from the debian packages (using "ar x" and then "tar xzvf") and copied in the needed binaries and such. I guess it's possible I screwed something up. My next step is to try to do a chroot to a sane debian environment and try this process again.
But in the meantime if you can think of anything else I might have done wrong, I'm open to suggestions.
It's a Casio E-100 by the way. I am just trying that because it's the only IrDA device I own and I have nothing better to do with it.
|
Top
|
|
|
|
#60547 - 19/01/2002 23:12
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
Tony
An explanation of the error you are getting: the new PPP code tries to grab a pty master slave pair in order to set it to the ppp line discipline (earlier they simply opened the serial device and used to set that to the ppp ldisc).
The "get_pty()" function in PPP code tries to get a pty pair by opening /dev/ptmx (the Unix 98 PTY style), failing which it scans through the pty name space (/dev/pty???), etc.
The missing "devpts" file-system and the missing old style pty devices in /dev should be the reason for your current error message, most likely.
Creating /dev/ptyp0 { major 2, minor 0 } indeed creates a master pty, which pppd should pick up correctly. You also need a corresponding slave pty, which will be /dev/ttyp0 { major 3, minor 0 }. Create the slave and see if pppd stops complaining.
Regards
Amit
|
Top
|
|
|
|
#60548 - 19/01/2002 23:49
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Okay, got a little farther... PPPD doesn't complain about the pty, but now it's silently exiting without doing anything. Here's my command line:
pppd /dev/ircomm0 57600 192.168.1.3:192.168.1.8 noauth debug
192.168.1.3 is the Empeg's IP, 192.168.1.8 is the WinCE client. The pppd doesn't run, it just exits (doesn't appear in a ps -e output.)
I'm stumped.
By the way, does the IR discovery stuff happen regardless of pppd status? That is, can I do the echo 1 > /proc/sys/net/irda/discovery and then see some kind of response from the IR client in the discovery log? Or do I need pppd running first? I get absolutely no output in the discovery log right now.
Sorry for all the questions but I've never done anything with IrDA so all this is new.
|
Top
|
|
|
|
#60549 - 20/01/2002 00:32
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
Tony
The discovery stuff should not be dependent on pppd. First of all, when you do an "irattach /dev/ttyS2 -s 1" on the Empeg, the device irda0 should come up. You should point the PDA towards the front of the Empeg and cause IR transmission to happen, which hopefully should cause discovery.
The most appropriate way to verify that the two devices can send IR to each other is to use "irdadump". Run irdadump on the Empeg and see if it dumps packets or not. This utility is part of the irda-tools package.
Regards
Amit
|
Top
|
|
|
|
#60550 - 20/01/2002 00:49
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Hmm... I'm having no luck tonight. I get this:
empeg:/# irattach /dev/ttyS2 -s 1
1.1 Tue Nov 9 15:30:55 1999 Dag Brattli
empeg:/# IrDA: Registered device irda0
irmanager is not running!
So When I tried to run irmanager (don't know the command line switches so I just ran it) I got this:
sh: -c: line 1: syntax error near unexpected token `(none)'
sh: -c: line 1: `echo (none) > /proc/sys/net/irda/devname 2>&1'
Anyway I think I'm getting closer here but no luck yet.
|
Top
|
|
|
|
#60551 - 20/01/2002 00:54
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
Hmmm ... I don't have my laptop with me at the moment, so I can't see what irmanager is doing, but I believe you can just ignore the "irmanager not running" message. The switch to irmanager is simply "start" (assuming it is a shell script living in /etc/init.d (Debian style), or somewhere else if not Debian).
irda0 coming up is a good sign. Actually, if you now try to flash your PDA in front of the Empeg (with IR transmission happening), you should see the RX or TX (or both) packet count increasing on the irda0 device (do an "ifconfig irda0" and verify if the packet count increases over time).
Regards
Amit
|
Top
|
|
|
|
#60552 - 20/01/2002 01:03
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Hmm TX and RX counts are increasing regardless of whether the PDA is sending or not. So it's kinda hard to tell if anything is really happening.
IRmanager is actually a binary located in /usr/sbin. I think I got it out of the irda-tools package. It's not an init script so 'start' isn't a valid option. I'll do some net searching to see what it's all about.
|
Top
|
|
|
|
#60553 - 20/01/2002 01:12
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Interesting development... I got stuff in the discovery log, including the "hostname" of my PDA. But also with some errors...
cat /proc/net/irda/discovery
IrLMP: Discovery log:
name: Leo, hint: 0x8204, saddr: 0xb4a1075b, daddr: 0x00000b9f
empeg:/# irmanager is not running!
irmanager is not running!
IrLAP, no activity on link!
Some of that stuff came out on stderr. Looks like I'm onto something here, but it still doesn't like that it can't find irmanager
|
Top
|
|
|
|
#60554 - 20/01/2002 01:14
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
On my Empeg/Debian set-up, there is a harness shell script for irmanager (/etc/init.d) - I'll look at it and tell you what "start" translates to in terms of arguments (when I reach home :-))
Regards
Amit
|
Top
|
|
|
|
#60555 - 20/01/2002 01:16
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Well I figured out that irmanager -d 1 means discovery on (I guess same as echo 1 > /proc/...../discovery). But that's all I really found out about it.
Well thanks for your help, I'm done trying to get this to work tonight. This does have some interesting applications for me though. One thing... Does IrDA traffic conflict with consumer IR? That is, if I had an IrDA link between the Empeg and the PDA, would I still be able to use my remote? If not it'd be a little less useful...
|
Top
|
|
|
|
#60556 - 20/01/2002 01:32
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
new poster
Registered: 11/01/2002
Posts: 21
Loc: Bay Area
|
According to the standard, an IrDA device is not allowed to transmit if the media is busy. In the Empeg's case, there is only one phyiscal IR port: I am not sure if time-multiplexing of the channel is implemented, or even possible.
I'll experiment with the behavior of the remote when there is an IrDA TCP/IP connection established.
Regards
Amit
Edited by amit (20/01/2002 05:14)
|
Top
|
|
|
|
#60557 - 20/01/2002 14:23
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: amit]
|
carpal tunnel
Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
|
There are 2 IR devices on the empeg; a consumer IR receiver (modulated on 38khz carrier) and an IrDA transceiver. Using IrDA will give fake transitions on the consumer IR, but it very unlikely to generate a valid button sequence.
If IrDA is transmitting, you will probably not have a lot of luck using the remote though!
Hugo
|
Top
|
|
|
|
#60558 - 20/01/2002 16:25
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: altman]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
If IrDA is transmitting, you will probably not have a lot of luck using the remote though!
Darn. I thought they might be travelling on different frequencies or something or could coexist somehow. I was hoping to be able to have an IrDA link btwn the Empeg and my palmtop and still be able to use IR. Oh well.
|
Top
|
|
|
|
#60559 - 20/01/2002 17:06
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: tonyc]
|
carpal tunnel
Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
|
...as long as it's not active, you'll be fine. The power fo the irda transmit probably overwhelms the AGC on the consumer IR receiver though.
Hugo
|
Top
|
|
|
|
#60560 - 20/01/2002 17:10
Re: TCP/IP over Infra-red on the Empeg: A HOWTO
[Re: altman]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Oh well if I get IrDA working I'll probably do some experimenting.
|
Top
|
|
|
|
|
|