Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 1 of 2 1 2 >
Topic Options
#194001 - 18/12/2003 00:31 C code to find empegs IP
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Does anybody have a snippet of C code to find the empegs current IP address (or a reference on how to do this under linux)? I have daapd and a simple multicast dns responder basically working on the empeg. This allows all the mp3s on your empeg to automatically show up as shared files for anyone running iTunes on your local network so people can browse and stream from your collection. It seems to work pretty well, but I want to make it a little more user friendly before I release it.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194002 - 18/12/2003 00:45 Re: C code to find empegs IP [Re: mcomb]
Daria
carpal tunnel

Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
At minimum you should be able to steal code from ifconfig, since it enumerates interfaces and prints said info.

Top
#194003 - 18/12/2003 02:42 Re: C code to find empegs IP [Re: Daria]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
At minimum you should be able to steal code from ifconfig

Duh! That would be way to obvious. I dug around and found something that I think will work.

Thanks,
-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194004 - 18/12/2003 09:42 Re: C code to find empegs IP [Re: mcomb]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
You could look at the FindEmpeg source code for how to construct the UDP broadcast packet to search for an empeg. You'll have to excuse the massive unwieldy code though, I hacked it together in about a day or so.

Top
#194005 - 18/12/2003 11:47 Re: C code to find empegs IP [Re: tman]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
You guys are talking all Linux/Cygwin, though. My dream would be a self-contained Windows DLL version of FindEmpeg...

I was going to write some VB code to do it as part of EmpegFace, then discovered that the Winsock OCX won't do broadcast packets, and therefore I was down to coding in raw API calls again. So I skipped it...
_________________________
Tony Fabris

Top
#194006 - 18/12/2003 12:09 Re: C code to find empegs IP [Re: tfabris]
siberia37
old hand

Registered: 09/01/2002
Posts: 702
Loc: Tacoma,WA
In reply to:

I was going to write some VB code to do it as part of EmpegFace, then discovered that the Winsock OCX won't do broadcast packets, and therefore I was down to coding in raw API calls again. So I skipped it...




That would be cool, if I have some extra time over my xmas break (gotta love working in education) I'll try to hack up an ActiveX control to do this. Then you could even make an ASP/PHP web page to find empegs on your network and other fun stuff...

Top
#194007 - 18/12/2003 12:10 Re: C code to find empegs IP [Re: tfabris]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Hmm. I'll have a look at it. It always compiles fine under MinGW.

Top
#194008 - 18/12/2003 12:10 Re: C code to find empegs IP [Re: mcomb]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4172
Loc: Cambridge, England
I have daapd and a simple multicast dns responder basically working on the empeg.
I hadn't heard of DAAP before. That's well cool. It's a pity all the toolkits seem to be GPL (or Java); if there were a nice BSD-licensed library, and if I had anything to do with it, that stuff would be going in the stock Empeg and Karma firmware.

Presumably Apple decided that UPnP MediaServer was too much like hard work?

Edit: and to answer your question, get an Emptool distribution and look for lib/net/ipaddress.cpp's GetAddressForInterface(), passing "eth0". Or look up SIOCGIFADDR in your nearest W Richard Stevens book.

Peter

Top
#194009 - 18/12/2003 12:17 Re: C code to find empegs IP [Re: tman]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
You could look at the FindEmpeg source code for how to construct the UDP broadcast packet to search

Thanks, but I actually needed the opposite. I need to get the ip from a piece of software that actually runs on the empeg.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194010 - 18/12/2003 12:20 Re: C code to find empegs IP [Re: mcomb]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
Ohhh. In that case then yeah, get the ifconfig code Or if you can wait, I can dig out the snippet I wrote ages ago that does the same thing.

Top
#194011 - 18/12/2003 12:21 Re: C code to find empegs IP [Re: mcomb]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
I need to get the ip from a piece of software that actually runs on the empeg.
OH! That's a different thing altogether.

Isn't there something in /proc already? A nice loose file you can just read and parse? Either by default, or via the Hijack kernel?
_________________________
Tony Fabris

Top
#194012 - 18/12/2003 12:25 Re: C code to find empegs IP [Re: peter]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
That's well cool. It's a pity all the toolkits seem to be GPL (or Java)

It actually looks like it wouldn't be too tough to implement from scratch. You need a multicast DNS responder (I started with this), the actual daapd deamon isn't much more than a webserver.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194013 - 18/12/2003 12:26 Re: C code to find empegs IP [Re: siberia37]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
(Siberia)
I'll try to hack up an ActiveX control to do this.
(Tman)
Hmm. I'll have a look at it. It always compiles fine under MinGW.
Hey, cool, guys. Doesn't need to be as complicated as an ActiveX, just a simple DLL with a few exposed functions would be enough. Ideally, you'd want it to (a) automatically find the hosts file on the appropriate system, which is different depending on which windows version your're running, and (b) optionally write the designated hostname/ip to the hosts file, or simply return the requested IP address without writing to the hosts file.
_________________________
Tony Fabris

Top
#194014 - 18/12/2003 12:29 Re: C code to find empegs IP [Re: tman]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Or if you can wait, I can dig out the snippet I wrote ages ago that does the same thing.

Don't worry about it. I already dug something out of ifconfig.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194015 - 18/12/2003 12:37 Re: C code to find empegs IP [Re: mcomb]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4172
Loc: Cambridge, England
It actually looks like it wouldn't be too tough to implement from scratch. You need a multicast DNS responder (I started with this), the actual daapd deamon isn't much more than a webserver.
Ferrrrrry eeeenterestink...

Peter

Top
#194016 - 18/12/2003 13:22 Re: C code to find empegs IP [Re: mcomb]
matthew_k
pooh-bah

Registered: 12/02/2002
Posts: 2298
Loc: Berkeley, California
This sounds like a really cool project, I can't wait to see how it works out... I use itunes occasionally, but it'd be great to use its interface for streaming. Can you filter based on ID3 tags like you can if things are in your library when you're in a shared library?

Matthew

Top
#194017 - 18/12/2003 13:43 Re: C code to find empegs IP [Re: matthew_k]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Can you filter based on ID3 tags like you can if things are in your library when you're in a shared library?

Yep, everything works just like local files except you can't modify tags or copy files out of itunes.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194018 - 18/12/2003 19:20 Re: C code to find empegs IP [Re: tfabris]
Daria
carpal tunnel

Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
Windows stuff. How quaint. Get a real OS and call me back.

Top
#194019 - 09/06/2005 14:04 Re: C code to find empegs IP [Re: Daria]
pgrzelak
carpal tunnel

Registered: 15/08/2000
Posts: 4859
Loc: New Jersey, USA
Greetings!

Was anything published out of this project? I had someone ask me about iTunes and daapd today, and I did a search / found this thread. Thanks!
_________________________
Paul Grzelak
200GB with 48MB RAM, Illuminated Buttons and Digital Outputs

Top
#194020 - 09/06/2005 15:31 Re: C code to find empegs IP [Re: pgrzelak]
Daria
carpal tunnel

Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
Well, there's a mini ifconfig with the gpsapp/gpsd stuff, but IIRC it ups 127.0.0.1 and doesn't get the ip of the real net.

I could make it do so. But is that what you want?

Top
#194021 - 12/06/2005 15:50 Re: C code to find empegs IP [Re: Daria]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
I'm assuming Paul was asking about daapd not ifconfig. Anyway, I never quite got it working to my satisfaction. I had memory issues (not enough of it) and never found a multicast responder that didn't suck. Now that many of us have memory upgrades and daapd appears to have mDNS builtin it is probably an easier proposition, but I haven't had time to look into it again. Someone (tonyc?) also sent me a PM a while back asking about it and it sounded like he was going to try and get it working, not sure if anything ever came of that.

Once the new car smell wears off ('05 Mustang GT getting delivered on Wednesday) and I get an empeg installed I may try to find time to get it working again.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194022 - 21/09/2005 00:53 Re: C code to find empegs IP [Re: mcomb]
Daria
carpal tunnel

Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
So did you ever get anywhere with this? I'm sort of tempted to put daapd on my empeg but if you already have (mostly) done work I see no reason to duplicate it.

Top
#194023 - 21/09/2005 17:37 Re: C code to find empegs IP [Re: Daria]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Quote:
So did you ever get anywhere with this? I'm sort of tempted to put daapd on my empeg but if you already have (mostly) done work I see no reason to duplicate it.


Nope sorry, never got a chance to look at it again. If you feel motivated to work on it, I wouldn't wait for me. I don't have the code from the first time I tried to get it working and daapd has changed a lot since then anyway.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194024 - 21/09/2005 19:04 Re: C code to find empegs IP [Re: Daria]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14478
Loc: Canada
Is the idea here to have a way for a program *running on the player* to determine the player's IP address for the player's ethernet port?

-ml

Top
#194025 - 21/09/2005 19:59 Re: C code to find empegs IP [Re: mlord]
tman
carpal tunnel

Registered: 24/12/2001
Posts: 5528
No. That part is already done.

Top
#194026 - 21/09/2005 22:10 Re: C code to find empegs IP [Re: mlord]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Quote:
Is the idea here to have a way for a program *running on the player* to determine the player's IP address for the player's ethernet port?


Nah, asked and answered. Now we are talking about a daap (iTunes music sharing protocol) server for the empeg. It would allow all your music on the empeg to show up to any iTunes clients on your network and stream from the empeg to iTunes.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194027 - 22/09/2005 07:02 Re: C code to find empegs IP [Re: mcomb]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
Quote:
Nah, asked and answered. Now we are talking about a daap (iTunes music sharing protocol) server for the empeg. It would allow all your music on the empeg to show up to any iTunes clients on your network and stream from the empeg to iTunes.

This would be cool.

Peripherally cool would be some kind of iTunes plug in that would allow it to read and stream songs off of a Rio Central server.

The protocols are well-documented (it's just HTTP calls), and I even wrote a quick and dirty standalone Visual Basic program to do this very thing, it was simple. So I figure writing something similar as an iTunes plug-in would be a doddle. Once one knew how to write iTunes plug-ins, that is.

Alternatively, I wonder how easy it would be to use some sort of virtual windows emulator on my Mac to just fire up that VB program of mine. What are my options in that arena?
_________________________
Tony Fabris

Top
#194028 - 23/09/2005 00:59 Re: C code to find empegs IP [Re: mcomb]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Quote:
Quote:
So did you ever get anywhere with this? I'm sort of tempted to put daapd on my empeg but if you already have (mostly) done work I see no reason to duplicate it.


Nope sorry, never got a chance to look at it again. If you feel motivated to work on it, I wouldn't wait for me. I don't have the code from the first time I tried to get it working and daapd has changed a lot since then anyway.


Well, you guys talked me into it I guess. I got mt-daapd to compile (pretty straightforward) and made a few tweaks to get it to deal with the empeg's file system layouts rather than expecting everything to end in .mp3. You definitely need an empeg with extra memory to run this and the player at the same time. My 32Meg player seems to be pretty happy sharing about 30 gigs over daapd with the player running and a reservecache of 120, but sharing 60 gigs (both drives) seems to pretty much kill it.

At the moment you must have a drive mounted read-write for daapd's database file at all times. I'd like to see if I can do anything about that before I post it. Give me a day or two.

-Mike


Edited by mcomb (23/09/2005 01:14)
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194029 - 23/09/2005 01:05 Re: C code to find empegs IP [Re: tfabris]
mcomb
pooh-bah

Registered: 31/08/1999
Posts: 1649
Loc: San Carlos, CA
Quote:
Peripherally cool would be some kind of iTunes plug in that would allow it to read and stream songs off of a Rio Central server.


I believe there is an iTunes peripheral plugin interface that you might be able to abuse to do this. Send me a Central and I'll think about it

Quote:
Alternatively, I wonder how easy it would be to use some sort of virtual windows emulator on my Mac to just fire up that VB program of mine. What are my options in that arena?


Not many options that I know of. VirtualPC would be your best bet, but it is pretty painfully slow and I can't imaging running it just for that.

-Mike
_________________________
EmpMenuX - ext3 filesystem - Empeg iTunes integration

Top
#194030 - 23/09/2005 09:18 Re: C code to find empegs IP [Re: mcomb]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31565
Loc: Seattle, WA
Quote:
send me a Central and I'll think about it

You know, Mike Schrag's got one he was going to send to me after I got settled here in Seattle. If you're serious about that offer, it could be arranged to make a detour on the way here.
_________________________
Tony Fabris

Top
Page 1 of 2 1 2 >